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

# Get Cost By Agent

> Cost aggregated per agent.



## OpenAPI

````yaml /openapi.json get /api/costs/by-agent
openapi: 3.1.0
info:
  title: Nenyax API
  description: Backend API for Nenyax Voice Agent Platform
  version: 0.1.0
servers:
  - url: http://localhost:8000
    description: Local development
security: []
paths:
  /api/costs/by-agent:
    get:
      tags:
        - Costs
      summary: Get Cost By Agent
      description: Cost aggregated per agent.
      operationId: get_cost_by_agent_api_costs_by_agent_get
      parameters:
        - name: x-user-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-User-Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AgentCostResponse'
                title: Response Get Cost By Agent Api Costs By Agent Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AgentCostResponse:
      properties:
        agent_id:
          type: string
          title: Agent Id
        agent_name:
          type: string
          title: Agent Name
        total_cost:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Total Cost
        session_count:
          type: integer
          title: Session Count
        event_count:
          type: integer
          title: Event Count
      type: object
      required:
        - agent_id
        - agent_name
        - total_cost
        - session_count
        - event_count
      title: AgentCostResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````