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

# Stats Summary

> One aggregate row over the window + a per-model breakdown; `agent_id`
narrows every number (totals, breakdown, savings) to one agent.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/workspaces/{workspace_id}/stats/summary
openapi: 3.1.0
info:
  title: Visceral Backend
  version: 0.2.0
  description: >-
    The Visceral backend HTTP API. SDK and ingestion endpoints authenticate with
    a workspace API key; dashboard and CLI endpoints authenticate with a user
    session token. Both are sent as `Authorization: Bearer <token>`.
servers:
  - url: https://api.visceralai.dev
security: []
paths:
  /v1/workspaces/{workspace_id}/stats/summary:
    get:
      tags:
        - stats
      summary: Stats Summary
      description: |-
        One aggregate row over the window + a per-model breakdown; `agent_id`
        narrows every number (totals, breakdown, savings) to one agent.
      operationId: stats_summary_v1_workspaces__workspace_id__stats_summary_get
      parameters:
        - name: workspace_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workspace Id
        - name: from
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: From
        - name: to
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: To
        - name: agent_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Agent Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatsSummary'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - sessionToken: []
components:
  schemas:
    StatsSummary:
      properties:
        from_time:
          type: string
          format: date-time
          title: From Time
        to_time:
          type: string
          format: date-time
          title: To Time
        total_events:
          type: integer
          title: Total Events
        llm_calls:
          type: integer
          title: Llm Calls
        traces:
          type: integer
          title: Traces
        sessions:
          type: integer
          title: Sessions
        errors:
          type: integer
          title: Errors
        input_tokens:
          type: integer
          title: Input Tokens
        output_tokens:
          type: integer
          title: Output Tokens
        cached_tokens:
          type: integer
          title: Cached Tokens
        cache_write_tokens:
          type: integer
          title: Cache Write Tokens
        reasoning_tokens:
          type: integer
          title: Reasoning Tokens
        cost_usd:
          type: number
          title: Cost Usd
        estimated_cache_savings_usd:
          type: number
          title: Estimated Cache Savings Usd
        p50_duration_ms:
          anyOf:
            - type: number
            - type: 'null'
          title: P50 Duration Ms
        p95_duration_ms:
          anyOf:
            - type: number
            - type: 'null'
          title: P95 Duration Ms
        models:
          items:
            $ref: '#/components/schemas/ModelBreakdown'
          type: array
          title: Models
      type: object
      required:
        - from_time
        - to_time
        - total_events
        - llm_calls
        - traces
        - sessions
        - errors
        - input_tokens
        - output_tokens
        - cached_tokens
        - cache_write_tokens
        - reasoning_tokens
        - cost_usd
        - estimated_cache_savings_usd
        - p50_duration_ms
        - p95_duration_ms
        - models
      title: StatsSummary
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ModelBreakdown:
      properties:
        model:
          type: string
          title: Model
        llm_calls:
          type: integer
          title: Llm Calls
        input_tokens:
          type: integer
          title: Input Tokens
        output_tokens:
          type: integer
          title: Output Tokens
        cached_tokens:
          type: integer
          title: Cached Tokens
        cost_usd:
          type: number
          title: Cost Usd
      type: object
      required:
        - model
        - llm_calls
        - input_tokens
        - output_tokens
        - cached_tokens
        - cost_usd
      title: ModelBreakdown
      description: >-
        Per-model aggregate inside a summary window (request model first,
        falling

        back to the provider-reported response model — same coalesce as the
        agents API).
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    sessionToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Short-lived user access token (ES256 JWT) issued by `POST
        /v1/auth/login` or the CLI device flow.

````