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

# Create a chat completion

> OpenAI-compatible chat completion. Supports streaming (`stream: true` returns `text/event-stream` SSE), function calling (`tools` / `tool_choice`), multimodal input (image_url / video_url content parts), reasoning_effort, and structured output (`response_format`). Pricing: credits are debited from team balance at completion, snapshotted to the per-model pricing version that was active when the credit hold was placed.

`Idempotency-Key` is honored on non-streamed requests only (24h replay window). Streamed requests echo `Aurous-Idempotency-Status: ignored_streaming` and emit a warning frame as the first SSE data line; use `stream=false` for at-most-once semantics.

Image and video rates are frozen per `Aurous-Version`: customers pinned to an older version see the rate card that was current when their version shipped, so price changes are never silently retroactive. Chat and embedding rates are NOT frozen per `Aurous-Version` — they track the most recently published rate version for each model, because LLM provider economics shift on weekly cadence. The receipt echoed on every chat / embedding response carries the exact rate that applied at dispatch time, so audit trails remain stable.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/chat/completions
openapi: 3.0.0
info:
  title: Aurous Labs API
  description: >-
    Generate AI images with custom LoRA styles.


    ## Authentication

    All requests require an API key passed in the `X-Api-Key` header.

    Create API keys in your
    [dashboard](https://app.aurous-labs.com/dashboard/api-keys).


    ## Closed-beta access gate

    API keys are scoped to a user. If that user's account is not approved for
    the closed beta, every request returns `403` with one of these `error.code`
    values:


    - `account_pending` — awaiting review

    - `account_rejected` — declined post-signup

    - `account_suspended` — was approved, then suspended


    There is no retry — contact support to be approved. The same codes are
    emitted by the WebSocket gateway via 4001 close.


    ## Common headers

    Every response carries `Aurous-Request-Id` (a server-minted `req_<ULID>` for
    support tracing) and `Aurous-Version` (the API version applied to the
    response). Optionally pin a version on the request with `Aurous-Version:
    YYYY-MM-DD` — defaults to your team's pinned version.


    ## Quick Start

    ```bash

    curl -X POST https://api.aurous-labs.com/v1/images \
      -H "X-Api-Key: al_live_your_key" \
      -H "Content-Type: application/json" \
      -d '{"prompt": "A golden sunset over mountains", "lora_id": "your-lora-id", "size": "2k_1_1"}'
    ```
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.aurous-labs.com
    description: Production
  - url: https://api.preprod.aurous-labs.com
    description: Preprod (staging)
security: []
tags:
  - name: Seedance (raw)
    description: >-
      Drop-in raw passthrough for Seedance video generation. Point the official
      Seedance provider SDK at this API's base URL and authenticate with your
      Aurous API key in the `X-Api-Key` header — request bodies are forwarded to
      the provider verbatim and responses come back shape-identical, so you keep
      the provider's exact request/response shapes. Task ids are Aurous-native
      `vid_…` ids. Billing rides response headers, not the body:
      `Aurous-Credits-Held` on the create response and `Aurous-Credits-Charged`
      on a settled, succeeded task read — the body itself stays provider-shaped.
paths:
  /v1/chat/completions:
    post:
      tags:
        - Chat
      summary: Create a chat completion
      description: >-
        OpenAI-compatible chat completion. Supports streaming (`stream: true`
        returns `text/event-stream` SSE), function calling (`tools` /
        `tool_choice`), multimodal input (image_url / video_url content parts),
        reasoning_effort, and structured output (`response_format`). Pricing:
        credits are debited from team balance at completion, snapshotted to the
        per-model pricing version that was active when the credit hold was
        placed.


        `Idempotency-Key` is honored on non-streamed requests only (24h replay
        window). Streamed requests echo `Aurous-Idempotency-Status:
        ignored_streaming` and emit a warning frame as the first SSE data line;
        use `stream=false` for at-most-once semantics.


        Image and video rates are frozen per `Aurous-Version`: customers pinned
        to an older version see the rate card that was current when their
        version shipped, so price changes are never silently retroactive. Chat
        and embedding rates are NOT frozen per `Aurous-Version` — they track the
        most recently published rate version for each model, because LLM
        provider economics shift on weekly cadence. The receipt echoed on every
        chat / embedding response carries the exact rate that applied at
        dispatch time, so audit trails remain stable.
      operationId: V1ChatCompletionsController_create
      parameters:
        - name: Aurous-Idempotency-Status
          in: header
          description: >-
            Echoed on the response. `ignored_streaming` when `stream=true`
            (idempotency does not apply); otherwise reflects the interceptor
            decision.
          required: false
          schema:
            type: string
        - name: Idempotency-Key
          in: header
          description: >-
            Stripe-style idempotency key. Honored only when `stream=false`. Same
            key + same canonical-JSON body returns the cached response with
            `Aurous-Idempotent-Replayed: true`. Same key + different body
            returns 409 `idempotency_key_in_use`. Replay window is 24 hours.
          required: false
          schema:
            type: string
        - name: Aurous-Version
          in: header
          required: false
          description: >-
            Optional API version pin (YYYY-MM-DD). Defaults to your team's
            pinned version, or the system default `2026-07-16` for
            unauthenticated requests.
          schema:
            type: string
            example: '2026-07-16'
            pattern: ^\d{4}-\d{2}-\d{2}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateChatCompletionDto'
      responses:
        '200':
          description: >-
            Chat completion. Content type depends on `stream`:
            `application/json` for `stream:false` (full response body);
            `text/event-stream` for `stream:true` (SSE).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
            text/event-stream:
              schema:
                type: string
                description: >-
                  SSE frames: `data: {<chunk>}\n\n` for each generation chunk
                  (OpenAI-shape), optionally `data: {"warning":{...}}` if
                  `Idempotency-Key` was sent, and `data: [DONE]\n\n` to signal
                  stream end. On provider error mid-stream a `data:
                  {"error":{code,type,message,request_id}}\n\n` frame precedes
                  `[DONE]`.
          headers:
            Aurous-Request-Id:
              description: Server-minted request id. Quote this in support tickets.
              schema:
                type: string
                example: req_01HXMQ7Z3K8Y2NABCDEFGHJKMP
            Aurous-Version:
              description: API version pin applied to this response (YYYY-MM-DD).
              schema:
                type: string
                example: '2026-07-16'
            X-RateLimit-Limit:
              description: Bucket capacity (max tokens) for this endpoint class.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Tokens remaining after this request.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Epoch seconds when the bucket would be full again, assuming no
                further requests.
              schema:
                type: integer
                example: 1700000060
            X-RateLimit-TPM-Limit:
              description: >-
                Tokens-per-minute bucket capacity for this endpoint class. Only
                set on TPM-throttled routes (/v1/chat/completions,
                /v1/embeddings).
              schema:
                type: integer
                example: 100000
            X-RateLimit-TPM-Remaining:
              description: >-
                Tokens remaining in the current minute bucket after this
                request. Clamped to 0 in the header (deductions can push the
                internal bucket negative for one burst).
              schema:
                type: integer
                example: 87500
            X-RateLimit-TPM-Reset:
              description: ISO 8601 timestamp when the TPM bucket resets to full.
              schema:
                type: string
                format: date-time
                example: '2026-05-19T18:14:00.000Z'
            Aurous-Idempotent-Replayed:
              description: >-
                Present (literal `true`) when this response was served from a
                stored idempotent replay — the same `Idempotency-Key` +
                canonical body was seen within the 24h window and the original
                response is returned WITHOUT re-executing (no second charge, no
                second task). Absent on the first (fresh) execution and on any
                request sent without an `Idempotency-Key`. Only on the
                idempotency-aware create routes.
              schema:
                type: string
                enum:
                  - 'true'
                example: 'true'
            Aurous-Idempotency-Status:
              description: >-
                Streaming idempotency signal on `POST /v1/chat/completions`.
                `ignored_streaming` when a streamed request (`stream: true`)
                also carried an `Idempotency-Key` — idempotent replay does not
                apply to SSE streams; `not_set` when a streamed request carried
                no key. Non-streamed idempotent replays are signalled by
                `Aurous-Idempotent-Replayed` instead.
              schema:
                type: string
                enum:
                  - ignored_streaming
                  - not_set
                example: ignored_streaming
        '400':
          description: >-
            Validation error, `model_wrong_kind`, `max_tokens_exceeds_hard_cap`,
            `missing_max_tokens_no_model_default`,
            `tool_choice_required_unsupported`, `response_format_too_large`,
            `response_format_too_deep`, or `max_input_tokens_exceeded`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          headers:
            Aurous-Request-Id:
              description: Server-minted request id. Quote this in support tickets.
              schema:
                type: string
                example: req_01HXMQ7Z3K8Y2NABCDEFGHJKMP
            Aurous-Version:
              description: API version pin applied to this response (YYYY-MM-DD).
              schema:
                type: string
                example: '2026-07-16'
            X-RateLimit-Limit:
              description: Bucket capacity (max tokens) for this endpoint class.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Tokens remaining after this request.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Epoch seconds when the bucket would be full again, assuming no
                further requests.
              schema:
                type: integer
                example: 1700000060
            X-RateLimit-TPM-Limit:
              description: >-
                Tokens-per-minute bucket capacity for this endpoint class. Only
                set on TPM-throttled routes (/v1/chat/completions,
                /v1/embeddings).
              schema:
                type: integer
                example: 100000
            X-RateLimit-TPM-Remaining:
              description: >-
                Tokens remaining in the current minute bucket after this
                request. Clamped to 0 in the header (deductions can push the
                internal bucket negative for one burst).
              schema:
                type: integer
                example: 87500
            X-RateLimit-TPM-Reset:
              description: ISO 8601 timestamp when the TPM bucket resets to full.
              schema:
                type: string
                format: date-time
                example: '2026-05-19T18:14:00.000Z'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          headers:
            Aurous-Request-Id:
              description: Server-minted request id. Quote this in support tickets.
              schema:
                type: string
                example: req_01HXMQ7Z3K8Y2NABCDEFGHJKMP
            Aurous-Version:
              description: API version pin applied to this response (YYYY-MM-DD).
              schema:
                type: string
                example: '2026-07-16'
            X-RateLimit-Limit:
              description: Bucket capacity (max tokens) for this endpoint class.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Tokens remaining after this request.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Epoch seconds when the bucket would be full again, assuming no
                further requests.
              schema:
                type: integer
                example: 1700000060
            X-RateLimit-TPM-Limit:
              description: >-
                Tokens-per-minute bucket capacity for this endpoint class. Only
                set on TPM-throttled routes (/v1/chat/completions,
                /v1/embeddings).
              schema:
                type: integer
                example: 100000
            X-RateLimit-TPM-Remaining:
              description: >-
                Tokens remaining in the current minute bucket after this
                request. Clamped to 0 in the header (deductions can push the
                internal bucket negative for one burst).
              schema:
                type: integer
                example: 87500
            X-RateLimit-TPM-Reset:
              description: ISO 8601 timestamp when the TPM bucket resets to full.
              schema:
                type: string
                format: date-time
                example: '2026-05-19T18:14:00.000Z'
        '402':
          description: '`balance_too_low` — team has insufficient credits.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          headers:
            Aurous-Request-Id:
              description: Server-minted request id. Quote this in support tickets.
              schema:
                type: string
                example: req_01HXMQ7Z3K8Y2NABCDEFGHJKMP
            Aurous-Version:
              description: API version pin applied to this response (YYYY-MM-DD).
              schema:
                type: string
                example: '2026-07-16'
            X-RateLimit-Limit:
              description: Bucket capacity (max tokens) for this endpoint class.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Tokens remaining after this request.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Epoch seconds when the bucket would be full again, assuming no
                further requests.
              schema:
                type: integer
                example: 1700000060
            X-RateLimit-TPM-Limit:
              description: >-
                Tokens-per-minute bucket capacity for this endpoint class. Only
                set on TPM-throttled routes (/v1/chat/completions,
                /v1/embeddings).
              schema:
                type: integer
                example: 100000
            X-RateLimit-TPM-Remaining:
              description: >-
                Tokens remaining in the current minute bucket after this
                request. Clamped to 0 in the header (deductions can push the
                internal bucket negative for one burst).
              schema:
                type: integer
                example: 87500
            X-RateLimit-TPM-Reset:
              description: ISO 8601 timestamp when the TPM bucket resets to full.
              schema:
                type: string
                format: date-time
                example: '2026-05-19T18:14:00.000Z'
        '403':
          description: '`model_disabled` or insufficient scope.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          headers:
            Aurous-Request-Id:
              description: Server-minted request id. Quote this in support tickets.
              schema:
                type: string
                example: req_01HXMQ7Z3K8Y2NABCDEFGHJKMP
            Aurous-Version:
              description: API version pin applied to this response (YYYY-MM-DD).
              schema:
                type: string
                example: '2026-07-16'
            X-RateLimit-Limit:
              description: Bucket capacity (max tokens) for this endpoint class.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Tokens remaining after this request.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Epoch seconds when the bucket would be full again, assuming no
                further requests.
              schema:
                type: integer
                example: 1700000060
            X-RateLimit-TPM-Limit:
              description: >-
                Tokens-per-minute bucket capacity for this endpoint class. Only
                set on TPM-throttled routes (/v1/chat/completions,
                /v1/embeddings).
              schema:
                type: integer
                example: 100000
            X-RateLimit-TPM-Remaining:
              description: >-
                Tokens remaining in the current minute bucket after this
                request. Clamped to 0 in the header (deductions can push the
                internal bucket negative for one burst).
              schema:
                type: integer
                example: 87500
            X-RateLimit-TPM-Reset:
              description: ISO 8601 timestamp when the TPM bucket resets to full.
              schema:
                type: string
                format: date-time
                example: '2026-05-19T18:14:00.000Z'
        '404':
          description: '`model_not_found`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          headers:
            Aurous-Request-Id:
              description: Server-minted request id. Quote this in support tickets.
              schema:
                type: string
                example: req_01HXMQ7Z3K8Y2NABCDEFGHJKMP
            Aurous-Version:
              description: API version pin applied to this response (YYYY-MM-DD).
              schema:
                type: string
                example: '2026-07-16'
            X-RateLimit-Limit:
              description: Bucket capacity (max tokens) for this endpoint class.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Tokens remaining after this request.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Epoch seconds when the bucket would be full again, assuming no
                further requests.
              schema:
                type: integer
                example: 1700000060
            X-RateLimit-TPM-Limit:
              description: >-
                Tokens-per-minute bucket capacity for this endpoint class. Only
                set on TPM-throttled routes (/v1/chat/completions,
                /v1/embeddings).
              schema:
                type: integer
                example: 100000
            X-RateLimit-TPM-Remaining:
              description: >-
                Tokens remaining in the current minute bucket after this
                request. Clamped to 0 in the header (deductions can push the
                internal bucket negative for one burst).
              schema:
                type: integer
                example: 87500
            X-RateLimit-TPM-Reset:
              description: ISO 8601 timestamp when the TPM bucket resets to full.
              schema:
                type: string
                format: date-time
                example: '2026-05-19T18:14:00.000Z'
        '429':
          description: RPM or TPM rate limit exceeded. See `Retry-After` header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          headers:
            Aurous-Request-Id:
              description: Server-minted request id. Quote this in support tickets.
              schema:
                type: string
                example: req_01HXMQ7Z3K8Y2NABCDEFGHJKMP
            Aurous-Version:
              description: API version pin applied to this response (YYYY-MM-DD).
              schema:
                type: string
                example: '2026-07-16'
            X-RateLimit-Limit:
              description: Bucket capacity (max tokens) for this endpoint class.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Tokens remaining after this request.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Epoch seconds when the bucket would be full again, assuming no
                further requests.
              schema:
                type: integer
                example: 1700000060
            Retry-After:
              description: >-
                Seconds to wait before retrying. Present on 429 (rate limit) and
                on 503 provider_unavailable. Prefer this over computing
                X-RateLimit-Reset − now.
              schema:
                type: integer
                example: 12
            X-RateLimit-TPM-Limit:
              description: >-
                Tokens-per-minute bucket capacity for this endpoint class. Only
                set on TPM-throttled routes (/v1/chat/completions,
                /v1/embeddings).
              schema:
                type: integer
                example: 100000
            X-RateLimit-TPM-Remaining:
              description: >-
                Tokens remaining in the current minute bucket after this
                request. Clamped to 0 in the header (deductions can push the
                internal bucket negative for one burst).
              schema:
                type: integer
                example: 87500
            X-RateLimit-TPM-Reset:
              description: ISO 8601 timestamp when the TPM bucket resets to full.
              schema:
                type: string
                format: date-time
                example: '2026-05-19T18:14:00.000Z'
        '502':
          description: '`chat_provider_unavailable` — upstream issue.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          headers:
            Aurous-Request-Id:
              description: Server-minted request id. Quote this in support tickets.
              schema:
                type: string
                example: req_01HXMQ7Z3K8Y2NABCDEFGHJKMP
            Aurous-Version:
              description: API version pin applied to this response (YYYY-MM-DD).
              schema:
                type: string
                example: '2026-07-16'
            X-RateLimit-Limit:
              description: Bucket capacity (max tokens) for this endpoint class.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Tokens remaining after this request.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Epoch seconds when the bucket would be full again, assuming no
                further requests.
              schema:
                type: integer
                example: 1700000060
            X-RateLimit-TPM-Limit:
              description: >-
                Tokens-per-minute bucket capacity for this endpoint class. Only
                set on TPM-throttled routes (/v1/chat/completions,
                /v1/embeddings).
              schema:
                type: integer
                example: 100000
            X-RateLimit-TPM-Remaining:
              description: >-
                Tokens remaining in the current minute bucket after this
                request. Clamped to 0 in the header (deductions can push the
                internal bucket negative for one burst).
              schema:
                type: integer
                example: 87500
            X-RateLimit-TPM-Reset:
              description: ISO 8601 timestamp when the TPM bucket resets to full.
              schema:
                type: string
                format: date-time
                example: '2026-05-19T18:14:00.000Z'
        '503':
          description: '`provider_rate_limited`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          headers:
            Aurous-Request-Id:
              description: Server-minted request id. Quote this in support tickets.
              schema:
                type: string
                example: req_01HXMQ7Z3K8Y2NABCDEFGHJKMP
            Aurous-Version:
              description: API version pin applied to this response (YYYY-MM-DD).
              schema:
                type: string
                example: '2026-07-16'
            X-RateLimit-Limit:
              description: Bucket capacity (max tokens) for this endpoint class.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Tokens remaining after this request.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Epoch seconds when the bucket would be full again, assuming no
                further requests.
              schema:
                type: integer
                example: 1700000060
            Retry-After:
              description: >-
                Seconds to wait before retrying. Present on 429 (rate limit) and
                on 503 provider_unavailable. Prefer this over computing
                X-RateLimit-Reset − now.
              schema:
                type: integer
                example: 12
            X-RateLimit-TPM-Limit:
              description: >-
                Tokens-per-minute bucket capacity for this endpoint class. Only
                set on TPM-throttled routes (/v1/chat/completions,
                /v1/embeddings).
              schema:
                type: integer
                example: 100000
            X-RateLimit-TPM-Remaining:
              description: >-
                Tokens remaining in the current minute bucket after this
                request. Clamped to 0 in the header (deductions can push the
                internal bucket negative for one burst).
              schema:
                type: integer
                example: 87500
            X-RateLimit-TPM-Reset:
              description: ISO 8601 timestamp when the TPM bucket resets to full.
              schema:
                type: string
                format: date-time
                example: '2026-05-19T18:14:00.000Z'
      security:
        - api-key: []
components:
  schemas:
    CreateChatCompletionDto:
      type: object
      properties:
        model:
          type: string
          description: >-
            Public model slug from GET /v1/models. Example:
            `aurous-grow-2.0-pro`.
          example: aurous-grow-2.0-pro
          maxLength: 128
        messages:
          description: Conversation messages, ordered oldest → newest. 1-200 messages.
          type: array
          items:
            $ref: '#/components/schemas/ChatMessageDto'
        max_tokens:
          type: number
          minimum: 1
          description: >-
            Maximum tokens to generate. Defaults to the model’s
            `default_max_output_tokens`. Requests with `max_tokens` > the
            model’s `max_output_tokens_hard_cap` return 400
            `max_tokens_exceeds_hard_cap`.
        temperature:
          type: number
          minimum: 0
          maximum: 2
        top_p:
          type: number
          minimum: 0
          maximum: 1
        stream:
          type: boolean
          description: >-
            If `true`, response is text/event-stream (SSE) with OpenAI-shaped
            chunks. When streaming, `Idempotency-Key` is ignored and a warning
            frame is emitted in the first chunk; use `stream=false` for
            at-most-once semantics.
        stream_options:
          type: object
          description: >-
            OpenAI-compatible stream options. When `stream: true`,
            `include_usage: true` (the default on Aurous Labs) causes the final
            non-`[DONE]` SSE frame to carry the `usage` block with token counts
            + credits_charged. Set `include_usage: false` to suppress (matches
            OpenAI behavior when the flag is omitted on their side). Ignored
            when `stream: false`.
        tools:
          type: array
          items:
            $ref: '#/components/schemas/ChatToolDto'
        tool_choice:
          type: object
          description: >-
            Function-calling routing: `auto` | `none` | `{type:"function",
            function:{name}}`. `required` is NOT supported and returns 400
            `tool_choice_required_unsupported`.
        response_format:
          type: object
          description: >-
            Structured output. `{type:"text"|"json_object"|"json_schema",
            json_schema?:{...}}`. For `json_schema`, the schema must be ≤10KB
            JSON-stringified and ≤5 levels deep, else 400
            `response_format_too_large` / `response_format_too_deep`.
        reasoning_effort:
          type: string
          enum:
            - minimal
            - low
            - medium
            - high
          description: >-
            Reasoning depth for reasoning-capable models. Higher values increase
            latency + token cost (reasoning tokens billed separately at the
            model’s output rate).
        seed:
          type: number
          description: Random seed for reproducibility (when supported by the model).
        stop:
          type: object
          description: >-
            Up to 4 stop sequences (string or array of strings; each ≤200
            chars).
        presence_penalty:
          type: number
          minimum: -2
          maximum: 2
        frequency_penalty:
          type: number
          minimum: -2
          maximum: 2
        logprobs:
          type: boolean
          description: Return log-probabilities for output tokens.
        top_logprobs:
          type: number
          minimum: 0
          maximum: 20
      required:
        - model
        - messages
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
          description: Opaque chat-completion id.
          example: cmp_01HXMQ7Z3K8Y2ABCDEFGHJKM
        object:
          type: string
          enum:
            - chat.completion
        created:
          type: number
          description: Unix timestamp (seconds).
          example: 1731948000
        model:
          type: string
          description: Aurous model slug used.
          example: aurous-grow-2.0-pro
        choices:
          description: Always exactly 1 entry in v1.0.
          type: array
          items:
            $ref: '#/components/schemas/ChatChoice'
        usage:
          $ref: '#/components/schemas/ChatUsage'
        status:
          type: string
          description: >-
            Aurous extension: terminal state of the chat completion. `completed`
            is the normal happy path. `in_progress` means the request is still
            being processed (only possible when polling GET /:id during a
            streamed request). `failed` means the provider or platform errored —
            see `error` for the typed reason. `cancelled` means a cancel was
            requested or the client disconnected.
          enum:
            - completed
            - in_progress
            - failed
            - cancelled
          example: completed
        error:
          description: >-
            Aurous extension: present only when `status` is `failed` or
            `cancelled` (in addition to the main error response when
            applicable). Echoes the typed error envelope shape so customers can
            branch on `error.code` without parsing string messages.
          example:
            code: chat_provider_unavailable
            type: server_error
            message: Provider request failed.
          allOf:
            - $ref: '#/components/schemas/ChatCompletionResponseError'
      required:
        - id
        - object
        - created
        - model
        - choices
        - usage
        - status
    ErrorResponse:
      type: object
      properties:
        error:
          description: Error payload
          allOf:
            - $ref: '#/components/schemas/ErrorPayload'
      required:
        - error
    ChatMessageDto:
      type: object
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
            - tool
        content:
          description: >-
            Message content. String OR an array of content parts (text +
            image_url + video_url) for multimodal input. Whitespace-only strings
            are rejected.
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/ChatContentPartDto'
        name:
          type: string
          description: Optional participant name.
        tool_call_id:
          type: string
          description: 'When role=tool: the id of the tool call this message responds to.'
      required:
        - role
        - content
    ChatToolDto:
      type: object
      properties:
        type:
          type: string
          enum:
            - function
        function:
          type: object
          description: >-
            JSON Schema-ish function descriptor. `name` and `parameters`
            required; `description` recommended.
          example:
            name: get_weather
            description: Get current weather for a city.
            parameters:
              type: object
              properties:
                city:
                  type: string
              required:
                - city
      required:
        - type
        - function
    ChatChoice:
      type: object
      properties:
        index:
          type: number
          example: 0
          description: Choice index (always 0 today; multi-choice not supported in v1.0).
        message:
          $ref: '#/components/schemas/ChatChoiceMessage'
        finish_reason:
          type: string
          enum:
            - stop
            - length
            - tool_calls
            - content_filter
          nullable: true
          description: >-
            `stop` — normal completion. `length` — hit `max_tokens`.
            `tool_calls` — model invoked tools. `content_filter` — provider
            blocked output (no charge if no content produced).
      required:
        - index
        - message
    ChatUsage:
      type: object
      properties:
        prompt_tokens:
          type: number
          description: Tokens consumed by the prompt + system message.
          example: 200
        completion_tokens:
          type: number
          description: Tokens produced in the assistant content.
          example: 600
        reasoning_tokens:
          type: number
          description: Reasoning tokens (present when reasoning_effort was passed).
          example: 50
        total_tokens:
          type: number
          description: prompt + completion + reasoning.
          example: 850
        credits_charged:
          type: number
          description: 'Aurous extension: total credits charged for this request.'
          example: 0.2856
        breakdown:
          description: 'Aurous extension: itemized breakdown.'
          allOf:
            - $ref: '#/components/schemas/ChatUsageBreakdown'
      required:
        - prompt_tokens
        - completion_tokens
        - total_tokens
        - credits_charged
        - breakdown
    ChatCompletionResponseError:
      type: object
      properties:
        code:
          type: string
          description: Typed error code. Same taxonomy as the top-level error envelope.
          example: chat_provider_unavailable
        type:
          type: string
          description: High-level error category for retry-stance decisions.
          example: server_error
        message:
          type: string
          description: Human-readable, vendor-neutral message.
          example: Provider request failed.
      required:
        - code
        - type
        - message
    ErrorPayload:
      type: object
      properties:
        type:
          type: string
          description: Broad error category
          example: invalid_request
          enum:
            - invalid_request
            - authentication
            - not_found
            - rate_limit
            - server_error
        code:
          type: string
          description: >-
            Stable error code (programmatic discriminator). Closed-beta gate
            emits one of `account_pending`, `account_rejected`,
            `account_suspended` on 403.
          example: balance_too_low
          enum:
            - invalid_request
            - missing_field
            - invalid_format
            - value_out_of_range
            - unsupported_lora_for_mode
            - generation_not_cancellable
            - prompt_blocked
            - reference_blocked
            - output_moderation_rejected
            - unknown_version
            - mutually_exclusive_input
            - character_not_ready
            - parameter_invalid_combination
            - too_many_reference_images
            - action_not_available
            - upload_invalid
            - balance_too_low
            - idempotency_key_in_use
            - api_key_not_found
            - payload_too_large
            - missing_api_key
            - invalid_api_key
            - revoked_api_key
            - resource_not_found
            - forbidden_resource
            - account_pending
            - account_rejected
            - account_suspended
            - already_approved
            - already_rejected
            - already_suspended
            - invalid_reinstate_target
            - invalid_suspend_target
            - cannot_moderate_admin
            - too_many_requests
            - concurrency_limit_exceeded
            - tpm_rate_limit_exceeded
            - internal_error
            - provider_unavailable
            - provider_timeout
            - provider_not_configured
            - invalid_time_range
            - invalid_bucket_width
            - too_many_buckets
            - too_many_group_by
            - invalid_filter
            - invalid_page_token
            - export_too_large
            - user_already_exists
            - self_invite_forbidden
            - invite_link_failed
            - invite_rate_limited
            - model_not_found
            - model_disabled
            - model_wrong_kind
            - max_tokens_exceeds_hard_cap
            - chat_model_misconfigured
            - embeddings_input_too_large
            - embeddings_unsupported_dimensions
            - pricing_frozen
            - provider_rate_limited
            - chat_provider_request_invalid
            - chat_provider_auth_failed
            - chat_provider_unavailable
            - max_input_tokens_exceeded
            - chat_provider_unknown_error
            - embeddings_provider_unknown_error
            - embeddings_batch_not_supported
            - embeddings_input_too_many_items
            - embeddings_video_unsupported
            - encoding_format_unsupported
            - missing_max_tokens_no_model_default
            - chat_cancel_target_not_found
            - chat_completion_not_found
            - chat_cancel_target_already_terminal
            - chat_cancel_target_not_cancellable
            - tool_choice_required_unsupported
            - response_format_too_large
            - response_format_too_deep
            - invalid_cursor
            - invalid_cursor_for_endpoint
            - model_slug_exists
            - output_expired
            - output_not_available
            - content_filtered
            - image_generation_failed
            - reference_media_invalid
            - reference_media_cap_reached
            - reference_fetch_failed
            - unsupported_auth_method
            - insufficient_scope
            - uploads_expired
            - provider_unknown_error
        message:
          type: string
          description: Human-readable message
          example: Team available balance is 1.5 credits, generation requires 2.0.
        param:
          type: object
          description: Field name when the error is parameter-scoped
          example: prompt
          nullable: true
        doc_url:
          type: string
          description: Documentation link for this error code
          example: https://docs.aurous-labs.com/errors#balance_too_low
        request_id:
          type: string
          description: Echoes Aurous-Request-Id — quote in support tickets
          example: req_01HXMQ7Z3K8Y2ABCDEFGHJKM
      required:
        - type
        - code
        - message
        - doc_url
        - request_id
    ChatContentPartDto:
      type: object
      properties:
        type:
          type: string
          enum:
            - text
            - image_url
            - video_url
        text:
          type: string
          description: Plain text. Required when type=text.
        image_url:
          type: object
          example:
            url: https://example.com/img.png
            detail: high
          description: >-
            Image input. Required when type=image_url. `detail`
            (`low`|`high`|`auto`) affects token cost.
        video_url:
          type: object
          example:
            url: https://example.com/video.mp4
          description: >-
            Video input. Required when type=video_url. Charged at video-token
            tier.
      required:
        - type
    ChatChoiceMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - assistant
        content:
          type: object
          nullable: true
          description: >-
            Assistant text. Null when finish_reason is content_filter with no
            content, or tool_calls only.
        tool_calls:
          description: Present when the model invoked one or more tools.
          type: array
          items:
            $ref: '#/components/schemas/ChatChoiceToolCall'
      required:
        - role
    ChatUsageBreakdown:
      type: object
      properties:
        input_credits:
          type: number
          description: Input tokens converted to credits (with markup applied).
          example: 0.0006
        output_credits:
          type: number
          description: Output (non-reasoning) tokens converted to credits.
          example: 0.27
        reasoning_credits:
          type: number
          description: >-
            Reasoning tokens converted to credits. Present only when
            `reasoning_effort` was passed AND the model emitted reasoning
            tokens.
          example: 0.015
        model:
          type: string
          description: Aurous model slug used.
          example: aurous-grow-2.0-pro
        pricing_version:
          type: number
          description: >-
            Pricing version snapshot at hold-placement time. Receipts replay
            deterministically even if the model rates change later. See `GET
            /v1/models` for the live per-model credits-per-million.
          example: 7
      required:
        - input_credits
        - output_credits
        - model
        - pricing_version
    ChatChoiceToolCall:
      type: object
      properties:
        id:
          type: string
          description: Opaque tool-call id assigned by the model.
          example: call_01HXM...
        type:
          type: string
          enum:
            - function
        function:
          $ref: '#/components/schemas/ChatChoiceFunction'
      required:
        - id
        - type
        - function
    ChatChoiceFunction:
      type: object
      properties:
        name:
          type: string
          example: get_weather
        arguments:
          type: string
          description: >-
            JSON-stringified arguments. Use JSON.parse on your end before
            invoking the tool.
          example: '{"city":"Tokyo"}'
      required:
        - name
        - arguments
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: X-Api-Key
      description: Your team API key (starts with `al_live_`).

````