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

# List costs costs

> Requires scopes: traces:read



## OpenAPI

````yaml /api-reference/openapi.json get /api/costs
openapi: 3.1.0
info:
  title: EvalGate API
  version: 3.7.6
  description: EvalGate API. See docs/api-contract.md for stability commitments.
servers:
  - url: https://evalgate.com
    description: Production
  - url: http://localhost:3000
    description: Local
security: []
paths:
  /api/costs:
    get:
      tags:
        - costs
      summary: List costs costs
      description: 'Requires scopes: traces:read'
      operationId: get_costs
      parameters:
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 50
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: agentTree
          in: query
          required: false
          schema:
            type: string
        - name: breakdown
          in: query
          required: false
          schema:
            type: string
        - name: environment
          in: query
          required: false
          schema:
            type: string
        - name: excludeTest
          in: query
          required: false
          schema:
            type: string
        - name: traceId
          in: query
          required: false
          schema:
            type: string
        - name: workflowRunId
          in: query
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetApiCostsResponse200ApplicationJson'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth:
            - traces:read
components:
  schemas:
    GetApiCostsResponse200ApplicationJson:
      oneOf:
        - type: array
          items:
            type: object
            properties:
              parentId:
                oneOf:
                  - type: 'null'
                  - type: string
              budgetId:
                type: string
              agentName:
                type: string
              maxSpend:
                type: number
              spent:
                type: number
              remaining:
                type: number
              childBudgets:
                type: array
                items:
                  $ref: '#/components/schemas/JsonValue'
            additionalProperties: false
            required:
              - parentId
              - budgetId
              - agentName
              - maxSpend
              - spent
              - remaining
              - childBudgets
        - type: object
          properties:
            totalCost:
              type: number
            verifiedCost:
              type: number
            estimatedCost:
              type: number
            verifiedCount:
              type: number
            estimatedCount:
              type: number
            unknownCount:
              type: number
            byProvider:
              type: object
              additionalProperties:
                type: number
            byModel:
              type: object
              additionalProperties:
                type: number
            byCategory:
              type: object
              additionalProperties:
                type: number
            byAgent:
              type: object
              additionalProperties:
                type: number
            byStep:
              type: object
              additionalProperties:
                type: number
            retryCount:
              type: number
            retryCost:
              type: number
            totalTokens:
              type: number
            inputTokens:
              type: number
            outputTokens:
              type: number
            cachedInputTokens:
              type: number
            cacheSavingsUsd:
              type: number
          additionalProperties: false
          required:
            - totalCost
            - verifiedCost
            - estimatedCost
            - verifiedCount
            - estimatedCount
            - unknownCount
            - byProvider
            - byModel
            - byCategory
            - byAgent
            - byStep
            - retryCount
            - retryCost
            - totalTokens
            - inputTokens
            - outputTokens
            - cachedInputTokens
            - cacheSavingsUsd
        - type: array
          items:
            type: object
            properties:
              id:
                type: number
              spanId:
                oneOf:
                  - type: 'null'
                  - type: number
              workflowRunId:
                oneOf:
                  - type: 'null'
                  - type: number
              evaluationRunId:
                oneOf:
                  - type: 'null'
                  - type: number
              organizationId:
                $ref: '#/components/schemas/OrganizationId'
              provider:
                type: string
              model:
                type: string
              inputTokens:
                type: number
              outputTokens:
                type: number
              totalTokens:
                type: number
              inputCost:
                type: string
              outputCost:
                type: string
              totalCost:
                type: string
              isRetry:
                oneOf:
                  - type: 'null'
                  - type: boolean
                    enum:
                      - false
                  - type: boolean
                    enum:
                      - true
              retryNumber:
                oneOf:
                  - type: 'null'
                  - type: number
              costCategory:
                type: string
              costSource:
                type: string
              pricingVersion:
                oneOf:
                  - type: 'null'
                  - type: string
              environment:
                type: string
              isTest:
                oneOf:
                  - type: 'null'
                  - type: boolean
                    enum:
                      - false
                  - type: boolean
                    enum:
                      - true
              agentName:
                oneOf:
                  - type: 'null'
                  - type: string
              stepName:
                oneOf:
                  - type: 'null'
                  - type: string
              promptHash:
                oneOf:
                  - type: 'null'
                  - type: string
              cachedInputTokens:
                oneOf:
                  - type: 'null'
                  - type: number
              modelCallId:
                oneOf:
                  - type: 'null'
                  - type: string
              createdAt:
                type: string
                format: date-time
            additionalProperties: false
            required:
              - id
              - spanId
              - workflowRunId
              - evaluationRunId
              - organizationId
              - provider
              - model
              - inputTokens
              - outputTokens
              - totalTokens
              - inputCost
              - outputCost
              - totalCost
              - isRetry
              - retryNumber
              - costCategory
              - costSource
              - pricingVersion
              - environment
              - isTest
              - agentName
              - stepName
              - promptHash
              - cachedInputTokens
              - modelCallId
              - createdAt
        - type: object
          properties:
            last30Days:
              type: object
              properties:
                totalCost:
                  type: number
                totalTokens:
                  type: number
                requestCount:
                  type: number
              additionalProperties: false
              required:
                - totalCost
                - totalTokens
                - requestCount
            last7Days:
              type: object
              properties:
                totalCost:
                  type: number
                totalTokens:
                  type: number
                requestCount:
                  type: number
              additionalProperties: false
              required:
                - totalCost
                - totalTokens
                - requestCount
            topModels:
              type: array
              items:
                type: object
                properties:
                  provider:
                    type: string
                  model:
                    type: string
                  totalCost:
                    type: number
                  requestCount:
                    type: number
                additionalProperties: false
                required:
                  - provider
                  - model
                  - totalCost
                  - requestCount
            byCategory:
              type: array
              items:
                type: object
                properties:
                  category:
                    type: string
                  totalCost:
                    type: number
                  requestCount:
                    type: number
                additionalProperties: false
                required:
                  - category
                  - totalCost
                  - requestCount
            topAgents:
              type: array
              items:
                type: object
                properties:
                  agentName:
                    type: string
                  totalCost:
                    type: number
                  callCount:
                    type: number
                additionalProperties: false
                required:
                  - agentName
                  - totalCost
                  - callCount
            retryWaste:
              type: array
              items:
                type: object
                properties:
                  provider:
                    type: string
                  model:
                    type: string
                  agentName:
                    oneOf:
                      - type: 'null'
                      - type: string
                  retryCount:
                    type: number
                  retryCost:
                    type: number
                additionalProperties: false
                required:
                  - provider
                  - model
                  - agentName
                  - retryCount
                  - retryCost
            costConfidence:
              type: object
              properties:
                serverComputed:
                  type: number
                sdkFallback:
                  type: number
                unknownModel:
                  type: number
                container:
                  type: number
                totalCost:
                  type: number
                verifiedCount:
                  type: number
                estimatedCount:
                  type: number
                unknownCount:
                  type: number
                verifiedFraction:
                  type: number
              additionalProperties: false
              required:
                - serverComputed
                - sdkFallback
                - unknownModel
                - container
                - totalCost
                - verifiedCount
                - estimatedCount
                - unknownCount
                - verifiedFraction
          additionalProperties: false
          required:
            - last30Days
            - last7Days
            - topModels
            - byCategory
            - topAgents
            - retryWaste
            - costConfidence
    JsonValue:
      oneOf:
        - type: 'null'
        - type: boolean
        - type: number
        - type: string
        - type: array
          items:
            $ref: '#/components/schemas/JsonValue'
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
    OrganizationId:
      type: string
      format: uuid
    ApiError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - UNAUTHORIZED
                - FORBIDDEN
                - NOT_FOUND
                - VALIDATION_ERROR
                - RATE_LIMITED
                - CONFLICT
                - INTERNAL_ERROR
                - SERVICE_UNAVAILABLE
                - QUOTA_EXCEEDED
                - NO_ORG_MEMBERSHIP
                - CROSS_ORG_REFERENCE
                - INCOMPLETE
                - MALFORMED
            message:
              type: string
            details: {}
            requestId:
              type: string
              format: uuid
          required:
            - code
            - message
      required:
        - error
  responses:
    ValidationError:
      description: Validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Conflict:
      description: Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    RateLimited:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key or Session Token

````