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

# Create speech (OpenAI compatible)

> The request shape of the OpenAI speech API (`POST /v1/audio/speech`), so an OpenAI SDK, or a framework built on one, works with the base URL `https://tts.us.assemblyai.com/v1/openai` (or the EU host) and your AssemblyAI API key as its API key. It shares its behaviour with [Create speech](/tts/api-reference/http-api/create-speech): the status waits for the first audio, the audio streams as it is synthesized, a failure after that point cuts the connection, and the same limits and billing apply.

**Fields.** `model` and `input` are required. `model` takes a language's model name such as `assemblyai-tts-en`, or a model's name such as `assemblyai-tts-1` (the `assemblyai/` prefix is accepted); a name that is not an AssemblyAI model name, OpenAI's model names such as `tts-1` included, is refused with `400`, code `model_not_found`, and so is a model name the region does not serve. `voice` takes the library slug of an AssemblyAI voice, such as `aai-jane`, a voice's UUID, or an OpenAI voice name, each mapped to an AssemblyAI voice: `alloy` to `aai-jane`, `ash` to `aai-michael`, `ballad` to `aai-charles`, `cedar` to `aai-george`, `coral` to `aai-anna`, `echo` to `aai-paul`, `fable` to `aai-charles`, `marin` to `aai-mary`, `nova` to `aai-eve`, `onyx` to `aai-george`, `sage` to `aai-vera`, `shimmer` to `aai-alba` and `verse` to `aai-michael`; in a language other than English, an OpenAI voice name speaks with the language's default voice, `aai-jane`. A bare AssemblyAI voice name such as `jane` is refused with `422` on `voice`, and the message names its slug. A [cloned voice](/tts/openai-compatibility#cloned-voices) goes in `voice` as `{"id": "<voice ID or slug>"}` or as a string holding its UUID. `response_format` is `mp3` (default, 24 kHz at 64 kbps), `pcm`, `wav`, `mulaw` or `alaw`; `opus`, `aac` and `flac` are refused. `stream_format: "sse"` streams the audio as OpenAI speech events instead of raw bytes. Fields this route does not use, such as `instructions` and `user`, are ignored and listed in `X-TTS-Unknown-Params`.

**Extensions.** `language` (a language name such as `english`, or an ISO 639-1 code such as `en`), `sample_rate`, `voice_id` (a cloned voice's ID or slug, with `voice` left out) and `extend_biometric_consent` (renews a cloned voice's consent; see [Renew consent](/tts/cloned-voices#renew-consent)) may be added to the body; most OpenAI clients pass them through an extra-body option. A `language` that contradicts `model` is refused. The language is the one you set, else the one the model name implies (`assemblyai-tts-es` asks for Spanish), else a cloned voice's own language, else English. A request in a language no model of the region speaks is refused with `400`, code `invalid_request`; see [Languages](/tts/voices#languages).

**SSE.** With `stream_format: "sse"` the body is `text/event-stream` of `data:` lines only: `{"type":"speech.audio.delta","audio":"<base64>"}` for each piece of audio, the next bytes of the requested format, then one `{"type":"speech.audio.done","usage":{...}}`. There is no `[DONE]` line. While nothing is sent for 15 seconds, a comment line `: keepalive` arrives; ignore lines that start with `:`. A failure after the first audio sends `{"type":"error","error":{...}}` and then cuts the connection.

**Errors** use the OpenAI body (`OpenAIErrorResponse`), with the same `code` the native routes use and an OpenAI `type`. Text with nothing to speak is refused with `400`, code `invalid_request` (`input produced no speech`), and is not billed.



## OpenAPI

````yaml api-reference/specs/streaming-tts-speech.yaml POST /v1/openai/audio/speech
openapi: 3.0.3
info:
  title: AssemblyAI Streaming TTS HTTP API
  description: >-
    HTTP API of Streaming Text-to-Speech: send a text in one `POST` and read the
    speech back as the response body. The audio streams while it is synthesized,
    so the first bytes arrive long before the last; with `"stream": false` the
    whole clip arrives at once. `POST /v1/speech/events` streams the audio as
    server-sent events with word timings, and `POST /v1/openai/audio/speech`
    takes the request shape of the OpenAI speech API, so OpenAI SDKs and the
    frameworks built on them work by changing their base URL. See the
    [Quickstart](/tts/getting-started/quickstart) for a first request and
    [OpenAI compatibility](/tts/openai-compatibility) for the OpenAI-compatible
    route.


    Voices, models, audio formats and text handling are those of the [Streaming
    TTS WebSocket API](/tts/connect-parameters). Every error the native routes
    answer has the JSON body described under `ErrorResponse`, and every error of
    the OpenAI-compatible routes the body described under `OpenAIErrorResponse`;
    see [HTTP API basics](/tts/api-reference/http-api/overview).
  version: 1.0.0
  termsOfService: https://www.assemblyai.com/legal/terms-of-service
  contact:
    name: API Support
    email: support@assemblyai.com
    url: https://www.assemblyai.com/docs/
servers:
  - url: https://tts.us.assemblyai.com
    description: US data zone
    x-fern-server-name: US
  - url: https://tts.eu.assemblyai.com
    description: EU data zone
    x-fern-server-name: EU
security:
  - apiKey: []
tags:
  - name: Speech
    description: Text to speech in one request.
  - name: OpenAI compatibility
    description: The route and the models documents for OpenAI-shaped clients.
paths:
  /v1/openai/audio/speech:
    post:
      tags:
        - OpenAI compatibility
      summary: Create speech (OpenAI compatible)
      description: >-
        The request shape of the OpenAI speech API (`POST /v1/audio/speech`), so
        an OpenAI SDK, or a framework built on one, works with the base URL
        `https://tts.us.assemblyai.com/v1/openai` (or the EU host) and your
        AssemblyAI API key as its API key. It shares its behaviour with [Create
        speech](/tts/api-reference/http-api/create-speech): the status waits for
        the first audio, the audio streams as it is synthesized, a failure after
        that point cuts the connection, and the same limits and billing apply.


        **Fields.** `model` and `input` are required. `model` takes a language's
        model name such as `assemblyai-tts-en`, or a model's name such as
        `assemblyai-tts-1` (the `assemblyai/` prefix is accepted); a name that
        is not an AssemblyAI model name, OpenAI's model names such as `tts-1`
        included, is refused with `400`, code `model_not_found`, and so is a
        model name the region does not serve. `voice` takes the library slug of
        an AssemblyAI voice, such as `aai-jane`, a voice's UUID, or an OpenAI
        voice name, each mapped to an AssemblyAI voice: `alloy` to `aai-jane`,
        `ash` to `aai-michael`, `ballad` to `aai-charles`, `cedar` to
        `aai-george`, `coral` to `aai-anna`, `echo` to `aai-paul`, `fable` to
        `aai-charles`, `marin` to `aai-mary`, `nova` to `aai-eve`, `onyx` to
        `aai-george`, `sage` to `aai-vera`, `shimmer` to `aai-alba` and `verse`
        to `aai-michael`; in a language other than English, an OpenAI voice name
        speaks with the language's default voice, `aai-jane`. A bare AssemblyAI
        voice name such as `jane` is refused with `422` on `voice`, and the
        message names its slug. A [cloned
        voice](/tts/openai-compatibility#cloned-voices) goes in `voice` as
        `{"id": "<voice ID or slug>"}` or as a string holding its UUID.
        `response_format` is `mp3` (default, 24 kHz at 64 kbps), `pcm`, `wav`,
        `mulaw` or `alaw`; `opus`, `aac` and `flac` are refused. `stream_format:
        "sse"` streams the audio as OpenAI speech events instead of raw bytes.
        Fields this route does not use, such as `instructions` and `user`, are
        ignored and listed in `X-TTS-Unknown-Params`.


        **Extensions.** `language` (a language name such as `english`, or an ISO
        639-1 code such as `en`), `sample_rate`, `voice_id` (a cloned voice's ID
        or slug, with `voice` left out) and `extend_biometric_consent` (renews a
        cloned voice's consent; see [Renew
        consent](/tts/cloned-voices#renew-consent)) may be added to the body;
        most OpenAI clients pass them through an extra-body option. A `language`
        that contradicts `model` is refused. The language is the one you set,
        else the one the model name implies (`assemblyai-tts-es` asks for
        Spanish), else a cloned voice's own language, else English. A request in
        a language no model of the region speaks is refused with `400`, code
        `invalid_request`; see [Languages](/tts/voices#languages).


        **SSE.** With `stream_format: "sse"` the body is `text/event-stream` of
        `data:` lines only: `{"type":"speech.audio.delta","audio":"<base64>"}`
        for each piece of audio, the next bytes of the requested format, then
        one `{"type":"speech.audio.done","usage":{...}}`. There is no `[DONE]`
        line. While nothing is sent for 15 seconds, a comment line `: keepalive`
        arrives; ignore lines that start with `:`. A failure after the first
        audio sends `{"type":"error","error":{...}}` and then cuts the
        connection.


        **Errors** use the OpenAI body (`OpenAIErrorResponse`), with the same
        `code` the native routes use and an OpenAI `type`. Text with nothing to
        speak is refused with `400`, code `invalid_request` (`input produced no
        speech`), and is not billed.
      operationId: CreateSpeechOpenAI
      parameters:
        - $ref: '#/components/parameters/ClientRequestIdStrict'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenAISpeechRequest'
            examples:
              pcm:
                summary: Raw PCM for a voice agent
                value:
                  model: assemblyai-tts-en
                  input: Hi! Thanks for calling.
                  voice: alloy
                  response_format: pcm
              assemblyai_voice:
                summary: An AssemblyAI library voice by its ID
                value:
                  model: assemblyai-tts-en
                  input: Thanks for calling.
                  voice: 49c443a4-8a1d-5f7e-b70b-98bdbd9823c3
              cloned_voice:
                summary: A cloned voice by its ID
                value:
                  model: assemblyai-tts-en
                  input: Thanks for calling.
                  voice:
                    id: 01a139bf-78a0-7d18-9a4e-6c0f2b8d1e37
                  response_format: pcm
              sse:
                summary: Speech events
                value:
                  model: assemblyai-tts-en
                  input: Hello from AssemblyAI.
                  response_format: pcm
                  stream_format: sse
      responses:
        '200':
          description: The audio, or speech events with `stream_format` `sse`.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-Generation-Id:
              $ref: '#/components/headers/X-Generation-Id'
            X-Client-Request-Id:
              $ref: '#/components/headers/X-Client-Request-Id'
            X-TTS-Region:
              $ref: '#/components/headers/X-TTS-Region'
            X-TTS-Model:
              $ref: '#/components/headers/X-TTS-Model'
            X-TTS-Voice-Id:
              $ref: '#/components/headers/X-TTS-Voice-Id'
            X-TTS-Voice-Expires-At:
              $ref: '#/components/headers/X-TTS-Voice-Expires-At-OpenAI'
            X-TTS-Voice-Alias:
              $ref: '#/components/headers/X-TTS-Voice-Alias'
            X-TTS-Language:
              $ref: '#/components/headers/X-TTS-Language'
            X-TTS-Encoding:
              $ref: '#/components/headers/X-TTS-Encoding'
            X-TTS-Sample-Rate:
              $ref: '#/components/headers/X-TTS-Sample-Rate'
            X-TTS-Container:
              $ref: '#/components/headers/X-TTS-Container'
            X-TTS-Bit-Rate:
              $ref: '#/components/headers/X-TTS-Bit-Rate'
            X-TTS-Billed-Characters:
              $ref: '#/components/headers/X-TTS-Billed-Characters'
            X-TTS-Unknown-Params:
              $ref: '#/components/headers/X-TTS-Unknown-Params'
            Server-Timing:
              $ref: '#/components/headers/Server-Timing'
            X-Accel-Buffering:
              $ref: '#/components/headers/X-Accel-Buffering'
            Cache-Control:
              $ref: '#/components/headers/Cache-Control'
          content:
            audio/mpeg:
              schema:
                $ref: '#/components/schemas/AudioBody'
            audio/pcm:
              schema:
                $ref: '#/components/schemas/AudioBody'
            audio/wav:
              schema:
                $ref: '#/components/schemas/AudioBody'
            audio/PCMU:
              schema:
                $ref: '#/components/schemas/AudioBody'
            audio/PCMA:
              schema:
                $ref: '#/components/schemas/AudioBody'
            text/event-stream:
              schema:
                type: string
                description: >-
                  Speech events, one `data:` line each: `SpeechAudioDeltaEvent`
                  objects, then one `SpeechAudioDoneEvent`, or an
                  `OpenAISseErrorEvent` before a cut. Comment lines (`:
                  keepalive`) may arrive between them.
              example: >-
                data: {"type":"speech.audio.delta","audio":"AAAAAP7/AQD+/wIA"}


                data:
                {"type":"speech.audio.done","usage":{"input_tokens":0,"output_tokens":0,"total_tokens":0,"input_characters":22,"billed_characters":22,"audio_duration_seconds":1.62}}
        '400':
          $ref: '#/components/responses/OpenAIBadRequest'
        '401':
          $ref: '#/components/responses/OpenAIUnauthorized'
        '402':
          $ref: '#/components/responses/OpenAIPaymentRequired'
        '403':
          $ref: '#/components/responses/OpenAIForbidden'
        '404':
          $ref: '#/components/responses/OpenAINotFound'
        '405':
          $ref: '#/components/responses/OpenAIMethodNotAllowed'
        '408':
          $ref: '#/components/responses/OpenAIRequestTimeout'
        '413':
          $ref: '#/components/responses/OpenAITooLarge'
        '422':
          $ref: '#/components/responses/OpenAIUnprocessable'
        '429':
          $ref: '#/components/responses/OpenAIRateLimited'
        '500':
          $ref: '#/components/responses/OpenAIInternalError'
        '503':
          $ref: '#/components/responses/OpenAIUnavailable'
components:
  parameters:
    ClientRequestIdStrict:
      name: X-Client-Request-Id
      in: header
      required: false
      schema:
        type: string
        minLength: 1
        maxLength: 512
      description: >-
        Your own id for the request, 1 to 512 printable ASCII characters, echoed
        in the response. An invalid value is refused with `400`, code
        `invalid_parameter`.
  schemas:
    OpenAISpeechRequest:
      type: object
      required:
        - model
        - input
      description: >-
        The OpenAI speech request. Fields this route does not use are ignored
        and listed in `X-TTS-Unknown-Params`.
      properties:
        model:
          type: string
          description: >-
            A language's model name, such as `assemblyai-tts-en` (the language
            follows the code), or a model's name such as `assemblyai-tts-1`,
            optionally prefixed `assemblyai/`. Case-insensitive. A name that is
            not an AssemblyAI model name, OpenAI's model names such as `tts-1`
            included, is refused with `model_not_found`, and so is a model name
            the region does not serve.
        input:
          type: string
          minLength: 1
          maxLength: 5000
          description: >-
            The text to speak, 1 to 5,000 Unicode code points, not blank. An
            array is refused.
        voice:
          oneOf:
            - type: string
            - type: object
              required:
                - id
              properties:
                id:
                  type: string
                  minLength: 1
                  maxLength: 64
                  description: The ID or slug of a cloned voice.
          description: >-
            The library slug of an AssemblyAI voice, such as `aai-jane`, a
            voice's UUID, or an OpenAI voice name mapped to an AssemblyAI voice:
            `alloy` (`aai-jane`), `ash` (`aai-michael`), `ballad`
            (`aai-charles`), `cedar` (`aai-george`), `coral` (`aai-anna`),
            `echo` (`aai-paul`), `fable` (`aai-charles`), `marin` (`aai-mary`),
            `nova` (`aai-eve`), `onyx` (`aai-george`), `sage` (`aai-vera`),
            `shimmer` (`aai-alba`) or `verse` (`aai-michael`), in English; in a
            language other than English, an OpenAI voice name speaks with the
            language's default voice, `aai-jane`. OpenAI voice names are
            case-insensitive; a slug is lowercase. A bare AssemblyAI voice name
            such as `jane` is refused with `422` (`invalid_parameter`) and
            `param` `voice`, and the message names its slug. Other values are
            not supported: a misspelt name, a file name, a path or a URL is
            refused with `422` like a bare name, and a slug or UUID that names
            no voice with `400` (`invalid_request`) or, where cloned voices are
            not available, `403`. Left out, the default voice of the model and
            language, `aai-jane`. A [cloned
            voice](/tts/openai-compatibility#cloned-voices) goes in as `{"id":
            "<voice ID or slug>"}`, or as a string holding its UUID; the slug of
            one of your voices in a plain string is refused.
        response_format:
          type: string
          enum:
            - mp3
            - pcm
            - wav
            - mulaw
            - alaw
          default: mp3
          description: >-
            `mp3` (24 kHz, 64 kbps), `pcm` (raw 16-bit little-endian), `wav`
            (16-bit PCM in a WAV file), `mulaw` or `alaw` (raw G.711),
            case-insensitive. The sample rate is 24 kHz unless `sample_rate`
            says otherwise. `opus`, `aac` and `flac` are refused.
        stream_format:
          type: string
          enum:
            - audio
            - sse
          default: audio
          description: >-
            `audio` streams the audio bytes; `sse` streams speech events.
            Case-insensitive.
        speed:
          type: number
          description: Accepted when it equals `1`; any other value is refused.
        language:
          type: string
          description: >-
            Extension: the language to speak, as a name (`english`) or an ISO
            639-1 code (`en`). Refused when it differs from the language `model`
            implies.
        sample_rate:
          type: integer
          enum:
            - 8000
            - 16000
            - 22050
            - 24000
            - 44100
            - 48000
          default: 24000
          description: 'Extension: the sample rate of the audio in Hz.'
        voice_id:
          type: string
          minLength: 1
          maxLength: 64
          description: >-
            Extension: the ID or slug of a cloned voice, for clients that cannot
            send `voice` as an object. Leave `voice` out; next to any other
            `voice`, such as `alloy` or `aai-jane`, it is refused with
            `invalid_parameter`.
        extend_biometric_consent:
          type: boolean
          default: false
          description: >-
            Extension: `true` renews the biometric consent of a cloned voice,
            and attests renewed consent on behalf of the account that owns the
            voice; see [Renew consent](/tts/cloned-voices#renew-consent). Only
            the voice's owner may set it. The voice must be named as `{"id":
            ...}` in `voice`, as its UUID in the `voice` string, or in
            `voice_id`: with no voice, or a slug such as `aai-jane` in the
            `voice` string, it is refused with `invalid_parameter`
            (`extend_biometric_consent: needs the voice by its id: {"id": ...}
            or a voice id in voice`), and on another account's voice, or with an
            OpenAI voice name such as `alloy` in an English request, with
            `not_owner`. In another language, an OpenAI voice name is refused
            with `invalid_parameter`. The renewal is not guaranteed: one that
            cannot be made leaves the expiry as it was.
        word_boundaries:
          type: boolean
          default: false
          description: >-
            Must be `false` or left out; word timings come from `POST
            /v1/speech/events`.
      example:
        model: assemblyai-tts-en
        input: Hi! Thanks for calling.
        voice: alloy
        response_format: pcm
    AudioBody:
      type: string
      format: binary
      description: >-
        Raw audio in the requested format. Streamed responses are chunked and
        end cleanly only when the audio is complete.
    OpenAIErrorResponse:
      type: object
      required:
        - error
      description: The body of every error of the OpenAI-compatible routes.
      properties:
        error:
          $ref: '#/components/schemas/OpenAIError'
    OpenAIError:
      type: object
      required:
        - message
        - type
        - code
        - request_id
        - retryable
      properties:
        message:
          type: string
          description: What went wrong, written for people.
        type:
          type: string
          description: >-
            The OpenAI error type: `invalid_request_error`,
            `authentication_error`, `permission_error`, `insufficient_quota`,
            `rate_limit_error`, `server_error` or `service_unavailable_error`.
        param:
          type: string
          nullable: true
          description: The field the error is about, or `null`.
        code:
          type: string
          description: The same code the native routes answer, such as `invalid_parameter`.
        request_id:
          type: string
          description: The request's id, also in the `X-Request-Id` header.
        retryable:
          type: boolean
          description: Whether the same request can succeed when you retry it later.
        retry_after_seconds:
          type: integer
          nullable: true
          description: Seconds to wait before retrying; `null` when there is no hint.
  headers:
    X-Request-Id:
      description: >-
        The request's id, a UUID, on every response, errors and the answer to a
        browser's CORS preflight included. It is the `id` of the `Begin` event
        and the `request_id` of an error body. Quote it in support requests.
      schema:
        type: string
    X-Generation-Id:
      description: The same value as `X-Request-Id`, for clients that read a generation id.
      schema:
        type: string
    X-Client-Request-Id:
      description: The `X-Client-Request-Id` the request sent, when it was valid.
      schema:
        type: string
    X-TTS-Region:
      description: The region that served the request, such as `us-east-1`.
      schema:
        type: string
    X-TTS-Model:
      description: >-
        The name of the model that spoke, such as `assemblyai-tts-1`, on every
        `200`. It is the model the request named, else the default model of the
        request's language, and the same value as `model` in the `Begin` event
        of `/v1/speech/events`.
      schema:
        type: string
    X-TTS-Voice-Id:
      description: >-
        The voice the request spoke, as `voice_id` names it and as
        `Begin.configuration.voice_id` reports it on `/v1/speech/events`, on
        every `200`. It is the `voice_id` the request sent, trimmed, with a UUID
        in lowercase, or the default voice's library slug, such as `aai-jane`,
        when the request named no voice.
      schema:
        type: string
    X-TTS-Voice-Expires-At-OpenAI:
      description: >-
        When the consent period of the request's cloned voice ends, as a Unix
        timestamp in seconds, as the request started. Present on a `200` that
        spoke a cloned voice of your account with a consent period; see [Voice
        cloning](/tts/cloned-voices#consent-period). The route always streams,
        so the headers leave with the first audio, before a renewal with
        `extend_biometric_consent` can move the expiry.
      schema:
        type: integer
    X-TTS-Voice-Alias:
      description: >-
        The OpenAI voice name the request used, such as `alloy`, when it used
        one.
      schema:
        type: string
    X-TTS-Language:
      description: The language spoken, such as `english`.
      schema:
        type: string
    X-TTS-Encoding:
      description: >-
        The encoding of the audio, in canonical form (`mulaw` is reported as
        `pcm_mulaw`).
      schema:
        type: string
    X-TTS-Sample-Rate:
      description: The sample rate of the audio in Hz.
      schema:
        type: integer
    X-TTS-Container:
      description: '`raw` or `wav`. Absent on MP3.'
      schema:
        type: string
    X-TTS-Bit-Rate:
      description: The MP3 bit rate in bits per second. Present on MP3 only.
      schema:
        type: integer
    X-TTS-Billed-Characters:
      description: >-
        The characters the request bills once its body is delivered, in Unicode
        code points of the text as sent; `0` for text with nothing to speak. A
        streamed response sends it with the first audio, before the outcome is
        known; a failure on our side that then cuts the body, or ends it with an
        `Error` event, makes the request free. The final count is
        `Termination.billed_characters` on `/v1/speech/events` and
        `usage.billed_characters` of `speech.audio.done`.
      schema:
        type: integer
    X-TTS-Unknown-Params:
      description: >-
        The names of the body fields the route ignored, sorted and
        comma-separated, at most 16. Present when the body had any.
      schema:
        type: string
    Server-Timing:
      description: >-
        `open;dur=<ms>, model;dur=<ms>, ttfa;dur=<ms>`: `open` from receipt to
        the start of synthesis (authentication, validation and the voice
        lookup), `model` from the start of synthesis to the first audio, `ttfa`
        from receipt to the first audio byte sent. Browsers show it in their
        network panel.
      schema:
        type: string
    X-Accel-Buffering:
      description: >-
        `no`, on streamed responses, so that proxies pass the audio on as it
        arrives.
      schema:
        type: string
    Cache-Control:
      description: >-
        `no-store, no-transform`: the audio is never cached or recompressed on
        the way.
      schema:
        type: string
    WWW-Authenticate:
      description: '`Bearer realm="assemblyai"`. On every `401`.'
      schema:
        type: string
    Allow:
      description: The methods the path answers, such as `OPTIONS, POST`.
      schema:
        type: string
    Retry-After:
      description: >-
        Whole seconds to wait before retrying. On every `429` and `503` with an
        error body.
      schema:
        type: integer
  responses:
    OpenAIBadRequest:
      description: >-
        Type `invalid_request_error`. Every refusal that the native routes
        answer with `400` or `422`, except `feature_not_enabled` (`403` here),
        answers `400` here with the same `code`, such as `invalid_message`,
        `invalid_parameter` and `invalid_request`; also `model_not_found` for a
        `model` that is not an AssemblyAI model name, `invalid_request` for text
        with nothing to speak (`input produced no speech`), and
        `invalid_parameter` for an invalid `X-Client-Request-Id`. A cloned voice
        that cannot be used answers `voice_not_found`, `voice_expired`,
        `voice_blocked`, `voice_not_paired` or `model_retired`, and
        `extend_biometric_consent` on a voice that another account owns answers
        `not_owner`; a voice UUID in the `voice` string that is not found is
        answered like an unknown voice name, `invalid_request`.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
          examples:
            model_not_found:
              summary: A model that is not an AssemblyAI model
              value:
                error:
                  message: >-
                    model: 'tts-1' is not an AssemblyAI model; use one of GET
                    /v1/openai/models, such as assemblyai-tts-en
                  type: invalid_request_error
                  param: model
                  code: model_not_found
                  request_id: 93309b7e-9131-474f-99e4-6e0623463374
                  retryable: false
                  retry_after_seconds: null
            voice_not_paired:
              summary: A cloned voice not paired with the request's model
              value:
                error:
                  message: >-
                    Voice 01a139bf-78a0-7d18-9a4e-6c0f2b8d1e37 has no ready
                    pairing with model assemblyai-tts-1. Name a model the voice
                    is paired with, or pair the voice with this model, wait
                    until the pairing is ready, and try again.
                  type: invalid_request_error
                  param: model
                  code: voice_not_paired
                  request_id: 4b8d2f61-9c3a-4e7b-b5d0-2a6f8c1e9d34
                  retryable: false
                  retry_after_seconds: null
    OpenAIUnauthorized:
      description: >-
        Type `authentication_error`, code `missing_authorization` or
        `unauthorized`.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
        WWW-Authenticate:
          $ref: '#/components/headers/WWW-Authenticate'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    OpenAIPaymentRequired:
      description: >-
        Type `insufficient_quota`, code `insufficient_funds`: the account has no
        funds for the request.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    OpenAIForbidden:
      description: >-
        Type `permission_error`, code `feature_not_enabled`: cloned voices are
        not available on this host, for a voice sent as `{"id": ...}` or in
        `voice_id`. Where cloned voices are not available, a voice UUID in the
        `voice` string is answered like an unknown voice name (`400`), and a
        model's name such as `assemblyai-tts-1` in `model`, sent without a
        cloned voice, with `400` `model_not_found`. Code
        `biometric_terms_not_accepted`, also `permission_error`: the account has
        not accepted the biometric data terms a cloned voice needs.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    OpenAINotFound:
      description: >-
        Type `invalid_request_error`, code `not_found`: a path the API does not
        serve, an unknown path or a documented one with a trailing slash. Paths
        are exact; nothing redirects.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    OpenAIMethodNotAllowed:
      description: >-
        Type `invalid_request_error`, code `method_not_allowed`: a method the
        path does not answer; `Allow` lists the ones it does.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
        Allow:
          $ref: '#/components/headers/Allow'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    OpenAIRequestTimeout:
      description: >-
        Type `invalid_request_error`, code `request_timeout`: the body did not
        arrive within 10 seconds.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    OpenAITooLarge:
      description: >-
        Type `invalid_request_error`, code `request_too_large`: the body is over
        131,072 bytes.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    OpenAIUnprocessable:
      description: >-
        Type `invalid_request_error`, code `invalid_parameter`, `param` `voice`:
        a `voice` string that is not an OpenAI voice name, a voice slug or a
        voice ID, such as a bare AssemblyAI voice name like `jane`, a misspelt
        name, a file name, a path or a URL. The message names the slug to send
        for an AssemblyAI voice's name, and `errors` lists every other failing
        field too. Every other invalid field on this route is a `400`.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
          examples:
            bare_voice_name:
              summary: A bare AssemblyAI voice name in voice
              value:
                error:
                  message: >-
                    voice: must be an OpenAI voice name such as alloy, the slug
                    of an AssemblyAI voice such as aai-jane, a voice ID, or
                    {"id": ...} with the slug of one of your voices: for jane,
                    send aai-jane
                  type: invalid_request_error
                  param: voice
                  code: invalid_parameter
                  request_id: 2c7e5a90-4f1b-4d8e-a6c3-9b0d1e2f3a45
                  retryable: false
                  retry_after_seconds: null
    OpenAIRateLimited:
      description: >-
        Type `rate_limit_error`: code `rate_limited` when the account's requests
        per minute are used up; `at_capacity` when there is no room for the
        request just now, an `mp3` request included while the server encodes as
        many MP3 responses as it takes. Retry after `Retry-After`.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    OpenAIInternalError:
      description: Type `server_error`, code `internal_error`. Retry.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    OpenAIUnavailable:
      description: >-
        Type `service_unavailable_error`, code `auth_unavailable`,
        `voice_service_unavailable`, `upstream_unavailable`, `service_restart`
        or `service_unavailable`. Retry after `Retry-After`.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Your AssemblyAI API key, or a temporary token, in the `Authorization`
        header. The raw key works directly; a `Bearer ` prefix is also accepted,
        which is what OpenAI SDKs send. Send exactly one `Authorization` header.
        The HTTP routes read the credential from this header only.

````