> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nasiko.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Detail for one session: traces, token usage, and cost summary.



## OpenAPI

````yaml /api-reference/openapi.json get /api/observability/session/{session_id}
openapi: 3.1.0
info:
  title: Nasiko API
  description: >-
    HTTP API for the Nasiko OpenRuntime: agents, coding harnesses, TokenOps,
    routing, MCP, and secrets. Spec is generated from annotated routes; some
    surfaces are documented on the hand-written pages alongside this file.
  license:
    name: ''
  version: 0.1.0
servers: []
security: []
tags:
  - name: secrets
    description: Encrypted per-user agent secrets
  - name: catalog
    description: >-
      Agent catalog: registration, discovery, versions, per-agent secrets, and
      source import
  - name: agents
    description: >-
      Agent lifecycle: deployments, LLM routing config, update/rollback,
      upload-and-deploy
  - name: orchestrator
    description: >-
      A2A dispatch: routing-engine/ReAct orchestrator and direct agent chat,
      plus routing stats
  - name: users
    description: >-
      User management: CRUD, roles, credentials, accessible agents
      (superuser-only)
  - name: usage
    description: Per-user token usage and cost reporting
  - name: observability
    description: Sessions, traces, spans, agent logs, and FinOps reporting
  - name: llm-router
    description: LLM routing presets, provider/model catalog, and tier→model registry
  - name: mcp
    description: >-
      MCP gateway: agent-facing JSON-RPC tool calls, connector
      registration/upload/sharing, credentials & OAuth, and per-agent tool
      permissions
paths:
  /api/observability/session/{session_id}:
    get:
      tags:
        - observability
      summary: 'Detail for one session: traces, token usage, and cost summary.'
      operationId: get_session_details
      parameters:
        - name: session_id
          in: path
          description: A2A context/session ID
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Session detail
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionDetailResponse'
        '404':
          description: Session not found in the observability backend
components:
  schemas:
    SessionDetailResponse:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/SessionDetailData'
    SessionDetailData:
      type: object
      required:
        - session
      properties:
        session:
          $ref: '#/components/schemas/SessionDetail'
    SessionDetail:
      type: object
      required:
        - id
        - session_id
        - num_traces
        - token_usage
        - cost_summary
        - cache_read_tokens
        - cache_creation_tokens
        - metrics_complete
        - traces
        - pagination
      properties:
        agent_name:
          type:
            - string
            - 'null'
        cache_creation_tokens:
          type: integer
          format: int64
          minimum: 0
        cache_read_tokens:
          type: integer
          format: int64
          description: >-
            Prompt tokens served from / written to provider cache, over the
            session.
          minimum: 0
        cost_summary:
          $ref: '#/components/schemas/FullCostSummary'
        id:
          type: string
        latency_avg:
          type:
            - number
            - 'null'
          format: double
          description: >-
            Mean trace duration, which is what the KPI strip labels "Avg
            latency".
        latency_p50:
          type:
            - number
            - 'null'
          format: double
        latency_p99:
          type:
            - number
            - 'null'
          format: double
          description: >-
            The session page renders this KPI (`s.latency_p99`); it was silently

            `0.0 s` for every session while the field didn't exist in the
            response.
        metrics_complete:
          type: boolean
        num_traces:
          type: integer
          minimum: 0
        pagination:
          $ref: '#/components/schemas/Pagination'
        session_id:
          type: string
        title:
          type:
            - string
            - 'null'
          description: >-
            LLM-derived session name from `chat_sessions`. `None` for sessions
            that

            never went through chat (CLI / direct A2A), where the id is the
            heading.
        token_usage:
          $ref: '#/components/schemas/TokenUsageSummary'
        traces:
          type: array
          items:
            $ref: '#/components/schemas/TraceEntry'
    FullCostSummary:
      type: object
      required:
        - total
        - prompt
        - completion
        - cache_read
        - cache_creation
      properties:
        cache_creation:
          $ref: '#/components/schemas/CostWithTokens'
        cache_read:
          $ref: '#/components/schemas/CostWithTokens'
        completion:
          $ref: '#/components/schemas/CostWithTokens'
        prompt:
          $ref: '#/components/schemas/CostWithTokens'
        total:
          $ref: '#/components/schemas/CostWithTokens'
    Pagination:
      type: object
      required:
        - has_next_page
      properties:
        end_cursor:
          type:
            - string
            - 'null'
        has_next_page:
          type: boolean
    TokenUsageSummary:
      type: object
      properties:
        total:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
    TraceEntry:
      type: object
      required:
        - id
        - trace_id
        - root_span
        - cursor
      properties:
        cursor:
          type: string
        id:
          type: string
        root_span:
          $ref: '#/components/schemas/RootSpanEntry'
        trace_id:
          type: string
    CostWithTokens:
      type: object
      required:
        - cost
        - tokens
      properties:
        cost:
          type: number
          format: double
        tokens:
          type: integer
          format: int64
          minimum: 0
    RootSpanEntry:
      type: object
      required:
        - id
        - span_id
        - attributes
        - cumulative_token_count_total
        - input_tokens
        - output_tokens
        - cache_read_tokens
        - cache_creation_tokens
        - latency_ms
        - span_annotations
        - span_annotation_summaries
        - project
        - input
        - output
        - trace
      properties:
        attributes:
          type: string
        cache_creation_tokens:
          type: integer
          format: int64
          minimum: 0
        cache_read_tokens:
          type: integer
          format: int64
          minimum: 0
        cumulative_token_count_total:
          type: integer
          format: int64
          minimum: 0
        id:
          type: string
        input:
          $ref: '#/components/schemas/ContentField'
        input_tokens:
          type: integer
          format: int64
          description: >-
            Per-turn token split. `cumulative_token_count_total` is
            `input+output`;

            the cache counts are tracked separately and are not folded into it.
          minimum: 0
        latency_ms:
          type: number
          format: double
        output:
          $ref: '#/components/schemas/ContentField'
        output_tokens:
          type: integer
          format: int64
          minimum: 0
        project:
          $ref: '#/components/schemas/ProjectRef'
        span_annotation_summaries:
          type: array
          items:
            type: object
        span_annotations:
          type: array
          items:
            type: object
        span_id:
          type: string
        start_time:
          type:
            - string
            - 'null'
        trace:
          $ref: '#/components/schemas/TraceRef'
    ContentField:
      type: object
      required:
        - value
        - mime_type
      properties:
        mime_type:
          type: string
        parsed_value:
          type:
            - object
            - 'null'
        value:
          type: string
    ProjectRef:
      type: object
      required:
        - id
      properties:
        id:
          type: string
    TraceRef:
      type: object
      required:
        - id
        - cost_summary
      properties:
        cost_summary:
          type: object
        id:
          type: string

````