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

# Ingest AI calls

> Ingest a batch of AI records (limited to max 2000 per request) — model calls and non-LLM cost items, told apart by `record_kind` (omitted means `llm_call`). Records are processed asynchronously; a record with the same id is deduplicated on storage.



## OpenAPI

````yaml post /v1/ai/calls
openapi: 3.1.0
info:
  title: Hyperline Ingest API
  version: 0.0.0
servers:
  - url: https://ingest.hyperline.co
  - url: https://sandbox.ingest.hyperline.co
security: []
paths:
  /v1/ai/calls:
    post:
      tags:
        - AI
      summary: Ingest AI calls
      description: >-
        Ingest a batch of AI records (limited to max 2000 per request) — model
        calls and non-LLM cost items, told apart by `record_kind` (omitted means
        `llm_call`). Records are processed asynchronously; a record with the
        same id is deduplicated on storage.
      operationId: ingestAiCalls
      requestBody:
        description: AI calls payload.
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                    maxLength: 128
                    description: >-
                      Caller-generated record id. A record with the same id is
                      deduplicated on storage.
                    example: aic_01JT4E2Q4N8N0F0X4S2M3R7YQK
                  run_id:
                    type: string
                    minLength: 1
                    maxLength: 128
                    description: >-
                      The run this record belongs to. Every record captured
                      inside one `hyperline.run()` shares it.
                    example: run_01JT4E2Q4N8N0F0X4S2M3R7YQL
                  parent_run_id:
                    type:
                      - string
                      - 'null'
                    minLength: 1
                    maxLength: 128
                    description: >-
                      The enclosing run, when this one was opened inside
                      another. Null at the top of a run tree.
                    example: null
                  customer_id:
                    type: string
                    minLength: 1
                    maxLength: 255
                    description: >-
                      The customer this usage is attributed to — the external id
                      your application knows them by, or a Hyperline `cus_…` id.
                    example: cus_xyz789
                  agent:
                    type: string
                    minLength: 1
                    maxLength: 128
                    description: Stable agent identity, e.g. the agent's name or type.
                    example: invoice-copilot
                  action:
                    type:
                      - string
                      - 'null'
                    minLength: 1
                    maxLength: 128
                    description: >-
                      What the run does, e.g. `deep_research`. Null when
                      unnamed.
                    example: monitoring_analysis
                  record_kind:
                    type: string
                    enum:
                      - llm_call
                      - cost
                    default: llm_call
                    description: >-
                      What the record is. `llm_call` is a model invocation and
                      the token counters mean something; `cost` is a non-LLM
                      cost item whose quantity rides in `usage_extra`. Absent
                      means `llm_call`, so an older SDK keeps ingesting
                      unchanged.
                    example: llm_call
                  provider:
                    type: string
                    minLength: 1
                    maxLength: 64
                    description: The model's provider, or the vendor on a `cost` record.
                    example: anthropic
                  model:
                    type: string
                    minLength: 1
                    maxLength: 128
                    description: >-
                      The model invoked, or the item purchased on a `cost`
                      record.
                    example: claude-sonnet-5
                  input_tokens:
                    type: integer
                    minimum: 0
                    maximum: 1000000000
                    description: Uncached input tokens.
                    example: 12400
                  output_tokens:
                    type: integer
                    minimum: 0
                    maximum: 1000000000
                    description: Output tokens.
                    example: 1300
                  cached_input_tokens:
                    type: integer
                    minimum: 0
                    maximum: 1000000000
                    description: Input tokens served from the provider's prompt cache.
                    example: 9000
                  cache_write_tokens:
                    type: integer
                    minimum: 0
                    maximum: 1000000000
                    description: Input tokens written into the provider's prompt cache.
                    example: 0
                  reasoning_tokens:
                    type: integer
                    minimum: 0
                    maximum: 1000000000
                    description: Reasoning tokens, on models that bill them separately.
                    example: 0
                  status:
                    type: string
                    enum:
                      - ok
                      - error
                    description: Whether the call succeeded.
                    example: ok
                  duration_ms:
                    type: integer
                    minimum: 0
                    description: Wall-clock duration of the call.
                    example: 1840
                  started_at:
                    type: string
                    format: date-time
                    description: When the call started, as an ISO instant.
                    example: '2026-08-18T10:22:31.201Z'
                  metadata:
                    type:
                      - object
                      - 'null'
                    additionalProperties:
                      anyOf:
                        - type: string
                          maxLength: 1024
                        - type: number
                        - type: boolean
                        - type: 'null'
                        - type: 'null'
                    description: >-
                      Free-form bag carried alongside the record. At most 50
                      keys, string values at most 1024 characters, 4096 bytes
                      once serialized.
                    example:
                      conversation_id: cnv_123
                  usage_extra:
                    type:
                      - object
                      - 'null'
                    additionalProperties:
                      type: number
                      minimum: 0
                      maximum: 1000000000000
                    description: >-
                      Cost dimensions beyond the token classes — provider extras
                      (web searches, image generations) or the caller's own
                      units (vector queries, gpu_seconds). Keys must match
                      `[a-z0-9_.]{1,64}`, values must be finite and at most
                      1e12, at most 20 keys.
                    example:
                      web_search: 2
                required:
                  - id
                  - run_id
                  - parent_run_id
                  - customer_id
                  - agent
                  - action
                  - provider
                  - model
                  - input_tokens
                  - output_tokens
                  - cached_input_tokens
                  - cache_write_tokens
                  - reasoning_tokens
                  - status
                  - duration_ms
                  - started_at
                  - metadata
                description: >-
                  One record captured by the Hyperline AI SDK — a model call
                  (`record_kind: "llm_call"`, the default when the field is
                  absent) or a non-LLM cost item (`record_kind: "cost"`, where
                  `provider`/`model` carry the vendor/item and the quantity
                  rides in `usage_extra`).
                example:
                  id: aic_01JT4E2Q4N8N0F0X4S2M3R7YQK
                  run_id: run_01JT4E2Q4N8N0F0X4S2M3R7YQL
                  parent_run_id: null
                  customer_id: cus_xyz789
                  agent: invoice-copilot
                  action: monitoring_analysis
                  record_kind: llm_call
                  provider: anthropic
                  model: claude-sonnet-5
                  input_tokens: 12400
                  output_tokens: 1300
                  cached_input_tokens: 9000
                  cache_write_tokens: 0
                  reasoning_tokens: 0
                  status: ok
                  duration_ms: 1840
                  started_at: '2026-08-18T10:22:31.201Z'
                  metadata:
                    conversation_id: cnv_123
                  usage_extra:
                    web_search: 2
              minItems: 1
              maxItems: 2000
      responses:
        '202':
          description: Calls accepted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  calls_accepted:
                    type: integer
                    description: Number of calls accepted for asynchronous processing.
                    example: 42
                required:
                  - calls_accepted
      security:
        - bearer: []
components:
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````