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

# Create speech

> Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm) by default, or a JSON response with a 24-hour signed download URL when `output_delivery` is set to `"url"`.



## OpenAPI

````yaml /openapi/openapi.yaml post /audio/speech
openapi: 3.1.0
info:
  contact:
    email: support@openrouter.ai
    name: OpenRouter Support
    url: https://openrouter.ai/docs
  description: OpenAI-compatible API with additional OpenRouter features
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  title: OpenRouter API
  version: 1.0.0
servers:
  - description: Production server
    url: https://openrouter.ai/api/v1
    x-speakeasy-server-id: production
security:
  - apiKey: []
tags:
  - description: API key management endpoints
    name: API Keys
  - description: Analytics and usage endpoints
    name: Analytics
  - description: Anthropic Messages endpoints
    name: Anthropic Messages
  - description: BYOK endpoints
    name: BYOK
  - description: >-
      Submit, list, poll, cancel, and delete asynchronous batches of inference
      requests. See https://openrouter.ai/docs/batch-quickstart.
    name: Batch
  - description: Benchmarks endpoints
    name: Benchmarks
  - description: Chat completion endpoints
    name: Chat
  - description: Task classification market-share endpoints
    name: Classifications
  - description: Containers endpoints
    name: Containers
  - description: Credit management endpoints
    name: Credits
  - description: >-
      Public OpenRouter usage datasets. Data returned by these endpoints is
      licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/):
      reuse and republish it, including commercially, with attribution to
      OpenRouter.
    name: Datasets
  - description: Text embedding endpoints
    name: Embeddings
  - description: Endpoint information
    name: Endpoints
  - description: External Users endpoints
    name: External Users
  - description: Files endpoints
    name: Files
  - description: Generation history endpoints
    name: Generations
  - description: Guardrail Policies endpoints
    name: Guardrail Policies
  - description: Guardrails endpoints
    name: Guardrails
  - description: Images endpoints
    name: Images
  - description: Model information endpoints
    name: Models
  - description: OAuth authentication endpoints
    name: OAuth
  - description: Observability endpoints
    name: Observability
  - description: Organization endpoints
    name: Organization
  - description: Presets endpoints
    name: Presets
  - description: Private Endpoints endpoints
    name: Private Endpoints
  - description: Private Providers endpoints
    name: Private Providers
  - description: Provider information endpoints
    name: Providers
  - description: Rerank endpoints
    name: Rerank
  - description: OpenAI-compatible Responses API endpoints
    name: Responses
  - description: >-
      Management endpoints for SCIM group-to-workspace mappings, authenticated
      with a management key. These are not the SCIM 2.0 connector endpoints for
      your identity provider. In your identity provider, enter the SCIM endpoint
      URL shown when you enable provisioning under Settings > Members > SCIM
      Mappings. See
      https://openrouter.ai/docs/guides/features/scim-mappings#set-up-provisioning.
    name: SCIM
  - description: Speech-to-text endpoints
    name: STT
    x-displayName: Transcriptions
  - description: >-
      System One endpoints for models such as Jev, compatible with the TypeSafe
      SDKs. See https://openrouter.ai/docs/guides/community/typesafe-sdk.
    name: SystemOne
    x-displayName: System One
  - description: Text-to-speech endpoints
    name: TTS
    x-displayName: Speech
  - description: >-
      The catalog of server tools OpenRouter runs on behalf of a model: accepted
      `tools[].type` spellings per API format, engines and pricing, and which
      endpoints run each tool natively. See
      https://openrouter.ai/docs/guides/features/server-tools.
    name: Tools
  - description: >-
      Store host-bound secrets for a workspace or for one intern. Scope is
      selected by the API key. Responses return metadata only, never secret
      values. See https://openrouter.ai/docs/guides/ori/vault.
    name: Vault
  - description: Video Generation endpoints
    name: Video Generation
  - description: Workspaces endpoints
    name: Workspaces
  - description: Alpha feature endpoints for Decisions requests
    name: alpha.decisions
  - description: Alpha feature endpoints for Extractions requests
    name: alpha.extractions
externalDocs:
  description: OpenRouter Documentation
  url: https://openrouter.ai/docs
paths:
  /audio/speech:
    post:
      tags:
        - TTS
      summary: Create speech
      description: >-
        Synthesizes audio from the input text. Returns a raw audio bytestream in
        the requested format (e.g. mp3, pcm) by default, or a JSON response with
        a 24-hour signed download URL when `output_delivery` is set to `"url"`.
      operationId: createAudioSpeech
      requestBody:
        content:
          application/json:
            example:
              input: Hello world
              model: mistralai/voxtral-mini-tts-2603
              response_format: pcm
              speed: 1
              voice: en_paul_neutral
            schema:
              $ref: '#/components/schemas/SpeechRequest'
        required: true
      responses:
        '200':
          content:
            audio/*:
              schema:
                description: >-
                  Raw audio bytestream. Content-Type varies by requested format
                  (audio/mpeg for mp3, audio/pcm for pcm — 16-bit
                  little-endian).
                example: <binary audio data>
                format: binary
                type: string
          description: >-
            Raw audio bytes stream (`audio/*`) by default. When `stream_format`
            is `"sse"`, returns `text/event-stream` with `X-Audio-Media-Type`
            set to the effective audio media type (exposed via
            `Access-Control-Expose-Headers`) and default SSE `data:` frames (no
            named `event:` field) carrying one JSON object per event
            discriminated by `type`:
            `{"type":"speech.audio.delta","audio":"<base64>"}` (base64-encoded
            audio chunk; decode each delta separately before concatenating
            bytes),
            `{"type":"speech.timestamps.delta","words"?:[{"text","start","end"}],"characters"?:[{"text","start","end"}]}`
            (when `timestamp_granularities` is nonempty; times in float seconds
            from start of output),
            `{"type":"speech.audio.done","media_type":"<mime>","usage"?:{"input_characters"?:number}}`,
            and `{"type":"error","error":{"message":"<string>"}}` on mid-stream
            failure. When `output_delivery` is `"url"`, returns
            `application/json` with `{ url, expires_at, media_type }` (a 24-hour
            signed download URL) unless zero-data-retention or missing workspace
            causes fallback to raw audio streaming. When
            `timestamp_granularities` is nonempty and `stream_format` is
            `"audio"` (default), returns `application/json`: `{ audio,
            media_type }` with base64 audio (`SpeechTimedAudioResponse`), or `{
            url, expires_at, media_type }` with URL delivery
            (`SpeechTimedUrlResponse`), each with the requested `words` and/or
            `characters` timings. A timed `url` request that cannot get a signed
            URL (zero-data-retention, missing workspace, or storage failure)
            returns the inline `{ audio, media_type }` envelope with no `url`.
            When `separate_tracks` is true, always returns `application/json` `{
            tracks }` (`SpeechSeparatedTracksResponse`), one entry per separated
            track with base64 `audio`, or `url` and `expires_at` with URL
            delivery. A separated-tracks `url` request that cannot get signed
            URLs (zero-data-retention, missing workspace, or storage failure)
            returns inline base64 `audio` per track under the inline size cap.
        '400':
          content:
            application/json:
              example:
                error:
                  code: 400
                  message: Invalid request parameters
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
          description: Bad Request - Invalid request parameters or malformed input
        '401':
          content:
            application/json:
              example:
                error:
                  code: 401
                  message: Missing Authentication header
              schema:
                $ref: '#/components/schemas/UnauthorizedResponse'
          description: Unauthorized - Authentication required or invalid credentials
        '402':
          content:
            application/json:
              example:
                error:
                  code: 402
                  message: >-
                    Insufficient credits. Add more using
                    https://openrouter.ai/credits
              schema:
                $ref: '#/components/schemas/PaymentRequiredResponse'
          description: Payment Required - Insufficient credits or quota to complete request
        '403':
          content:
            application/json:
              example:
                error:
                  code: 403
                  message: Only management keys can perform this operation
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
          description: Forbidden - Authentication successful but insufficient permissions
        '404':
          content:
            application/json:
              example:
                error:
                  code: 404
                  message: Resource not found
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
          description: Not Found - Resource does not exist
        '413':
          content:
            application/json:
              example:
                error:
                  code: 413
                  message: Request payload too large
              schema:
                $ref: '#/components/schemas/PayloadTooLargeResponse'
          description: Payload Too Large - Request payload exceeds size limits
        '429':
          content:
            application/json:
              example:
                error:
                  code: 429
                  message: Rate limit exceeded
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
          description: Too Many Requests - Rate limit exceeded
        '500':
          content:
            application/json:
              example:
                error:
                  code: 500
                  message: Internal Server Error
              schema:
                $ref: '#/components/schemas/InternalServerResponse'
          description: Internal Server Error - Unexpected server error
        '502':
          content:
            application/json:
              example:
                error:
                  code: 502
                  message: Provider returned error
              schema:
                $ref: '#/components/schemas/BadGatewayResponse'
          description: Bad Gateway - Provider/upstream API failure
        '503':
          content:
            application/json:
              example:
                error:
                  code: 503
                  message: Service temporarily unavailable
              schema:
                $ref: '#/components/schemas/ServiceUnavailableResponse'
          description: Service Unavailable - Service temporarily unavailable
        '504':
          content:
            application/json:
              example:
                error:
                  code: 504
                  message: The operation was aborted due to timeout
              schema:
                $ref: '#/components/schemas/GatewayTimeoutResponse'
          description: >-
            Gateway Timeout - Provider did not respond before the upstream
            deadline
        '524':
          content:
            application/json:
              example:
                error:
                  code: 524
                  message: Request timed out. Please try again later.
              schema:
                $ref: '#/components/schemas/EdgeNetworkTimeoutResponse'
          description: Infrastructure Timeout - Provider request timed out at edge network
        '529':
          content:
            application/json:
              example:
                error:
                  code: 529
                  message: Provider returned error
              schema:
                $ref: '#/components/schemas/ProviderOverloadedResponse'
          description: Provider Overloaded - Provider is temporarily overloaded
components:
  schemas:
    SpeechRequest:
      description: Text-to-speech request input
      example:
        input: Hello world
        model: mistralai/voxtral-mini-tts-2603
        response_format: pcm
        speed: 1
        voice: en_paul_neutral
      properties:
        input:
          $ref: '#/components/schemas/SpeechInput'
        input_references:
          description: >-
            Reference content for stateless voice cloning or voice design. Audio
            mode: one to three `input_audio` parts, each optionally paired with
            a `text` part carrying its transcript (a single clip accepts its
            transcript before or after it; with multiple clips each transcript
            immediately follows its clip), plus at most one `image_url` part as
            a scene image on providers that condition the cloned voice on its
            setting; only routed to endpoints that support voice cloning (and
            multiple references or image references when those parts are sent).
            Image mode: exactly one `image_url` part; only routed to endpoints
            that support image references. Video mode: exactly one `video_url`
            part with a public http(s) URL, optionally with one to three
            `input_audio` parts (and their `text` transcripts) grouped as in
            audio mode, and no `image_url` part; Seed Audio 1.5 ignores those
            transcripts, so the words the voices speak go in `input`; only
            routed to endpoints that support video references (and voice cloning
            when clips are sent, plus multiple references for two or three
            clips). An empty array is treated as no reference.
          example:
            - input_audio:
                data: data:audio/wav;base64,UklGRuQXDABXQVZF...
              type: input_audio
            - text: I used to rule the world.
              type: text
          items:
            $ref: '#/components/schemas/SpeechInputReference'
          type: array
        instructions:
          description: >-
            Delivery instructions for the whole request, such as tone, pacing,
            or emotion. For the selected endpoint in the [Speech Models
            API](https://openrouter.ai/docs/guides/overview/multimodal/tts#via-the-speech-models-api),
            look for `supported_parameters.instructions` in the
            `output_modalities` entry with `type: speech`.
          example: Speak in a warm and friendly tone.
          type: string
        model:
          description: TTS model identifier
          example: mistralai/voxtral-mini-tts-2603
          type: string
        output_delivery:
          description: >-
            `stream` (default) streams the audio bytes directly in the response
            body (returns inline base64 JSON when `timestamp_granularities` is
            nonempty and `stream_format` is `"audio"`, or `text/event-stream`
            events when `stream_format` is `"sse"`). `url` stores the generated
            audio in OpenRouter storage and returns a JSON response with a
            signed download `url`, `expires_at`, and `media_type` (plus `words`
            and/or `characters` when `timestamp_granularities` is nonempty). The
            URL is a bearer link: anyone holding it can download the audio until
            it expires, up to 24 hours after the audio was stored (use
            `expires_at`); the stored copy is deleted by the storage lifecycle
            within the following day. When a URL cannot be issued
            (zero-data-retention via account settings, guardrails,
            `provider.zdr`, or a ZDR endpoint; no workspace; or storage
            failure), untimed requests fall back to streaming raw audio bytes
            (except on a storage failure for responses larger than 10 MiB, which
            returns an error), and timed requests fall back to inline base64
            JSON (`{audio, media_type, words?, characters?}`) with no `url`.
          enum:
            - stream
            - url
          example: stream
          type: string
        provider:
          description: >-
            Provider configuration: provider routing preferences (`order`,
            `only`, `ignore`, `allow_fallbacks`), data policy routing
            preferences (`zdr`, `data_collection`) and provider-specific
            passthrough options
          properties:
            allow_fallbacks:
              description: >
                Whether to allow backup providers to serve requests

                - true: (default) when the primary provider (or your custom
                providers in "order") is unavailable, use the next best
                provider.

                - false: use only the primary/custom provider, and return the
                upstream error if it's unavailable.
              type:
                - boolean
                - 'null'
            data_collection:
              description: >-
                Data collection setting. If no available model provider meets
                the requirement, your request will return an error.

                - allow: (default) allow providers which store user data
                non-transiently and may train on it


                - deny: use only providers which do not collect user data.
              enum:
                - deny
                - allow
                - null
              example: allow
              title: SpeechRequestDataCollection
              type:
                - string
                - 'null'
            ignore:
              description: >-
                List of provider slugs to ignore. If provided, this list is
                merged with your account-wide ignored provider settings for this
                request.
              example:
                - openai
                - anthropic
              items:
                anyOf:
                  - $ref: '#/components/schemas/ProviderName'
                  - type: string
              type:
                - array
                - 'null'
            only:
              description: >-
                List of provider slugs to allow. If provided, this list is
                merged with your account-wide allowed provider settings for this
                request.
              example:
                - openai
                - anthropic
              items:
                anyOf:
                  - $ref: '#/components/schemas/ProviderName'
                  - type: string
              type:
                - array
                - 'null'
            options:
              $ref: '#/components/schemas/ProviderOptions'
            order:
              description: >-
                An ordered list of provider slugs. The router will attempt to
                use the first provider in the subset of this list that supports
                your requested model, and fall back to the next if it is
                unavailable. If no providers are available, the request will
                fail with an error message.
              example:
                - openai
                - anthropic
              items:
                anyOf:
                  - $ref: '#/components/schemas/ProviderName'
                  - type: string
              type:
                - array
                - 'null'
            zdr:
              description: >-
                Whether to restrict routing to only ZDR (Zero Data Retention)
                endpoints. When true, only endpoints that do not retain prompts
                will be used.
              example: true
              type:
                - boolean
                - 'null'
          type: object
        response_format:
          description: >-
            Audio output format. Defaults to `pcm`, or to `mp3` when
            `timestamp_granularities` is nonempty.
          enum:
            - mp3
            - pcm
            - wav
          example: pcm
          type: string
        separate_tracks:
          description: >-
            Split one existing audio clip into separate tracks (speech, sound
            effects, background music) instead of generating speech. Requires
            exactly one `input_audio` part in `input_references` and no other
            parts, `voice` or `timestamp_granularities`, and `speed` omitted or
            `1`; `input` describes how to split the clip (for example "all
            speech in one track, background music in one track, all sound
            effects in one track"). The response is always JSON
            (`SpeechSeparatedTracksResponse`): `{tracks: [{type, description,
            audio, media_type}]}` with base64 audio, or `url` and `expires_at`
            per track when `output_delivery` is `url`. The audio defaults to
            `mp3` unless `response_format` is set. The whole output is buffered
            and capped at 10 MiB of decoded audio across all tracks inline, or
            32 MiB with `url` delivery. With `output_delivery: "url"`, tracks
            fall back to inline base64 `audio` (no `url`) under the 10 MiB
            inline cap when a signed URL cannot be issued (zero-data-retention,
            missing workspace, or storage failure), so the 32 MiB cap only
            applies when storage is available. Only routed to endpoints that
            price track separation (`supported_parameters.separate_tracks` on
            the speech models list). Generated SDKs type the 200 response as
            binary audio; call the HTTP endpoint directly and parse the JSON.
          example: true
          type: boolean
        session_id:
          description: >-
            A unique identifier for grouping related requests (e.g., a
            conversation or agent workflow). Used for observability grouping in
            Broadcast and private logging; never sent to the provider. If
            provided in both the request body and the x-session-id header, the
            body value takes precedence. Maximum of 256 characters.
          example: session-1234
          maxLength: 256
          type: string
        speed:
          description: >-
            Playback speed multiplier. Honored by models that support it (e.g.
            OpenAI TTS). Other providers either ignore it or return a 400 for a
            non-default value when the model has no speed control.
          example: 1
          format: double
          type: number
        stream_format:
          description: >-
            Wire framing for inline responses. `audio` (default) returns raw
            audio bytes (or a buffered JSON envelope when
            `timestamp_granularities` is nonempty). `sse` streams
            `text/event-stream` events (`speech.audio.delta`,
            `speech.timestamps.delta` when `timestamp_granularities` is
            nonempty, `speech.audio.done`, and `error` on mid-stream failure)
            with the effective audio media type in `X-Audio-Media-Type`. Cannot
            be combined with `output_delivery: "url"`. Only routed to endpoints
            that advertise `sse` in `supported_parameters.stream_format` (and
            every requested granularity when `timestamp_granularities` is
            nonempty). Generated SDKs still type the 200 response as binary
            audio for compatibility; when using `stream_format: "sse"`, call the
            HTTP endpoint directly and parse `text/event-stream`.
          enum:
            - audio
            - sse
          example: audio
          type: string
        timestamp_granularities:
          description: >-
            Timings to return with the audio. With the default `stream_format:
            "audio"`, the response is buffered JSON instead of raw audio bytes:
            `{audio, media_type, words?, characters?}` with base64 audio, or
            `{url, expires_at, media_type, words?, characters?}` when
            `output_delivery` is `url`. If a signed URL cannot be issued (ZDR,
            no workspace, or storage failure), timed `url` requests fall back to
            the inline `{audio, media_type, ...}` envelope with no `url`.
            Buffered timed responses are sent once the whole audio is generated
            and are capped at 10 MiB of decoded audio (the provider timed
            response, including its alignment data, is capped too); longer
            outputs return an error, so use a shorter input, a smaller audio
            format, or `stream_format: "sse"`. With `stream_format: "sse"`, the
            response is `text/event-stream` (`speech.audio.delta`,
            `speech.timestamps.delta`, `speech.audio.done`, and `error` on
            mid-stream failure) with the effective audio media type in
            `X-Audio-Media-Type` and no 10 MiB cap. The audio defaults to `mp3`
            unless `response_format` is set. Each timing entry is `{text, start,
            end}` in seconds. Only routed to endpoints that support every
            requested granularity for the requested `stream_format`. Generated
            SDKs still type the 200 response as binary audio for compatibility;
            call the HTTP endpoint directly and parse JSON (for `stream_format:
            "audio"`) or `text/event-stream` (for `stream_format: "sse"`). An
            empty array is treated as no timings.
          example:
            - word
          items:
            enum:
              - word
              - character
            type: string
          type: array
        trace:
          $ref: '#/components/schemas/TraceConfig'
        user:
          description: >-
            A unique identifier representing your end-user. Forwarded to
            Broadcast and private logging as the end-user id; never sent to the
            provider.
          example: user-1234
          maxLength: 256
          type: string
        voice:
          description: >-
            Voice identifier (provider-specific). Required by most providers;
            only Seed Audio, HeyGen, Fish Audio, AssemblyAI, Speechify accept
            requests without it.
          example: en_paul_neutral
          minLength: 1
          type: string
      required:
        - model
        - input
      type: object
    BadRequestResponse:
      description: Bad Request - Invalid request parameters or malformed input
      example:
        error:
          code: 400
          message: Invalid request parameters
      properties:
        error:
          $ref: '#/components/schemas/BadRequestResponseErrorData'
        openrouter_metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      required:
        - error
      type: object
    UnauthorizedResponse:
      description: Unauthorized - Authentication required or invalid credentials
      example:
        error:
          code: 401
          message: Missing Authentication header
      properties:
        error:
          $ref: '#/components/schemas/UnauthorizedResponseErrorData'
        openrouter_metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      required:
        - error
      type: object
    PaymentRequiredResponse:
      description: Payment Required - Insufficient credits or quota to complete request
      example:
        error:
          code: 402
          message: Insufficient credits. Add more using https://openrouter.ai/credits
      properties:
        error:
          $ref: '#/components/schemas/PaymentRequiredResponseErrorData'
        openrouter_metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      required:
        - error
      type: object
    ForbiddenResponse:
      description: Forbidden - Authentication successful but insufficient permissions
      example:
        error:
          code: 403
          message: Only management keys can perform this operation
      properties:
        error:
          $ref: '#/components/schemas/ForbiddenResponseErrorData'
        openrouter_metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      required:
        - error
      type: object
    NotFoundResponse:
      description: Not Found - Resource does not exist
      example:
        error:
          code: 404
          message: Resource not found
      properties:
        error:
          $ref: '#/components/schemas/NotFoundResponseErrorData'
        openrouter_metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      required:
        - error
      type: object
    PayloadTooLargeResponse:
      description: Payload Too Large - Request payload exceeds size limits
      example:
        error:
          code: 413
          message: Request payload too large
      properties:
        error:
          $ref: '#/components/schemas/PayloadTooLargeResponseErrorData'
        openrouter_metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      required:
        - error
      type: object
    TooManyRequestsResponse:
      description: Too Many Requests - Rate limit exceeded
      example:
        error:
          code: 429
          message: Rate limit exceeded
      properties:
        error:
          $ref: '#/components/schemas/TooManyRequestsResponseErrorData'
        openrouter_metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      required:
        - error
      type: object
    InternalServerResponse:
      description: Internal Server Error - Unexpected server error
      example:
        error:
          code: 500
          message: Internal Server Error
      properties:
        error:
          $ref: '#/components/schemas/InternalServerResponseErrorData'
        openrouter_metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      required:
        - error
      type: object
    BadGatewayResponse:
      description: Bad Gateway - Provider/upstream API failure
      example:
        error:
          code: 502
          message: Provider returned error
      properties:
        error:
          $ref: '#/components/schemas/BadGatewayResponseErrorData'
        openrouter_metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      required:
        - error
      type: object
    ServiceUnavailableResponse:
      description: Service Unavailable - Service temporarily unavailable
      example:
        error:
          code: 503
          message: Service temporarily unavailable
      properties:
        error:
          $ref: '#/components/schemas/ServiceUnavailableResponseErrorData'
        openrouter_metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      required:
        - error
      type: object
    GatewayTimeoutResponse:
      description: Gateway Timeout - Provider did not respond before the upstream deadline
      example:
        error:
          code: 504
          message: The operation was aborted due to timeout
      properties:
        error:
          $ref: '#/components/schemas/GatewayTimeoutResponseErrorData'
        openrouter_metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      required:
        - error
      type: object
    EdgeNetworkTimeoutResponse:
      description: Infrastructure Timeout - Provider request timed out at edge network
      example:
        error:
          code: 524
          message: Request timed out. Please try again later.
      properties:
        error:
          $ref: '#/components/schemas/EdgeNetworkTimeoutResponseErrorData'
        openrouter_metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      required:
        - error
      type: object
    ProviderOverloadedResponse:
      description: Provider Overloaded - Provider is temporarily overloaded
      example:
        error:
          code: 529
          message: Provider returned error
      properties:
        error:
          $ref: '#/components/schemas/ProviderOverloadedResponseErrorData'
        openrouter_metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      required:
        - error
      type: object
    SpeechInput:
      anyOf:
        - type: string
        - items:
            $ref: '#/components/schemas/SpeechTurn'
          minItems: 1
          type: array
      description: >-
        Text to synthesize, or a list of turns for multi-speaker input. Each
        turn has its own text, voice, and instructions. Multi-speaker input is
        supported by Gemini TTS models, by Fish Audio models other than S1, and
        by Speechify dialogue models.
      example: Hello world
    SpeechInputReference:
      description: Reference content part for stateless voice cloning or voice design
      discriminator:
        mapping:
          image_url: '#/components/schemas/SpeechInputReferenceImage'
          input_audio: '#/components/schemas/SpeechInputReferenceAudio'
          text: '#/components/schemas/SpeechInputReferenceText'
          video_url: '#/components/schemas/SpeechInputReferenceVideo'
        propertyName: type
      example:
        input_audio:
          data: data:audio/wav;base64,UklGRuQXDABXQVZF...
        type: input_audio
      oneOf:
        - $ref: '#/components/schemas/SpeechInputReferenceAudio'
        - $ref: '#/components/schemas/SpeechInputReferenceText'
        - $ref: '#/components/schemas/SpeechInputReferenceImage'
        - $ref: '#/components/schemas/SpeechInputReferenceVideo'
    ProviderName:
      enum:
        - Modal
        - AkashML
        - AI21
        - AionLabs
        - Alibaba
        - Ambient
        - Ant Digital
        - Baidu
        - Amazon Bedrock
        - Amazon Nova
        - Anthropic
        - Arcee AI
        - AssemblyAI
        - AtlasCloud
        - Avian
        - Azure
        - BaseTen
        - BytePlus
        - Black Forest Labs
        - Celeris
        - Cerebras
        - Chutes
        - Cirrascale
        - Claude Platform on AWS
        - Clarifai
        - Cloudflare
        - Cohere
        - CoreWeave
        - Cosine
        - Crucible
        - Crusoe
        - Darkbloom
        - Databricks
        - Decart
        - Deepgram
        - DeepInfra
        - DeepSeek
        - DekaLLM
        - DigitalOcean
        - Doubleword
        - ElevenLabs
        - Featherless
        - Fireworks
        - Fish Audio
        - Friendli
        - GMICloud
        - Google
        - Google AI Studio
        - Groq
        - HeyGen
        - Inception
        - Inceptron
        - InferenceNet
        - Ionstream
        - Infermatic
        - Io Net
        - Inferact vLLM
        - Inflection
        - KT
        - LangChain
        - Liquid
        - Makora
        - Mara
        - Mancer 2
        - Meta
        - Minimax
        - ModelRun
        - Mistral
        - Modular
        - Moonshot AI
        - Morph
        - VoyageAI by MongoDB
        - TypeSafe
        - Near AI
        - Nebius
        - Nex AGI
        - NextBit
        - Novita
        - Nvidia
        - Ollama
        - OpenAI
        - OpenInference
        - Parallel
        - Parasail
        - ParetoAlpha
        - Pareto Inference
        - Particle AI
        - Pearl Research
        - Poolside
        - PrimaLabs
        - PrimeIntellect
        - Perceptron
        - Perplexity
        - Phala
        - Recraft
        - Recursive
        - Reka
        - Relace
        - Respan
        - River
        - Sail Research
        - Sakana AI
        - SambaNova
        - ScaleDown
        - Seed
        - SiliconFlow
        - Sourceful
        - Speechify
        - StepFun
        - Stealth
        - StreamLake
        - Switchpoint
        - Tencent
        - Tenstorrent
        - Thinking Machines
        - Together
        - Unbiased
        - Upstage
        - Venice
        - Wafer
        - WandB
        - Quiver
        - Krea
        - Runway
        - Xiaomi
        - xAI
        - Z.AI
        - FakeProvider
      example: OpenAI
      type: string
    ProviderOptions:
      description: >-
        Provider-specific options keyed by provider slug. The provider segment
        is case-insensitive; an endpoint tag after `/` must match the endpoint
        slug exactly. Only options for the matched provider are forwarded; the
        rest are ignored. Unrecognized keys are silently dropped.
      example:
        openai:
          max_tokens: 1000
      properties:
        01ai:
          additionalProperties: {}
          type: object
        ai21:
          additionalProperties: {}
          type: object
        aion-labs:
          additionalProperties: {}
          type: object
        akashml:
          additionalProperties: {}
          type: object
        alibaba:
          additionalProperties: {}
          type: object
        amazon-bedrock:
          additionalProperties: {}
          type: object
        amazon-bedrock/claude-on-aws:
          additionalProperties: {}
          type: object
        amazon-nova:
          additionalProperties: {}
          type: object
        ambient:
          additionalProperties: {}
          type: object
        antdigital:
          additionalProperties: {}
          type: object
        anthropic:
          additionalProperties: {}
          type: object
        anthropic/2:
          additionalProperties: {}
          type: object
        anyscale:
          additionalProperties: {}
          type: object
        arcee-ai:
          additionalProperties: {}
          type: object
        assemblyai:
          additionalProperties: {}
          type: object
        atlas-cloud:
          additionalProperties: {}
          type: object
        atoma:
          additionalProperties: {}
          type: object
        avian:
          additionalProperties: {}
          type: object
        azure:
          additionalProperties: {}
          type: object
        baidu:
          additionalProperties: {}
          type: object
        baseten:
          additionalProperties: {}
          type: object
        black-forest-labs:
          additionalProperties: {}
          type: object
        byteplus:
          additionalProperties: {}
          type: object
        celeris:
          additionalProperties: {}
          type: object
        centml:
          additionalProperties: {}
          type: object
        cerebras:
          additionalProperties: {}
          type: object
        chutes:
          additionalProperties: {}
          type: object
        cirrascale:
          additionalProperties: {}
          type: object
        clarifai:
          additionalProperties: {}
          type: object
        claude-on-aws:
          additionalProperties: {}
          type: object
        cloudflare:
          additionalProperties: {}
          type: object
        cohere:
          additionalProperties: {}
          type: object
        coreweave:
          additionalProperties: {}
          type: object
        cosine:
          additionalProperties: {}
          type: object
        crofai:
          additionalProperties: {}
          type: object
        crucible:
          additionalProperties: {}
          type: object
        crusoe:
          additionalProperties: {}
          type: object
        darkbloom:
          additionalProperties: {}
          type: object
        databricks:
          additionalProperties: {}
          type: object
        decart:
          additionalProperties: {}
          type: object
        deepgram:
          additionalProperties: {}
          type: object
        deepinfra:
          additionalProperties: {}
          type: object
        deepseek:
          additionalProperties: {}
          type: object
        dekallm:
          additionalProperties: {}
          type: object
        digitalocean:
          additionalProperties: {}
          type: object
        doubleword:
          additionalProperties: {}
          type: object
        elevenlabs:
          additionalProperties: {}
          type: object
        enfer:
          additionalProperties: {}
          type: object
        fake-provider:
          additionalProperties: {}
          type: object
        featherless:
          additionalProperties: {}
          type: object
        fireworks:
          additionalProperties: {}
          type: object
        fish-audio:
          additionalProperties: {}
          type: object
        friendli:
          additionalProperties: {}
          type: object
        gmicloud:
          additionalProperties: {}
          type: object
        google-ai-studio:
          additionalProperties: {}
          type: object
        google-vertex:
          additionalProperties: {}
          type: object
        gopomelo:
          additionalProperties: {}
          type: object
        groq:
          additionalProperties: {}
          type: object
        heygen:
          additionalProperties: {}
          type: object
        huggingface:
          additionalProperties: {}
          type: object
        hyperbolic:
          additionalProperties: {}
          type: object
        hyperbolic-quantized:
          additionalProperties: {}
          type: object
        inception:
          additionalProperties: {}
          type: object
        inceptron:
          additionalProperties: {}
          type: object
        inferact-vllm:
          additionalProperties: {}
          type: object
        inference-net:
          additionalProperties: {}
          type: object
        infermatic:
          additionalProperties: {}
          type: object
        inflection:
          additionalProperties: {}
          type: object
        inocloud:
          additionalProperties: {}
          type: object
        io-net:
          additionalProperties: {}
          type: object
        ionstream:
          additionalProperties: {}
          type: object
        klusterai:
          additionalProperties: {}
          type: object
        krea:
          additionalProperties: {}
          type: object
        kt:
          additionalProperties: {}
          type: object
        lambda:
          additionalProperties: {}
          type: object
        langchain:
          additionalProperties: {}
          type: object
        lepton:
          additionalProperties: {}
          type: object
        liquid:
          additionalProperties: {}
          type: object
        lynn:
          additionalProperties: {}
          type: object
        lynn-private:
          additionalProperties: {}
          type: object
        makora:
          additionalProperties: {}
          type: object
        mancer:
          additionalProperties: {}
          type: object
        mancer-old:
          additionalProperties: {}
          type: object
        mara:
          additionalProperties: {}
          type: object
        meta:
          additionalProperties: {}
          type: object
        minimax:
          additionalProperties: {}
          type: object
        mistral:
          additionalProperties: {}
          type: object
        modal:
          additionalProperties: {}
          type: object
        modelrun:
          additionalProperties: {}
          type: object
        modular:
          additionalProperties: {}
          type: object
        moonshotai:
          additionalProperties: {}
          type: object
        morph:
          additionalProperties: {}
          type: object
        ncompass:
          additionalProperties: {}
          type: object
        near-ai:
          additionalProperties: {}
          type: object
        nebius:
          additionalProperties: {}
          type: object
        nex-agi:
          additionalProperties: {}
          type: object
        nextbit:
          additionalProperties: {}
          type: object
        nineteen:
          additionalProperties: {}
          type: object
        novita:
          additionalProperties: {}
          type: object
        nvidia:
          additionalProperties: {}
          type: object
        octoai:
          additionalProperties: {}
          type: object
        ollama:
          additionalProperties: {}
          type: object
        open-inference:
          additionalProperties: {}
          type: object
        openai:
          additionalProperties: {}
          type: object
        parallel:
          additionalProperties: {}
          type: object
        parasail:
          additionalProperties: {}
          type: object
        pareto-alpha:
          additionalProperties: {}
          type: object
        pareto-inference:
          additionalProperties: {}
          type: object
        particle-ai:
          additionalProperties: {}
          type: object
        pearl-research:
          additionalProperties: {}
          type: object
        perceptron:
          additionalProperties: {}
          type: object
        perplexity:
          additionalProperties: {}
          type: object
        phala:
          additionalProperties: {}
          type: object
        poolside:
          additionalProperties: {}
          type: object
        primalabs:
          additionalProperties: {}
          type: object
        primeintellect:
          additionalProperties: {}
          type: object
        quiver:
          additionalProperties: {}
          type: object
        recraft:
          additionalProperties: {}
          type: object
        recursal:
          additionalProperties: {}
          type: object
        recursive:
          additionalProperties: {}
          type: object
        reflection:
          additionalProperties: {}
          type: object
        reka:
          additionalProperties: {}
          type: object
        relace:
          additionalProperties: {}
          type: object
        replicate:
          additionalProperties: {}
          type: object
        respan:
          additionalProperties: {}
          type: object
        river:
          additionalProperties: {}
          type: object
        runway:
          additionalProperties: {}
          type: object
        sail-research:
          additionalProperties: {}
          type: object
        sakana:
          additionalProperties: {}
          type: object
        sakana-ai:
          additionalProperties: {}
          type: object
        sambanova:
          additionalProperties: {}
          type: object
        sambanova-cloaked:
          additionalProperties: {}
          type: object
        scaledown:
          additionalProperties: {}
          type: object
        seed:
          additionalProperties: {}
          type: object
        sf-compute:
          additionalProperties: {}
          type: object
        siliconflow:
          additionalProperties: {}
          type: object
        sourceful:
          additionalProperties: {}
          type: object
        speechify:
          additionalProperties: {}
          type: object
        stealth:
          additionalProperties: {}
          type: object
        stepfun:
          additionalProperties: {}
          type: object
        streamlake:
          additionalProperties: {}
          type: object
        switchpoint:
          additionalProperties: {}
          type: object
        targon:
          additionalProperties: {}
          type: object
        tencent:
          additionalProperties: {}
          type: object
        tenstorrent:
          additionalProperties: {}
          type: object
        thinkingmachines:
          additionalProperties: {}
          type: object
        together:
          additionalProperties: {}
          type: object
        together-lite:
          additionalProperties: {}
          type: object
        typesafe:
          additionalProperties: {}
          type: object
        ubicloud:
          additionalProperties: {}
          type: object
        unbiased:
          additionalProperties: {}
          type: object
        upstage:
          additionalProperties: {}
          type: object
        venice:
          additionalProperties: {}
          type: object
        voyageai:
          additionalProperties: {}
          type: object
        wafer:
          additionalProperties: {}
          type: object
        wandb:
          additionalProperties: {}
          type: object
        wandb-legacy:
          additionalProperties: {}
          type: object
        xai:
          additionalProperties: {}
          type: object
        xiaomi:
          additionalProperties: {}
          type: object
        z-ai:
          additionalProperties: {}
          type: object
      type: object
    TraceConfig:
      additionalProperties: {}
      description: >-
        Metadata for observability and tracing. Known keys (trace_id,
        trace_name, span_name, generation_name, parent_span_id) have special
        handling. Additional keys are passed through as custom metadata to
        configured broadcast destinations.
      example:
        trace_id: trace-abc123
        trace_name: my-app-trace
      properties:
        generation_name:
          type: string
        parent_span_id:
          type: string
        span_name:
          type: string
        trace_id:
          type: string
        trace_name:
          type: string
      type: object
    BadRequestResponseErrorData:
      description: Error data for BadRequestResponse
      example:
        code: 400
        message: Invalid request parameters
      properties:
        code:
          type: integer
        message:
          type: string
        metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
      required:
        - code
        - message
      type: object
    UnauthorizedResponseErrorData:
      description: Error data for UnauthorizedResponse
      example:
        code: 401
        message: Missing Authentication header
      properties:
        code:
          type: integer
        message:
          type: string
        metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
      required:
        - code
        - message
      type: object
    PaymentRequiredResponseErrorData:
      description: Error data for PaymentRequiredResponse
      example:
        code: 402
        message: Insufficient credits. Add more using https://openrouter.ai/credits
      properties:
        code:
          type: integer
        message:
          type: string
        metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
      required:
        - code
        - message
      type: object
    ForbiddenResponseErrorData:
      description: Error data for ForbiddenResponse
      example:
        code: 403
        message: Only management keys can perform this operation
      properties:
        code:
          type: integer
        message:
          type: string
        metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
      required:
        - code
        - message
      type: object
    NotFoundResponseErrorData:
      description: Error data for NotFoundResponse
      example:
        code: 404
        message: Resource not found
      properties:
        code:
          type: integer
        message:
          type: string
        metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
      required:
        - code
        - message
      type: object
    PayloadTooLargeResponseErrorData:
      description: Error data for PayloadTooLargeResponse
      example:
        code: 413
        message: Request payload too large
      properties:
        code:
          type: integer
        message:
          type: string
        metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
      required:
        - code
        - message
      type: object
    TooManyRequestsResponseErrorData:
      description: Error data for TooManyRequestsResponse
      example:
        code: 429
        message: Rate limit exceeded
      properties:
        code:
          type: integer
        message:
          type: string
        metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
      required:
        - code
        - message
      type: object
    InternalServerResponseErrorData:
      description: Error data for InternalServerResponse
      example:
        code: 500
        message: Internal Server Error
      properties:
        code:
          type: integer
        message:
          type: string
        metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
      required:
        - code
        - message
      type: object
    BadGatewayResponseErrorData:
      description: Error data for BadGatewayResponse
      example:
        code: 502
        message: Provider returned error
      properties:
        code:
          type: integer
        message:
          type: string
        metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
      required:
        - code
        - message
      type: object
    ServiceUnavailableResponseErrorData:
      description: Error data for ServiceUnavailableResponse
      example:
        code: 503
        message: Service temporarily unavailable
      properties:
        code:
          type: integer
        message:
          type: string
        metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
      required:
        - code
        - message
      type: object
    GatewayTimeoutResponseErrorData:
      description: Error data for GatewayTimeoutResponse
      example:
        code: 504
        message: The operation was aborted due to timeout
      properties:
        code:
          type: integer
        message:
          type: string
        metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
      required:
        - code
        - message
      type: object
    EdgeNetworkTimeoutResponseErrorData:
      description: Error data for EdgeNetworkTimeoutResponse
      example:
        code: 524
        message: Request timed out. Please try again later.
      properties:
        code:
          type: integer
        message:
          type: string
        metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
      required:
        - code
        - message
      type: object
    ProviderOverloadedResponseErrorData:
      description: Error data for ProviderOverloadedResponse
      example:
        code: 529
        message: Provider returned error
      properties:
        code:
          type: integer
        message:
          type: string
        metadata:
          additionalProperties: {}
          type:
            - object
            - 'null'
      required:
        - code
        - message
      type: object
    SpeechTurn:
      properties:
        instructions:
          description: >-
            Delivery instructions for this turn, such as tone, pacing, or
            emotion. Overrides the top-level `instructions`.
          example: whispering
          type: string
        text:
          description: Text to synthesize
          example: Hi Jane.
          type: string
        voice:
          description: Voice for this turn. Defaults to the top-level `voice`.
          example: Kore
          minLength: 1
          type: string
      required:
        - text
      type: object
    SpeechInputReferenceImage:
      description: >-
        Reference image. On its own it describes the desired voice (voice
        design); alongside an `input_audio` part it is a scene image describing
        the setting the cloned voice speaks in. At most one per request. Only
        routed to endpoints that support image references.
      example:
        image_url:
          url: data:image/png;base64,iVBORw0KGgo...
        type: image_url
      properties:
        image_url:
          $ref: '#/components/schemas/SpeechInputReferenceImageInput'
        type:
          enum:
            - image_url
          type: string
      required:
        - type
        - image_url
      type: object
    SpeechInputReferenceAudio:
      description: >-
        Reference audio input for stateless voice cloning. Up to three parts per
        request; the Nth audio part is addressable from `input` as `@AudioN` on
        providers that support multiple references.
      example:
        input_audio:
          data: data:audio/wav;base64,UklGRuQXDABXQVZF...
        type: input_audio
      properties:
        input_audio:
          $ref: '#/components/schemas/SpeechInputReferenceAudioInput'
        type:
          enum:
            - input_audio
          type: string
      required:
        - type
        - input_audio
      type: object
    SpeechInputReferenceText:
      description: Transcript of an `input_audio` part
      example:
        text: I used to rule the world.
        type: text
      properties:
        text:
          description: >-
            Transcript of an `input_audio` part. With a single clip it may
            appear before or after the clip; with multiple clips it must
            immediately follow the clip it transcribes.
          example: I used to rule the world.
          maxLength: 10000
          type: string
        type:
          enum:
            - text
          type: string
      required:
        - type
        - text
      type: object
    SpeechInputReferenceVideo:
      description: >-
        Reference video the generated audio is made for (sound and voice matched
        to the footage, same length as the clip). At most one per request; it
        may come with one to three `input_audio` parts (voices for the footage,
        with `input` giving the words they speak) but never with an `image_url`
        part. Only routed to endpoints that support video references, which bill
        at their video rate.
      example:
        type: video_url
        video_url:
          url: https://example.com/clip.mp4
      properties:
        type:
          enum:
            - video_url
          type: string
        video_url:
          $ref: '#/components/schemas/SpeechInputReferenceVideoInput'
      required:
        - type
        - video_url
      type: object
    SpeechInputReferenceImageInput:
      description: Reference image input object
      example:
        url: data:image/png;base64,iVBORw0KGgo...
      properties:
        url:
          description: >-
            JPEG, PNG, or WebP reference image as a base64 data URI or a public
            http(s) URL. Remote images are downloaded (15 MiB max) and forwarded
            as bytes, never as the URL.
          example: data:image/png;base64,iVBORw0KGgo...
          maxLength: 20971520
          minLength: 1
          type: string
      required:
        - url
      type: object
    SpeechInputReferenceAudioInput:
      description: Reference audio input object
      example:
        data: data:audio/wav;base64,UklGRuQXDABXQVZF...
      properties:
        data:
          description: >-
            Base64-encoded reference audio (optionally a data URI). Supported
            audio formats are provider-specific. Limited to 20 MiB of base64 (15
            MiB of decoded audio). Exactly one of `data` or `url` is required.
          example: data:audio/wav;base64,UklGRuQXDABXQVZF...
          maxLength: 20971520
          minLength: 1
          type: string
        format:
          description: >-
            Audio format of the reference audio (e.g., wav, mp3). Optional; most
            providers detect the format from the audio bytes.
          example: wav
          type: string
        url:
          description: >-
            Public http(s) URL of the reference audio. OpenRouter downloads it
            (15 MiB max) and forwards the bytes, never the URL. Exactly one of
            `data` or `url` is required.
          example: https://example.com/reference.wav
          format: uri
          maxLength: 2048
          type: string
      type: object
    SpeechInputReferenceVideoInput:
      description: Reference video input object
      example:
        url: https://example.com/clip.mp4
      properties:
        url:
          description: >-
            Public http(s) URL of the reference video. The provider downloads
            it; OpenRouter does not fetch it, and data URIs are rejected.
          example: https://example.com/clip.mp4
          maxLength: 2048
          minLength: 1
          type: string
      required:
        - url
      type: object
  securitySchemes:
    apiKey:
      description: API key as bearer token in Authorization header
      scheme: bearer
      type: http

````