# REST API

> Every endpoint of the REST API, with its parameters, request and response bodies and errors, from the router's OpenAPI document.

## Provider keys

Set, list and delete your org’s provider keys with an API key, as the dashboard does. Write-only: a stored key is never returned.

### GET `/v1/provider-keys` List your provider keys

GET https://api.ttscacherouter.dev/v1/provider-keys

Which providers have a key stored, with each key's last four characters.

#### Responses

- 200 Successful Response

  An array of ProviderKey:

  - `provider` "vaakini" | "sarvam" | "raya" | "elevenlabs" | "openai" | "deepgram" | "xai" | "soniox" | "smallestai" | "cartesia" | "gemini" | "60db" Required
  - `last4` string Required: The key's last four characters. The key itself is never returned.
  - `updated_at` string (date-time) Required
- 401 Not signed in, or the session expired
- 422 Validation Error

### PUT `/v1/provider-keys/{provider}` Set or replace a provider key

PUT https://api.ttscacherouter.dev/v1/provider-keys/{provider}

Stored encrypted and never returned. The router uses a new or replaced key within seconds.

#### Parameters

- `provider` path, "vaakini" | "sarvam" | "raya" | "elevenlabs" | "openai" | "deepgram" | "xai" | "soniox" | "smallestai" | "cartesia" | "gemini" | "60db" Required

#### Request body

- `api_key` string, min length 1, max length 512 Required: Your key for the provider. Stored encrypted; it can't be read back.

**Example**

```json
{
  "api_key": "sk_…"
}
```

#### Responses

- 200 Successful Response

  - `provider` "vaakini" | "sarvam" | "raya" | "elevenlabs" | "openai" | "deepgram" | "xai" | "soniox" | "smallestai" | "cartesia" | "gemini" | "60db" Required
  - `last4` string Required: The key's last four characters. The key itself is never returned.
  - `updated_at` string (date-time) Required

  **Example**

  ```json
  {
    "last4": "x9Qa",
    "provider": "sarvam",
    "updated_at": "2026-10-10T09:32:00Z"
  }
  ```
- 401 Not signed in, or the session expired
- 422 The request failed validation

### DELETE `/v1/provider-keys/{provider}` Delete a provider key

DELETE https://api.ttscacherouter.dev/v1/provider-keys/{provider}

Requests for this provider fail with `provider_key_missing` within seconds.

#### Parameters

- `provider` path, "vaakini" | "sarvam" | "raya" | "elevenlabs" | "openai" | "deepgram" | "xai" | "soniox" | "smallestai" | "cartesia" | "gemini" | "60db" Required

#### Responses

- 204 Successful Response
- 401 Not signed in, or the session expired
- 404 Not found, or not visible to the signed-in user
- 422 Validation Error

## Custom voices

Your org’s own voices on Maya Open-Source, enabled per org on request. The guide is [Custom voices](https://docs.ttscacherouter.dev/custom-voices.md).

### GET `/v1/custom-voices` List your custom voices

GET https://api.ttscacherouter.dev/v1/custom-voices

Your org's custom voices, oldest first, whether they're enabled for it, and how many it can hold.

#### Responses

- 200 Successful Response

  - `enabled` boolean Required: Whether custom voices are enabled for your org. Until they are, creating one is refused (`custom_voices_not_enabled`); write to hello@ttscacherouter.dev to get them enabled.
  - `limit` integer Required: How many custom voices your org can hold.
  - `voices` CustomVoice\[\] Required
- 401 No API key, or an invalid one

### POST `/v1/custom-voices` Create a custom voice

POST https://api.ttscacherouter.dev/v1/custom-voices

Creates a custom voice from one reference recording and registers it on Maya Open-Source before answering: it can be spoken as soon as this returns, by your org alone, with its `id` as `voice`. Creating and keeping voices is free; their characters cost what Maya Open-Source's do.

#### Responses

- 201 Created: ready to speak

  - `id` string Required: What `voice` takes on `/v1/stream`, `/v1/audio/speech`, the LiveKit plugin and the Pipecat service, with `provider` `maya`. Only your org can speak it.
  - `name` string, min length 1, max length 100 Required
  - `gender` "female" | "male" | null Required: Your label for the voice, shown in `GET /v1/voices`; null when you set none. It doesn't change how the voice sounds.
  - `language` "as" | "bn" | "en" | "gu" | "hi" | "kn" | "ml" | "mr" | "or" | "pa" | "ta" | "te" Required: The recording's language. The voice speaks every language Maya does.
  - `models` CustomVoiceModel\[\] Required
  - `revision` integer, ≥ 1 Required: Which recording the voice speaks: 1 when created, one more each time its recording is replaced (`PUT /v1/custom-voices/{voice_id}/recording`). Audio cached for an earlier revision is never served for a later one.
  - `created_at` string (date-time) Required

  **Example**

  ```json
  {
    "id": "cv_t76u7a3um3xayk4b",
    "name": "Priya (support)",
    "gender": "female",
    "language": "hi",
    "models": [
      {
        "model": "maya/maya-2-native",
        "mode": "icl_spk"
      }
    ],
    "revision": 1,
    "created_at": "2026-11-10T01:52:33Z"
  }
  ```
- 401 No API key, or an invalid one
- 403 Custom voices aren't enabled for your org (\`custom_voices_not_enabled\`)
- 409 Your org holds as many custom voices as it can (\`custom_voice_limit\`)
- 422 The request failed validation, or Maya Open-Source couldn't use the recording (\`bad_request\`, naming the field)
- 503 Maya Open-Source or the voice store is unavailable (\`provider_unavailable\`); nothing was kept, try again

### GET `/v1/custom-voices/{voice_id}` Get a custom voice

GET https://api.ttscacherouter.dev/v1/custom-voices/{voice_id}

#### Parameters

- `voice_id` path, string Required

#### Responses

- 200 Successful Response

  - `id` string Required: What `voice` takes on `/v1/stream`, `/v1/audio/speech`, the LiveKit plugin and the Pipecat service, with `provider` `maya`. Only your org can speak it.
  - `name` string, min length 1, max length 100 Required
  - `gender` "female" | "male" | null Required: Your label for the voice, shown in `GET /v1/voices`; null when you set none. It doesn't change how the voice sounds.
  - `language` "as" | "bn" | "en" | "gu" | "hi" | "kn" | "ml" | "mr" | "or" | "pa" | "ta" | "te" Required: The recording's language. The voice speaks every language Maya does.
  - `models` CustomVoiceModel\[\] Required
  - `revision` integer, ≥ 1 Required: Which recording the voice speaks: 1 when created, one more each time its recording is replaced (`PUT /v1/custom-voices/{voice_id}/recording`). Audio cached for an earlier revision is never served for a later one.
  - `created_at` string (date-time) Required

  **Example**

  ```json
  {
    "id": "cv_t76u7a3um3xayk4b",
    "name": "Priya (support)",
    "gender": "female",
    "language": "hi",
    "models": [
      {
        "model": "maya/maya-2-native",
        "mode": "icl_spk"
      }
    ],
    "revision": 1,
    "created_at": "2026-11-10T01:52:33Z"
  }
  ```
- 401 No API key, or an invalid one
- 403 Custom voices aren't enabled for your org (\`custom_voices_not_enabled\`)
- 404 No such custom voice in your org

### PATCH `/v1/custom-voices/{voice_id}` Update a custom voice

PATCH https://api.ttscacherouter.dev/v1/custom-voices/{voice_id}

Only the name and gender change here. A `gender` of null clears it. To change the recording, transcript, language or mode, replace the recording (`PUT …/recording`).

#### Parameters

- `voice_id` path, string Required

#### Request body

- `name` string, min length 1, max length 100
- `gender` "female" | "male" | null: Null clears it.

#### Responses

- 200 Successful Response

  - `id` string Required: What `voice` takes on `/v1/stream`, `/v1/audio/speech`, the LiveKit plugin and the Pipecat service, with `provider` `maya`. Only your org can speak it.
  - `name` string, min length 1, max length 100 Required
  - `gender` "female" | "male" | null Required: Your label for the voice, shown in `GET /v1/voices`; null when you set none. It doesn't change how the voice sounds.
  - `language` "as" | "bn" | "en" | "gu" | "hi" | "kn" | "ml" | "mr" | "or" | "pa" | "ta" | "te" Required: The recording's language. The voice speaks every language Maya does.
  - `models` CustomVoiceModel\[\] Required
  - `revision` integer, ≥ 1 Required: Which recording the voice speaks: 1 when created, one more each time its recording is replaced (`PUT /v1/custom-voices/{voice_id}/recording`). Audio cached for an earlier revision is never served for a later one.
  - `created_at` string (date-time) Required

  **Example**

  ```json
  {
    "id": "cv_t76u7a3um3xayk4b",
    "name": "Priya (support)",
    "gender": "female",
    "language": "hi",
    "models": [
      {
        "model": "maya/maya-2-native",
        "mode": "icl_spk"
      }
    ],
    "revision": 1,
    "created_at": "2026-11-10T01:52:33Z"
  }
  ```
- 401 No API key, or an invalid one
- 403 Custom voices aren't enabled for your org (\`custom_voices_not_enabled\`)
- 404 No such custom voice in your org
- 422 The request failed validation

### DELETE `/v1/custom-voices/{voice_id}` Delete a custom voice

DELETE https://api.ttscacherouter.dev/v1/custom-voices/{voice_id}

Deletes the voice at once: requests naming it are refused from then on, and its recording and transcript are deleted. Audio cached from it can no longer be reached and expires with your org's cache retention (at most 30 days).

#### Parameters

- `voice_id` path, string Required

#### Responses

- 204 Deleted
- 401 No API key, or an invalid one
- 403 Custom voices aren't enabled for your org (\`custom_voices_not_enabled\`)
- 404 No such custom voice in your org

### PUT `/v1/custom-voices/{voice_id}/recording` Replace a custom voice's recording

PUT https://api.ttscacherouter.dev/v1/custom-voices/{voice_id}/recording

Replaces the voice's recording, transcript, language and mode together, under the same `id`, and registers the new recording on Maya Open-Source before answering: every request from then on speaks it (within a few seconds), and a reply already being spoken finishes in the old recording. The voice's `revision` goes up by one. Audio cached for the old recording is never served for the new one, so each sentence is synthesized again once. The name and gender don't change. If Maya Open-Source refuses the new recording, the voice keeps its old one.

#### Parameters

- `voice_id` path, string Required

#### Responses

- 200 Replaced: the new recording is ready to speak

  - `id` string Required: What `voice` takes on `/v1/stream`, `/v1/audio/speech`, the LiveKit plugin and the Pipecat service, with `provider` `maya`. Only your org can speak it.
  - `name` string, min length 1, max length 100 Required
  - `gender` "female" | "male" | null Required: Your label for the voice, shown in `GET /v1/voices`; null when you set none. It doesn't change how the voice sounds.
  - `language` "as" | "bn" | "en" | "gu" | "hi" | "kn" | "ml" | "mr" | "or" | "pa" | "ta" | "te" Required: The recording's language. The voice speaks every language Maya does.
  - `models` CustomVoiceModel\[\] Required
  - `revision` integer, ≥ 1 Required: Which recording the voice speaks: 1 when created, one more each time its recording is replaced (`PUT /v1/custom-voices/{voice_id}/recording`). Audio cached for an earlier revision is never served for a later one.
  - `created_at` string (date-time) Required

  **Example**

  ```json
  {
    "id": "cv_t76u7a3um3xayk4b",
    "name": "Priya (support)",
    "gender": "female",
    "language": "hi",
    "models": [
      {
        "model": "maya/maya-2-native",
        "mode": "icl_spk"
      }
    ],
    "revision": 1,
    "created_at": "2026-11-10T01:52:33Z"
  }
  ```
- 401 No API key, or an invalid one
- 403 Custom voices aren't enabled for your org (\`custom_voices_not_enabled\`)
- 404 No such custom voice in your org
- 422 The request failed validation, or Maya Open-Source couldn't use the recording (\`bad_request\`, naming the field)
- 503 Maya Open-Source or the voice store is unavailable (\`provider_unavailable\`); the voice keeps its old recording, try again

## Models

What the router accepts, per provider. No authentication.

### GET `/v1/models` List providers and models

GET https://api.ttscacherouter.dev/v1/models

Every provider and model the router accepts, with the voices, languages, speed range, sample rates, formats and options each one takes. No authentication. Maya Open-Source's voices include voices we add over time, so its list can grow (or lose one) between releases.

#### Responses

- 200 Successful Response

  - `providers` Provider\[\] Required

  **Example**

  ```json
  {
    "providers": [
      {
        "docs_url": "https://docs.sarvam.ai/api-reference/text-to-speech/stream",
        "formats": [
          "pcm",
          "wav",
          "mp3",
          "aac",
          "mulaw",
          "alaw"
        ],
        "id": "sarvam",
        "models": [
          {
            "id": "bulbul:v3",
            "languages": [
              "hi-IN",
              "en-IN"
            ],
            "voices": [
              "shubh",
              "aditya",
              "ritu"
            ],
            "voices_url": "https://docs.sarvam.ai/api/getting-started/models/bulbul"
          }
        ],
        "name": "Sarvam",
        "options": [
          {
            "default": 0.6,
            "description": "Sampling temperature.",
            "max": 1,
            "min": 0.01,
            "name": "temperature",
            "nullable": false,
            "type": "number",
            "models": null
          },
          {
            "default": 0,
            "description": "Pitch: lower is deeper, higher is sharper.",
            "max": 0.5,
            "min": -0.5,
            "models": [
              "bulbul:v4-flash"
            ],
            "name": "pitch",
            "nullable": false,
            "type": "number",
            "values": null
          }
        ],
        "sample_rates": [
          8000,
          16000,
          22050,
          24000
        ],
        "speech_sample_rates": [
          8000,
          16000,
          22050,
          24000,
          32000,
          44100,
          48000
        ],
        "speed": {
          "max": 2,
          "min": 0.5
        }
      }
    ]
  }
  ```

## Voices

The voices your org can speak with at each provider. The guide is [Voices](https://docs.ttscacherouter.dev/reference/voices.md).

### GET `/v1/voices` List voices

GET https://api.media.ttscacherouter.dev/v1/voices

The voices your org can speak with at one provider, in one shape: the provider's built-in voices and your provider account's own (cloned, designed, added from a library), read live from the provider with your stored provider key (for Vaakini, its voices, then your Vaakini org's custom voices); Sarvam's and OpenAI's, which no provider API lists, and Maya Open-Source's (which needs no key), from the router's catalog, with your org's custom voices (`category` `cloned`). Only voices the router can speak with are listed. Never cached: a voice you add at the provider is listed on the next request. A provider that paginates is read to its last page, so the answer is the whole list. Each voice's `id` is what `voice` takes on `/v1/stream`, `/v1/audio/speech` and the LiveKit plugin. Provider errors (a rejected key, a rate limit) pass through with the provider's status in `provider_status` and its body in `message`.

#### Parameters

- `provider` query, "maya" | "vaakini" | "sarvam" | "raya" | "elevenlabs" | "openai" | "deepgram" | "xai" | "soniox" | "smallestai" | "cartesia" | "gemini" | "60db" Required: The provider whose voices to list.
- `model` query, string: Only voices this model takes, by the router's model id (as `GET /v1/models` lists them, without the provider prefix), e.g. `bulbul:v4-flash`, `aura-2`, `m1`.

#### Responses

- 200 Successful Response

  - `voices` Voice\[\] Required
- 400 \`bad_request\` (a missing or unknown provider or model, an unknown query parameter), \`provider_key_missing\` (no key stored for the provider) or \`provider_rejected\` (the provider refused the request, e.g. a wrong provider key)
- 401 A missing or invalid API key (\`unauthorized\`)
- 402 The org is out of credit (\`insufficient_credits\`)
- 429 The provider rate-limited your provider key (\`provider_rate_limited\`)
- 502 The provider failed or answered something unexpected (\`provider_unavailable\`)
- 504 The provider didn't answer in time (\`provider_timeout\`)

## Speech

Shaped like OpenAI’s. The guide is [/v1/audio/speech](https://docs.ttscacherouter.dev/clients/speech.md).

### POST `/v1/audio/speech` Create speech

POST https://api.media.ttscacherouter.dev/v1/audio/speech

Synthesizes `input`, shaped like OpenAI's `audio/speech`, so the OpenAI SDK works with `base_url` set to `https://api.media.ttscacherouter.dev/v1` and your `tcr_` key. Provider-specific fields go in the body (`extra_body` in the OpenAI SDK). The input is split into sentences; each one your org has synthesized before with the same settings is served from the cache, the rest by the provider with your stored provider key (Maya Open-Source on our own GPU, with no key). Audio streams back as each sentence resolves. The status is sent with the first audio, so an error after audio has started can only abort the body: the response ends without its final chunk, which HTTP clients raise as an error (`httpx.RemoteProtocolError`, `requests.exceptions.ChunkedEncodingError`, …). Treat it as a failed request.

#### Request body

- `model` string Required: `<provider>/<model>`: `maya/maya-2-native` (Maya Open-Source, no key needed), `vaakini/vaakini-tts-1`, `sarvam/bulbul:v3`, `sarvam/bulbul:v4-flash`, `raya/standard`, `raya/m1`, an ElevenLabs model such as `elevenlabs/eleven_flash_v2_5`, an OpenAI model such as `openai/gpt-4o-mini-tts`, `deepgram/aura-2`, `deepgram/aura-1` or `deepgram/flux`, `xai/xai-tts`, `soniox/tts-rt-v2` (Soniox's deprecated `tts-rt-v1` aliases are refused), `smallestai/lightning_v3.1` or `smallestai/lightning_v3.1_pro`, or `cartesia/sonic-3.6`, `cartesia/sonic-3.5` or `cartesia/sonic-3` (or a dated snapshot of one, e.g. `cartesia/sonic-3.6-2026-08-27`), or `gemini/gemini-3.8-flash-tts`, `gemini/gemini-3.8-flash-lite-tts`, `gemini/gemini-3.1-flash-tts-preview`, `gemini/gemini-2.5-flash-preview-tts` or `gemini/gemini-2.5-pro-preview-tts`, or `60db/60db-fast-v01` or `60db/60db-quality-v01` (60db's tiers: the voice must be one of the tier's); see `GET /v1/models`.
- `input` string, min length 1 Required: The text to speak.
- `voice` string, min length 1: The provider's voice id, required except with Gemini's `speakers`: one of Maya Open-Source's voices (e.g. `Monika`; any case) or one of your org's custom voices (`cv_…`), one of Vaakini's voices by name (e.g. `Monika`; any case) or a custom voice of your Vaakini org (`cv_…`), a Sarvam speaker, a Raya voice id, an ElevenLabs voice id, an OpenAI voice (e.g. `ash`), a Deepgram voice with its language (e.g. `thalia-en`: with `deepgram/aura-2`, Deepgram's `aura-2-thalia-en`) an xAI voice (e.g. `ara`, or a custom voice id), a Soniox voice (e.g. `Adrian`, or a cloned voice's id), a Cartesia voice id (e.g. `f786b574-daa5-4673-aa0c-cbe3e8534c02`) a Gemini voice (e.g. `Kore`; with the 3.8 models also a library voice such as `en-us-tutor-1`; left out with Gemini's `speakers`), a Smallest AI voice of the model (e.g. `meher` with `lightning_v3.1_pro`, `sophia` with `lightning_v3.1`, or a cloned voice's id, with the model it was cloned for), or a 60db voice id of the model's tier (e.g. `fbb75ed2-975a-40c7-9e06-38e30524a9a1` with `60db-fast-v01`).
- `language` string | null, min length 1: The provider's language code, e.g. `hi-IN` (Sarvam), `hi` (Raya), `en` (ElevenLabs), `en` or `auto` (xAI), `en` (Soniox), `en`, `hi` or `auto` (Smallest AI), `en` or `hi` (Cartesia). Required for Sarvam, Raya and Soniox (which reads the text through that language's phonetics); optional for ElevenLabs, which otherwise detects the language, for xAI (default `auto`: xAI detects it) for Smallest AI (default `en`; `auto`: Smallest AI detects it) for Cartesia (default `en`) for Maya Open-Source (`as`, `bn`, `en`, `gu`, `hi`, `kn`, `ml`, `mr`, `or`, `pa`, `ta` or `te`; left out, Maya guesses it from the text's script) and for Vaakini (`as`, `bn`, `en`, `gu`, `hi`, `kn`, `ml`, `mr`, `or`, `pa`, `ta` or `te`; left out, Vaakini picks it from the text's script); not accepted for OpenAI, Gemini and 60db, which speak the language of the text, nor for Deepgram, whose voice names its language.
- `response_format` "pcm" | "wav" | "mp3" | "aac" | "mulaw" | "alaw": `pcm` (s16le mono), `wav`, `mp3`, `aac`, `mulaw` or `alaw`. Raya supports `pcm`, `wav`, `mulaw` and (`m1` only) `mp3`; ElevenLabs `pcm`, `wav`, `mp3`, `mulaw` and `alaw`; OpenAI `pcm`, `wav`, `mp3` and `aac`; Deepgram `pcm`, `wav`, `mulaw`, `alaw` and (Aura only) `mp3`; xAI, Soniox, Smallest AI and Cartesia `pcm`, `wav`, `mp3`, `mulaw` and `alaw`; Gemini `pcm` and `wav`, and with its 3.8 models `mulaw` and `alaw`; 60db `pcm`, `wav` and `mulaw`; Maya Open-Source `pcm`, `wav` and `mp3`; Vaakini `pcm`, `wav` and `mp3`.
- `speed` number: Sarvam 0.5–2.0, Raya 0.5–1.5, OpenAI 0.25–4.0, Deepgram 0.7–1.5 (`aura-2` only; left out, Deepgram's default), xAI 0.7–1.5 (left out, xAI's default, 1.0), Soniox 0.7–1.3, Smallest AI 0.5–2.0, Cartesia 0.6–1.5 (left out, Cartesia's default, 1.0), 60db 0.5–2.0 (left out, 60db's default, 1.0). Not for ElevenLabs, whose speed is `voice_settings.speed`, nor for Gemini (ask for a pace in `instructions`), nor for Maya Open-Source or Vaakini.
- `sample_rate` 8000 | 16000 | 22050 | 24000 | 32000 | 44100 | 48000: 32000, 44100 and 48000 are Sarvam's over its REST API (one request per sentence), where `bitrate` is fixed at 128k, and ElevenLabs' `pcm`. ElevenLabs' `mp3` is 22050, 24000 or 44100 Hz; its `mulaw` and `alaw` 8000 Hz (their default). OpenAI is 24000 Hz only. Deepgram's `pcm` is 8000, 16000, 24000, 32000, 44100 or 48000 Hz, its `mulaw` and `alaw` 8000 (default) or 16000, its `mp3` 22050 (default). xAI is 8000, 16000, 22050, 24000, 44100 or 48000 Hz for every format. Soniox's `pcm` is 8000, 16000, 24000, 44100 or 48000 Hz, its `mp3` 16000, 24000, 32000, 44100 or 48000, its `mulaw` and `alaw` 8000 (their default). Smallest AI is 8000, 16000, 24000 or 44100 Hz for every format. Cartesia is 8000, 16000, 22050, 24000, 44100 or 48000 Hz for every format. Gemini's `pcm` is 24000 Hz only, its `mulaw` and `alaw` 8000 (their default). 60db's `pcm` is 8000, 16000, 24000 or 48000 Hz, its `mulaw` 8000 (its default). Maya Open-Source is 24000 Hz only. Vaakini is 24000 Hz only.
- `stream_format` "audio": Only `audio`: the body is the audio itself.
- `instructions` string | null, min length 1: OpenAI and Gemini: how to speak (tone, accent, emotion, pace). OpenAI's `gpt-4o-mini-tts` follows them; `tts-1` and `tts-1-hd` ignore them. Gemini's 2.5 and 3.1 models take them in the prompt (left out, LiveKit's Gemini plugin's default: "Say the text with a proper tone, don't omit or add any words"), its 3.8 models as the delivery style (left out, none).
- `temperature` number | null: Sarvam: 0.01–1.0, default 0.6. Maya Open-Source: 0.1–1.5; left out, Maya's default. Vaakini: 0.1–1.5; left out, Vaakini's default.
- `dict_id` string | null: Sarvam only: a pronunciation dictionary.
- `bitrate` "32k" | "48k" | "64k" | "96k" | "128k" | "192k" | 32000 | 64000 | 96000 | 128000 | 192000 | 256000 | 320000 | null: `mp3` (and Sarvam's `aac`). Sarvam: 32k–192k, default `128k`. ElevenLabs: 32k at 22050 Hz, 48k at 24000 Hz, 32k–192k at 44100 Hz (default 128k). Soniox (`mp3` only): an integer in bits per second, 32000, 64000, 96000, 128000, 192000, 256000 or 320000 (left out, Soniox's default, 128000).
- `pitch` number | null: Sarvam `bulbul:v4-flash` only: -0.5 (deeper) to 0.5 (higher), default 0.
- `loudness` number | null: Sarvam `bulbul:v4-flash` only: 0.1–2.5, default 1.0.
- `enable_preprocessing` boolean | null: Sarvam `bulbul:v4-flash` only: normalize numbers and English words in the text before synthesis. Default false.
- `min_buffer_size` integer | null, ≥ 30, ≤ 200: Sarvam only: characters Sarvam buffers before it starts synthesizing, 30–200. Default: the router's choice, the least Sarvam allows.
- `max_chunk_length` integer | null, ≥ 50, ≤ 500: Sarvam only: the longest text Sarvam synthesizes in one piece, 50–500; it splits longer sentences. Default: the router's choice, the most Sarvam allows, so each sentence is synthesized whole.
- `voice_settings` object | null: ElevenLabs only: any of the voice's settings; one left out keeps its stored setting, and null keeps them all. Dialogue models (`eleven_v3`, `eleven_v4`) use `stability` only.
- `apply_text_normalization` "auto" | "on" | "off" | null: ElevenLabs only: `auto` (default), `on` or `off`.
- `apply_language_text_normalization` boolean | null: ElevenLabs only: language-specific normalization (Japanese).
- `enable_ssml_parsing` boolean | null: ElevenLabs only: parse SSML tags. Default false.
- `enable_logging` boolean | null: ElevenLabs only: false for ElevenLabs' zero-retention mode (enterprise accounts). Default true.
- `pronunciation_dictionary_locators` object\[\] | null: ElevenLabs only: up to 3 pronunciation dictionary versions.
- `mip_opt_out` boolean: Deepgram only: opt out of Deepgram's Model Improvement Program.
- `bit_rate` 32000 | 48000 | 64000 | 96000 | 128000 | 192000 | null: `mp3` only: the bit rate in bits per second. Deepgram: 32000 or 48000 (left out, Deepgram's default, 48000). xAI: 32000, 64000, 96000, 128000 or 192000 (left out, xAI's default, 128000). Cartesia: MP3's bit rate, 32000, 64000, 96000, 128000 (default) or 192000.
- `optimize_streaming_latency` 0 | 1 | 2 | null: xAI only: 0 for the best quality (xAI's default), 1 or 2 for a smaller first chunk and lower time to first audio, with a quality tradeoff at chunk boundaries. Left out, xAI's default.
- `text_normalization` boolean | null: xAI only: normalize written forms (numbers, abbreviations, symbols) into spoken forms before synthesis. Left out, xAI's default (false).
- `reduce_silence` boolean | null: Soniox only: shorten the pauses between words. Left out, Soniox's default (false).
- `volume` number, ≥ 0.5, ≤ 2: Cartesia: loudness relative to the voice's own. Left out, Cartesia's default (1.0).
- `emotion` string: Cartesia: guide the delivery (English), e.g. `calm`, `sad` or `angry`; Cartesia lists the rest. Left out, Cartesia reads the emotion from the text.
- `pronunciation_dict_id` string: Cartesia: a pronunciation dictionary's id, part of the cache key: a dictionary edited in place reaches cached entries only when they expire.
- `speakers` object: Gemini's 3.8 models: two speakers' names, each with a voice (a multi-speaker voice config); replaces `voice`. Requires `speaker`.
- `speaker` string, min length 1: Gemini: which of `speakers` voices this request.
- `wpm` integer, ≥ 60, ≤ 300: 60db: the target pace in words per minute. Left out, the voice's own pace.
- `stability` integer, ≥ 0, ≤ 100: 60db: 0 (expressive) to 100 (consistent). Left out, 60db's default (50).
- `similarity` integer, ≥ 0, ≤ 100: 60db: how closely the voice matches its source, 0 (loose) to 100 (exact). Left out, 60db's default (75).
- `normalize` boolean | null: Maya Open-Source, Vaakini: speak numbers, currency, dates, times, OTPs, phone numbers, URLs and emails as words in the request's language. Left out, the provider's default (on).
- `top_k` integer, ≥ 1, ≤ 2048: Maya Open-Source, Vaakini: sample from the k likeliest codes. Left out, the provider's default.
- `top_p` number, ≤ 1: Maya Open-Source, Vaakini: nucleus sampling. Left out, the provider's default.
- `repetition_penalty` number, ≥ 0, ≤ 5: Maya Open-Source, Vaakini: penalty on recently repeated codes. Left out, the provider's default.
- `seed` integer, ≥ 0, ≤ 9223372036854776000: Maya Open-Source: the sampling seed. The same seed repeats a take only when Maya runs the request alone. Left out, a seed of Maya's.

**Example**

```json
{
  "input": "नमस्ते, मैं सिटी हॉस्पिटल से प्रिया बोल रही हूँ।",
  "language": "hi-IN",
  "model": "sarvam/bulbul:v3",
  "response_format": "mp3",
  "voice": "shubh"
}
```

#### Responses

- 200 The audio, streamed.
- 400 Invalid request, or the provider refused it
- 401 Missing or invalid API key
- 402 The org is out of credit (\`insufficient_credits\`): buy credit in the dashboard
- 429 Your provider quota is exhausted
- 502 The provider failed
- 504 The provider timed out

## Provider drop-ins

Mirrors of each provider's own endpoints. The WebSockets aren't in OpenAPI; each provider's page lists them.

### Vaakini drop-in

### POST `/vaakini/v1/audio/speech` Vaakini: create speech

POST https://api.media.ttscacherouter.dev/vaakini/v1/audio/speech

Mirrors `POST https://api.vaakini.com/v1/audio/speech` (\[Vaakini's reference\](https://docs.vaakini.com/reference)): the same body, response and errors. Set the Vaakini SDK's `base_url` to `https://api.media.ttscacherouter.dev/vaakini` and its API key to your `tcr_` key (`Authorization: Bearer`); your stored Vaakini key is used. The router splits `input` into sentences, serves each one your org has synthesized before from the cache and sends the rest to Vaakini with your settings, one sentence at a time, each its own cache entry (shared with `/v1/stream` and `/v1/audio/speech` for the same request). The audio streams back in order as one stream of `response_format` (one WAV header for `wav`). A body the router doesn't read as a request Vaakini accepts goes to Vaakini verbatim, uncached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Request body

#### Responses

- 200 Successful Response

### GET `/vaakini/v1/voices` Vaakini: list voices

GET https://api.media.ttscacherouter.dev/vaakini/v1/voices

Mirrors `GET https://api.vaakini.com/v1/voices` (\[Vaakini's reference\](https://docs.vaakini.com/reference)): the same query, response and errors. Send your `tcr_` key as the API key (`Authorization: Bearer`); the request goes to Vaakini verbatim with your stored Vaakini key. Not cached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Responses

- 200 Successful Response

### GET `/vaakini/v1/models` Vaakini: list models

GET https://api.media.ttscacherouter.dev/vaakini/v1/models

Mirrors `GET https://api.vaakini.com/v1/models` (\[Vaakini's reference\](https://docs.vaakini.com/reference)): the same query, response and errors. Send your `tcr_` key as the API key (`Authorization: Bearer`); the request goes to Vaakini verbatim with your stored Vaakini key. Not cached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Responses

- 200 Successful Response

### GET `/vaakini/v1/custom-voices` Vaakini: list custom voices

GET https://api.media.ttscacherouter.dev/vaakini/v1/custom-voices

Mirrors `GET https://api.vaakini.com/v1/custom-voices` (\[Vaakini's reference\](https://docs.vaakini.com/reference)): the same query, response and errors. Send your `tcr_` key as the API key (`Authorization: Bearer`); the request goes to Vaakini verbatim with your stored Vaakini key. Not cached. The voices are your Vaakini org's, the one your stored Vaakini key belongs to. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Responses

- 200 Successful Response

### POST `/vaakini/v1/custom-voices` Vaakini: create a custom voice

POST https://api.media.ttscacherouter.dev/vaakini/v1/custom-voices

Mirrors `POST https://api.vaakini.com/v1/custom-voices` (\[Vaakini's reference\](https://docs.vaakini.com/reference)): the same multipart body, response and errors. Send your `tcr_` key as the API key (`Authorization: Bearer`); the request goes to Vaakini verbatim with your stored Vaakini key. Not cached. The voice is created in your Vaakini org and can be spoken through the router at once, with its `cv_…` id as `voice`. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Responses

- 200 Successful Response

### GET `/vaakini/v1/custom-voices/{voice_id}` Vaakini: get a custom voice

GET https://api.media.ttscacherouter.dev/vaakini/v1/custom-voices/{voice_id}

Mirrors `GET https://api.vaakini.com/v1/custom-voices/{voice_id}` (\[Vaakini's reference\](https://docs.vaakini.com/reference)): the same path, response and errors. Send your `tcr_` key as the API key (`Authorization: Bearer`); the request goes to Vaakini verbatim with your stored Vaakini key. Not cached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Parameters

- `voice_id` path, string Required

#### Responses

- 200 Successful Response

### PATCH `/vaakini/v1/custom-voices/{voice_id}` Vaakini: update a custom voice

PATCH https://api.media.ttscacherouter.dev/vaakini/v1/custom-voices/{voice_id}

Mirrors `PATCH https://api.vaakini.com/v1/custom-voices/{voice_id}` (\[Vaakini's reference\](https://docs.vaakini.com/reference)): the same body, response and errors. Send your `tcr_` key as the API key (`Authorization: Bearer`); the request goes to Vaakini verbatim with your stored Vaakini key. Not cached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Parameters

- `voice_id` path, string Required

#### Request body

#### Responses

- 200 Successful Response

### DELETE `/vaakini/v1/custom-voices/{voice_id}` Vaakini: delete a custom voice

DELETE https://api.media.ttscacherouter.dev/vaakini/v1/custom-voices/{voice_id}

Mirrors `DELETE https://api.vaakini.com/v1/custom-voices/{voice_id}` (\[Vaakini's reference\](https://docs.vaakini.com/reference)): the same path, response and errors. Send your `tcr_` key as the API key (`Authorization: Bearer`); the request goes to Vaakini verbatim with your stored Vaakini key. Not cached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Parameters

- `voice_id` path, string Required

#### Responses

- 200 Successful Response

### PUT `/vaakini/v1/custom-voices/{voice_id}/recording` Vaakini: replace a custom voice's recording

PUT https://api.media.ttscacherouter.dev/vaakini/v1/custom-voices/{voice_id}/recording

Mirrors `PUT https://api.vaakini.com/v1/custom-voices/{voice_id}/recording` (\[Vaakini's reference\](https://docs.vaakini.com/reference)): the same multipart body, response and errors. Send your `tcr_` key as the API key (`Authorization: Bearer`); the request goes to Vaakini verbatim with your stored Vaakini key. Not cached. Sentences spoken with the voice afterwards are synthesized afresh: the cache never serves the old recording's audio for the new one. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Parameters

- `voice_id` path, string Required

#### Responses

- 200 Successful Response

### Sarvam drop-in

### POST `/sarvam/text-to-speech/stream` Sarvam: text to speech (HTTP stream)

POST https://api.media.ttscacherouter.dev/sarvam/text-to-speech/stream

Mirrors `POST https://api.sarvam.ai/text-to-speech/stream` (\[Sarvam's reference\](https://docs.sarvam.ai/api-reference/text-to-speech/convert-stream)): the same body, response and errors. Send your `tcr_` key in `api-subscription-key`; your stored Sarvam key is used. The text is split into sentences, each its own request to Sarvam's HTTP stream with your settings and its own cache entry, and their audio streams back in order as one stream (one WAV header for `wav`). In `flac` or `opus`, whose takes don't join into one stream, the whole text is one request and one cache entry. A body the router doesn't read as a request Sarvam accepts goes to Sarvam verbatim, uncached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Request body

#### Responses

- 200 Successful Response

### POST `/sarvam/text-to-speech` Sarvam: text to speech (REST)

POST https://api.media.ttscacherouter.dev/sarvam/text-to-speech

Mirrors `POST https://api.sarvam.ai/text-to-speech` (\[Sarvam's reference\](https://docs.sarvam.ai/api-reference/text-to-speech/convert)): the same body, response and errors. Send your `tcr_` key in `api-subscription-key`; your stored Sarvam key is used. The text is split into sentences, each its own request to Sarvam's REST API with your settings and its own cache entry (shared with `/v1/audio/speech` at 32000, 44100 and 48000 Hz); once every sentence is ready, the reply is `{"request_id": null, "audios": [...]}` with one take. In `flac` or `opus`, whose takes don't join into one stream, the whole text is one request and one cache entry. A body the router doesn't read as a request Sarvam accepts goes to Sarvam verbatim, uncached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Request body

#### Responses

- 200 Successful Response

### Raya drop-in

### POST `/raya/v1/text-to-speech` Raya: text to speech (REST)

POST https://api.media.ttscacherouter.dev/raya/v1/text-to-speech

Mirrors `POST https://hub.getraya.app/v1/text-to-speech` (\[Raya's reference\](https://docs.litwizlabs.com/api-reference/text-to-speech/text-to-speech)): the same body, response and errors. Send your `tcr_` key in `X-API-Key`. The router splits `text` into sentences, serves each one your org has synthesized before from the cache and sends the rest to Raya with your stored Raya key, one sentence at a time, then answers with one file in the requested codec with Raya's `Content-Type` and `Content-Disposition`. A body that isn't a request Raya accepts goes to Raya as sent, uncached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Request body

#### Responses

- 200 Successful Response

### POST `/raya/v1/text-to-speech/stream` Raya: text to speech (SSE stream)

POST https://api.media.ttscacherouter.dev/raya/v1/text-to-speech/stream

Mirrors `POST https://hub.getraya.app/v1/text-to-speech/stream` (\[Raya's reference\](https://docs.litwizlabs.com/api-reference/text-to-speech/text-to-speech-stream)): the same body, response and errors. Send your `tcr_` key in `X-API-Key`. The router splits `text` into sentences, serves each one your org has synthesized before from the cache and sends the rest to Raya with your stored Raya key, streaming each sentence's samples as `chunk` events (without `step_time`) as it is ready, then `done`; a sentence that fails after the first ends the stream with an `error` event. A body that isn't a request Raya accepts goes to Raya as sent, uncached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Request body

#### Responses

- 200 Successful Response

### GET `/raya/v1/voices` Raya: list voices

GET https://api.media.ttscacherouter.dev/raya/v1/voices

Mirrors `GET https://hub.getraya.app/v1/voices` (\[Raya's reference\](https://docs.litwizlabs.com/api-reference/voices/list-voices)): the same query, response and errors. Send your `tcr_` key in `X-API-Key`; the request goes to Raya verbatim with your stored Raya key. Not cached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Responses

- 200 Successful Response

### ElevenLabs drop-in

### POST `/elevenlabs/v1/text-to-speech/{voice_id}` ElevenLabs: text to speech

POST https://api.media.ttscacherouter.dev/elevenlabs/v1/text-to-speech/{voice_id}

Mirrors `POST https://api.elevenlabs.io/v1/text-to-speech/{voice_id}` (\[ElevenLabs' reference\](https://elevenlabs.io/docs/api-reference/text-to-speech/convert)): the same query, body, response and errors. Send your `tcr_` key in `xi-api-key`; your stored ElevenLabs key is used. The router splits `text` into sentences, serves each one your org has synthesized before from the cache and sends the rest to this endpoint with the query and body's settings, one sentence at a time, each its own cache entry: a field left out or `null` counts as ElevenLabs' default (`output_format` `mp3_44100_128`, `enable_logging` true, `model_id` `eleven_multilingual_v2`, `apply_text_normalization` `auto`, `apply_language_text_normalization` false), `previous_text` goes with the first sentence and `next_text` with the last. A body with `pronunciation_dictionary_locators` is cached by the dictionaries' ids and versions: a dictionary edited in place reaches entries cached before only when they expire. In `opus`, with `audio_effects` or with an audio tag such as `[whispers]`, the whole text is one request and one cache entry. A body the router doesn't read as one ElevenLabs accepts (a field or query parameter ElevenLabs' reference doesn't list, a value of the wrong type, a codec ElevenLabs doesn't make), or one with `previous_request_ids` or `next_request_ids`, goes to ElevenLabs verbatim, uncached, with ElevenLabs' own answer and headers. A split response carries only `Content-Type`: no one ElevenLabs request produced it, so no `request-id` or `character-cost`. The answer comes once every sentence is ready, as one file of the format: raw samples one after another, MP3 under the first sentence's ID3 tag and Info frame, WAV under one header. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Parameters

- `voice_id` path, string Required

#### Request body

#### Responses

- 200 Successful Response

### POST `/elevenlabs/v1/text-to-speech/{voice_id}/stream` ElevenLabs: text to speech (stream)

POST https://api.media.ttscacherouter.dev/elevenlabs/v1/text-to-speech/{voice_id}/stream

Mirrors `POST https://api.elevenlabs.io/v1/text-to-speech/{voice_id}/stream` (\[ElevenLabs' reference\](https://elevenlabs.io/docs/api-reference/text-to-speech/stream)): the same query, body, response and errors. Send your `tcr_` key in `xi-api-key`; your stored ElevenLabs key is used. The router splits `text` into sentences, serves each one your org has synthesized before from the cache and sends the rest to this endpoint with the query and body's settings, one sentence at a time, each its own cache entry: a field left out or `null` counts as ElevenLabs' default (`output_format` `mp3_44100_128`, `enable_logging` true, `model_id` `eleven_multilingual_v2`, `apply_text_normalization` `auto`, `apply_language_text_normalization` false), `previous_text` goes with the first sentence and `next_text` with the last. A body with `pronunciation_dictionary_locators` is cached by the dictionaries' ids and versions: a dictionary edited in place reaches entries cached before only when they expire. In `opus`, with `audio_effects` or with an audio tag such as `[whispers]`, the whole text is one request and one cache entry. A body the router doesn't read as one ElevenLabs accepts (a field or query parameter ElevenLabs' reference doesn't list, a value of the wrong type, a codec ElevenLabs doesn't make), or one with `previous_request_ids` or `next_request_ids`, goes to ElevenLabs verbatim, uncached, with ElevenLabs' own answer and headers. A split response carries only `Content-Type`: no one ElevenLabs request produced it, so no `request-id` or `character-cost`. The sentences' audio streams back as each is ready, as one stream of the format (one MP3 tag); a later sentence that fails breaks the body off. ElevenLabs makes no WAV on a stream, and its refusal comes back as it sent it. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Parameters

- `voice_id` path, string Required

#### Request body

#### Responses

- 200 Successful Response

### POST `/elevenlabs/v1/text-to-speech/{voice_id}/with-timestamps` ElevenLabs: text to speech with timestamps

POST https://api.media.ttscacherouter.dev/elevenlabs/v1/text-to-speech/{voice_id}/with-timestamps

Mirrors `POST https://api.elevenlabs.io/v1/text-to-speech/{voice_id}/with-timestamps` (\[ElevenLabs' reference\](https://elevenlabs.io/docs/api-reference/text-to-speech/convert-with-timestamps)): the same query, body, response and errors. Send your `tcr_` key in `xi-api-key`; your stored ElevenLabs key is used. The router splits `text` into sentences, serves each one your org has synthesized before from the cache and sends the rest to this endpoint with the query and body's settings, one sentence at a time, each its own cache entry: a field left out or `null` counts as ElevenLabs' default (`output_format` `mp3_44100_128`, `enable_logging` true, `model_id` `eleven_multilingual_v2`, `apply_text_normalization` `auto`, `apply_language_text_normalization` false), `previous_text` goes with the first sentence and `next_text` with the last. A body with `pronunciation_dictionary_locators` is cached by the dictionaries' ids and versions: a dictionary edited in place reaches entries cached before only when they expire. In `opus`, with `audio_effects` or with an audio tag such as `[whispers]`, the whole text is one request and one cache entry. A body the router doesn't read as one ElevenLabs accepts (a field or query parameter ElevenLabs' reference doesn't list, a value of the wrong type, a codec ElevenLabs doesn't make), or one with `previous_request_ids` or `next_request_ids`, goes to ElevenLabs verbatim, uncached, with ElevenLabs' own answer and headers. A split response carries only `Content-Type`: no one ElevenLabs request produced it, so no `request-id` or `character-cost`. The answer comes once every sentence is ready, as one object: the sentences' audio as one file of the format, and their character timings one after another, each sentence's moved on by the audio before it, with a space between sentences where the text has one. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Parameters

- `voice_id` path, string Required

#### Request body

#### Responses

- 200 Successful Response

### POST `/elevenlabs/v1/text-to-speech/{voice_id}/stream/with-timestamps` ElevenLabs: text to speech with timestamps (stream)

POST https://api.media.ttscacherouter.dev/elevenlabs/v1/text-to-speech/{voice_id}/stream/with-timestamps

Mirrors `POST https://api.elevenlabs.io/v1/text-to-speech/{voice_id}/stream/with-timestamps` (\[ElevenLabs' reference\](https://elevenlabs.io/docs/api-reference/text-to-speech/stream-with-timestamps)): the same query, body, response and errors. Send your `tcr_` key in `xi-api-key`; your stored ElevenLabs key is used. The router splits `text` into sentences, serves each one your org has synthesized before from the cache and sends the rest to this endpoint with the query and body's settings, one sentence at a time, each its own cache entry: a field left out or `null` counts as ElevenLabs' default (`output_format` `mp3_44100_128`, `enable_logging` true, `model_id` `eleven_multilingual_v2`, `apply_text_normalization` `auto`, `apply_language_text_normalization` false), `previous_text` goes with the first sentence and `next_text` with the last. A body with `pronunciation_dictionary_locators` is cached by the dictionaries' ids and versions: a dictionary edited in place reaches entries cached before only when they expire. In `opus`, with `audio_effects` or with an audio tag such as `[whispers]`, the whole text is one request and one cache entry. A body the router doesn't read as one ElevenLabs accepts (a field or query parameter ElevenLabs' reference doesn't list, a value of the wrong type, a codec ElevenLabs doesn't make), or one with `previous_request_ids` or `next_request_ids`, goes to ElevenLabs verbatim, uncached, with ElevenLabs' own answer and headers. A split response carries only `Content-Type`: no one ElevenLabs request produced it, so no `request-id` or `character-cost`. ElevenLabs' objects stream back sentence by sentence, each sentence's character timings moved on by the audio before it (a space before its characters where the text has one); a later sentence that fails breaks the body off. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Parameters

- `voice_id` path, string Required

#### Request body

#### Responses

- 200 Successful Response

### POST `/elevenlabs/v1/text-to-dialogue/stream` ElevenLabs: text to dialogue (stream)

POST https://api.media.ttscacherouter.dev/elevenlabs/v1/text-to-dialogue/stream

Mirrors `POST https://api.elevenlabs.io/v1/text-to-dialogue/stream` (\[ElevenLabs' reference\](https://elevenlabs.io/docs/api-reference/text-to-dialogue/stream)): the same query, body, response and errors. Send your `tcr_` key in `xi-api-key`; your stored ElevenLabs key is used. With one input, the router splits its text into sentences, serves each one your org has synthesized before from the cache and sends the rest to this endpoint as one input each, with the query and body's settings, one sentence at a time, each its own cache entry; a field left out or `null` counts as ElevenLabs' default (`output_format` `mp3_44100_128`, `enable_logging` true, `model_id` `eleven_v3`, `apply_text_normalization` `auto`), `previous_text` goes with the first sentence and `future_text` with the last; the audio streams back as each sentence is ready. Several inputs (a dialogue's turns are made together), `opus`, `audio_effects` or an audio tag such as `[laughs]` make the request one request and one cache entry. A body the router doesn't read as one ElevenLabs accepts, or one with `previous_request_ids` or `next_request_ids`, goes to ElevenLabs verbatim, uncached, with ElevenLabs' own answer and headers. A split response carries only `Content-Type`. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Request body

#### Responses

- 200 Successful Response

### GET `/elevenlabs/v1/voices` ElevenLabs: list voices

GET https://api.media.ttscacherouter.dev/elevenlabs/v1/voices

Mirrors `GET https://api.elevenlabs.io/v1/voices` (\[ElevenLabs' reference\](https://elevenlabs.io/docs/api-reference/voices/search)): the same query, response and errors. Send your `tcr_` key in `xi-api-key`; the request goes to ElevenLabs verbatim with your stored ElevenLabs key. Not cached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Responses

- 200 Successful Response

### GET `/elevenlabs/v2/voices` ElevenLabs: list voices (v2)

GET https://api.media.ttscacherouter.dev/elevenlabs/v2/voices

Mirrors `GET https://api.elevenlabs.io/v2/voices` (\[ElevenLabs' reference\](https://elevenlabs.io/docs/api-reference/voices/search)): the same query (`page_size`, `next_page_token`, `search`, `category`, `voice_type`, …), response and errors. Send your `tcr_` key in `xi-api-key`; the request goes to ElevenLabs verbatim (path, query and body) with your stored ElevenLabs key. Not cached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Responses

- 200 The provider's response

### GET `/elevenlabs/v1/voices/{voice_id}/settings` ElevenLabs: get a voice's settings

GET https://api.media.ttscacherouter.dev/elevenlabs/v1/voices/{voice_id}/settings

Mirrors `GET https://api.elevenlabs.io/v1/voices/{voice_id}/settings` (\[ElevenLabs' reference\](https://elevenlabs.io/docs/api-reference/voices/settings/get)): the voice's stored `stability`, `similarity_boost`, `style`, `speed` and `use_speaker_boost`, which a request without `voice_settings` uses. ElevenLabs answers an unknown voice with 400 `voice_not_found`. Send your `tcr_` key in `xi-api-key`; the request goes to ElevenLabs verbatim (path, query and body) with your stored ElevenLabs key. Not cached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Parameters

- `voice_id` path, string Required

#### Responses

- 200 The provider's response

### GET `/elevenlabs/v1/shared-voices` ElevenLabs: list library voices

GET https://api.media.ttscacherouter.dev/elevenlabs/v1/shared-voices

Mirrors `GET https://api.elevenlabs.io/v1/shared-voices` (\[ElevenLabs' reference\](https://elevenlabs.io/docs/api-reference/voices/voice-library/get-shared)): the voice library, with the same query (`page`, `page_size`, `search`, `language`, `gender`, `accent`, `sort`, …), response and errors. Add one to your ElevenLabs account with `POST /elevenlabs/v1/voices/add/{public_user_id}/{voice_id}`. Send your `tcr_` key in `xi-api-key`; the request goes to ElevenLabs verbatim (path, query and body) with your stored ElevenLabs key. Not cached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Responses

- 200 The provider's response

### POST `/elevenlabs/v1/voices/add/{public_user_id}/{voice_id}` ElevenLabs: add a library voice

POST https://api.media.ttscacherouter.dev/elevenlabs/v1/voices/add/{public_user_id}/{voice_id}

Mirrors `POST https://api.elevenlabs.io/v1/voices/add/{public_user_id}/{voice_id}` (\[ElevenLabs' reference\](https://elevenlabs.io/docs/api-reference/voices/voice-library/share)): adds a voice from the library (`GET /elevenlabs/v1/shared-voices`: its `public_owner_id` and `voice_id`) to your ElevenLabs account, with the same body (`new_name`, required; `bookmarked`), response (`{"voice_id"}`) and errors. It then appears in `GET /v1/voices` as `library`. Send your `tcr_` key in `xi-api-key`; the request goes to ElevenLabs verbatim (path, query and body) with your stored ElevenLabs key. Not cached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Parameters

- `public_user_id` path, string Required
- `voice_id` path, string Required

#### Request body

- `new_name` string Required
- `bookmarked` boolean

#### Responses

- 200 The provider's response

### OpenAI drop-in

### POST `/openai/v1/audio/speech` OpenAI: create speech

POST https://api.media.ttscacherouter.dev/openai/v1/audio/speech

Mirrors `POST https://api.openai.com/v1/audio/speech` (\[OpenAI's reference\](https://developers.openai.com/api/reference/resources/audio/subresources/speech/methods/create)): the same body, response and errors. Set the OpenAI SDK's (or LiveKit's OpenAI plugin's) `base_url` to `https://api.media.ttscacherouter.dev/openai/v1` and its API key to your `tcr_` key (`Authorization: Bearer`); your stored OpenAI key is used. The router splits `input` into sentences, serves each one your org has synthesized before from the cache and sends the rest to OpenAI with your settings, one sentence at a time, each its own cache entry (shared with `/v1/stream` and `/v1/audio/speech` for the same request). The audio streams back in order as one stream of `response_format` (one WAV header for `wav`), or with `stream_format: "sse"` as each sentence's `speech.audio.delta` events, then one `speech.audio.done` whose `usage` sums the tokens OpenAI spent on this request (none for a sentence from the cache), then `[DONE]`. In `opus` or `flac`, whose takes don't join into one stream, the whole `input` is one request and one cache entry. A body the router doesn't read as a request OpenAI accepts goes to OpenAI verbatim, uncached. An org out of credit is refused with HTTP 402 in the provider's error shape, code `insufficient_credits`.

#### Request body

- `input` string Required: The text to speak.
- `model` string Required: `gpt-4o-mini-tts`, `gpt-4o-mini-tts-2025-12-15`, `tts-1` or `tts-1-hd`.
- `voice` string Required: An OpenAI voice, e.g. `ash`.
- `instructions` string: How to speak; `gpt-4o-mini-tts` only.
- `response_format` "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm"
- `speed` number, ≥ 0.25, ≤ 4
- `stream_format` "audio" | "sse": `sse` streams `speech.audio.delta` events; `tts-1` and `tts-1-hd` answer with the audio instead.

#### Responses

- 200 The audio, or with \`stream_format: "sse"\` an event stream.
- 400 OpenAI refused the request
- 401 Missing or invalid API key, or no OpenAI key stored for the org (\`invalid_api_key\`)
- 402 The org is out of credit (\`insufficient_credits\`)
- 429 Your OpenAI quota is exhausted
- 502 OpenAI failed
- 504 OpenAI timed out

### Deepgram drop-in

### POST `/deepgram/v1/speak` Deepgram: Aura text to speech (REST)

POST https://api.media.ttscacherouter.dev/deepgram/v1/speak

Mirrors `POST https://api.deepgram.com/v1/speak` (\[Deepgram's reference\](https://developers.deepgram.com/reference/text-to-speech/speak-request)): the same query, body, response and errors. Set the Deepgram SDK's base URL (or LiveKit's Deepgram plugin's `base_url`) to `https://api.media.ttscacherouter.dev/deepgram/v1/speak` and its API key to your `tcr_` key (`Authorization: Token`); your stored Deepgram key is used. The router splits `text` into sentences, serves each one your org has synthesized before from the cache and sends the rest to Deepgram with your query, one sentence at a time, each its own cache entry (Aura's shared with `/v1/stream` and `/v1/audio/speech` for the same request: raw audio or MP3); a parameter left out counts as Deepgram's default. The audio streams back in order as one stream of the query's encoding (one WAV header for a `wav` container), with only `Content-Type`: no one Deepgram request produced it, so no `dg-*` headers. In `opus`, `flac` or (Flux) `aac`, whose takes don't join into one stream, or with inline pronunciation or pause controls, the whole text is one request and one cache entry. A request the router doesn't read as one Deepgram accepts (a parameter Deepgram's reference doesn't list, a repeated parameter, a `callback`, a body with fields besides `text`, text over 2,000 characters, Aura's `aac`) goes to Deepgram verbatim, uncached, with Deepgram's own headers. An org out of credit is refused with HTTP 402 in Deepgram's error shape, `err_code` `insufficient_credits`. The WebSocket at the same path is a drop-in for Deepgram's streaming API; see the docs.

#### Parameters

- `model` query, string: Deepgram's model id with its voice, e.g. `aura-2-thalia-en` (`/v1/speak`) or `flux-alexis-en` (`/v2/speak`).
- `encoding` query, "linear16" | "mulaw" | "alaw" | "mp3" | "opus" | "flac" | "aac": Deepgram's default is `mp3`.
- `container` query, "none" | "wav" | "ogg"
- `sample_rate` query, integer
- `bit_rate` query, integer
- `speed` query, number
- `mip_opt_out` query, boolean

#### Request body

- `text` string Required: The text to speak.

#### Responses

- 200 The audio, in the encoding and container the query asks for, streamed sentence by sentence.
- 400 Deepgram refused the request
- 401 A wrong or missing \`tcr_\` key (\`INVALID_AUTH\`), or no Deepgram key stored for the org
- 402 The org is out of credit (\`insufficient_credits\`)
- 403 Your Deepgram project has no access to the model
- 429 Your Deepgram quota is exhausted
- 502 Deepgram failed
- 504 Deepgram timed out

### POST `/deepgram/v2/speak` Deepgram: Flux text to speech (batch) (REST)

POST https://api.media.ttscacherouter.dev/deepgram/v2/speak

Mirrors `POST https://api.deepgram.com/v2/speak` (\[Deepgram's reference\](https://developers.deepgram.com/reference/speak/v-2/audio/generate)): the same query, body, response and errors. Set the Deepgram SDK's base URL (or LiveKit's Deepgram plugin's `base_url`) to `https://api.media.ttscacherouter.dev/deepgram/v2/speak` and its API key to your `tcr_` key (`Authorization: Token`); your stored Deepgram key is used. The router splits `text` into sentences, serves each one your org has synthesized before from the cache and sends the rest to Deepgram with your query, one sentence at a time, each its own cache entry; a parameter left out counts as Deepgram's default. The audio streams back in order as one stream of the query's encoding (one WAV header for a `wav` container), with only `Content-Type`: no one Deepgram request produced it, so no `dg-*` headers. In `opus`, `flac` or (Flux) `aac`, whose takes don't join into one stream, or with inline pronunciation or pause controls, the whole text is one request and one cache entry. A request the router doesn't read as one Deepgram accepts (a parameter Deepgram's reference doesn't list, a repeated parameter, a `callback`, a body with fields besides `text`, text over 2,000 characters, Aura's `aac`) goes to Deepgram verbatim, uncached, with Deepgram's own headers. An org out of credit is refused with HTTP 402 in Deepgram's error shape, `err_code` `insufficient_credits`. The WebSocket at the same path is a drop-in for Deepgram's streaming API; see the docs.

#### Parameters

- `model` query, string: Deepgram's model id with its voice, e.g. `aura-2-thalia-en` (`/v1/speak`) or `flux-alexis-en` (`/v2/speak`).
- `encoding` query, "linear16" | "mulaw" | "alaw" | "mp3" | "opus" | "flac" | "aac": Deepgram's default is `mp3`.
- `container` query, "none" | "wav" | "ogg"
- `sample_rate` query, integer
- `bit_rate` query, integer
- `speed` query, number
- `mip_opt_out` query, boolean

#### Request body

- `text` string Required: The text to speak.

#### Responses

- 200 The audio, in the encoding and container the query asks for, streamed sentence by sentence.
- 400 Deepgram refused the request
- 401 A wrong or missing \`tcr_\` key (\`INVALID_AUTH\`), or no Deepgram key stored for the org
- 402 The org is out of credit (\`insufficient_credits\`)
- 403 Your Deepgram project has no access to the model
- 429 Your Deepgram quota is exhausted
- 502 Deepgram failed
- 504 Deepgram timed out

### GET `/deepgram/v1/models` Deepgram: list models (Aura)

GET https://api.media.ttscacherouter.dev/deepgram/v1/models

Mirrors `GET https://api.deepgram.com/v1/models` (\[Deepgram's reference\](https://developers.deepgram.com/reference/manage/models/list)): its `tts` lists the Aura and Aura-2 voices (`canonical_name` `aura-2-thalia-en` is the router's model `aura-2` and voice `thalia-en`). Send your `tcr_` key as `Authorization: Token` (or `Bearer`); the request goes to Deepgram with your query and your stored Deepgram key. Not cached.

#### Responses

- 200 The provider's response

### GET `/deepgram/v2/models` Deepgram: list models (Flux)

GET https://api.media.ttscacherouter.dev/deepgram/v2/models

Mirrors `GET https://api.deepgram.com/v2/models`, which Deepgram doesn't document: its `tts` lists the Flux voices (`flux-alexis-en` is the router's model `flux` and voice `alexis-en`). Send your `tcr_` key as `Authorization: Token` (or `Bearer`); the request goes to Deepgram with your query and your stored Deepgram key. Not cached.

#### Responses

- 200 The provider's response

### xAI drop-in

### POST `/xai/v1/tts` xAI: text to speech (REST)

POST https://api.media.ttscacherouter.dev/xai/v1/tts

Mirrors `POST https://api.x.ai/v1/tts` (\[xAI's reference\](https://docs.x.ai/developers/rest-api-reference/inference/voice)): the same body, response and errors. Send your `tcr_` key as `Authorization: Bearer`; your stored xAI key is used. The router splits `text` into sentences, serves each one your org has synthesized before from the cache and sends the rest to xAI with the body's settings, one sentence at a time, each its own cache entry; a field left out counts as xAI's default. MP3, PCM, μ-law and A-law stream back in order as one stream of the codec, as xAI streams them; WAV, which xAI answers whole, comes once every sentence is ready, as one file with one header. The response carries only `Content-Type`: no one xAI request produced it, so no `x-trace-id`. In `opus` (an Ogg stream per request), with `with_timestamps`, or with a wrapping speech tag such as `<whisper>`, the whole text is one request and one cache entry. A body the router doesn't read as one xAI accepts (a field xAI's reference doesn't list, a value of the wrong type, a codec, sample rate or MP3 bit rate xAI doesn't make, text over 60,000 characters) goes to xAI verbatim, uncached, with xAI's own answer and `x-trace-id`. An org out of credit is refused with HTTP 402 in xAI's error shape, `code` `insufficient_credits`. The WebSocket at the same path is a drop-in for xAI's streaming API; see the docs.

#### Request body

- `text` string Required: The text to speak.
- `voice_id` string: An xAI voice, e.g. `eve` (xAI's default) or `ara`, or a custom voice id.
- `language` string Required: A BCP-47 code, e.g. `en`, or `auto`.
- `output_format` object: Left out, MP3 at 24 kHz and 128 kbps.
- `speed` number, ≥ 0.7, ≤ 1.5
- `optimize_streaming_latency` 0 | 1 | 2
- `text_normalization` boolean
- `with_timestamps` boolean: Answer JSON with base64 audio and character timings.
- `replace` object: Pronunciation replacements, phrase to spoken substitution.

#### Responses

- 200 The audio in the requested codec, or with \`with_timestamps\` a JSON envelope.
- 400 xAI refused the request, a wrong \`tcr_\` key (\`Incorrect API key provided.\`), or no xAI key stored for the org
- 401 No API key
- 402 The org is out of credit (\`insufficient_credits\`)
- 404 Unknown voice
- 429 Your xAI quota is exhausted

### GET `/xai/v1/tts/voices` xAI: list voices

GET https://api.media.ttscacherouter.dev/xai/v1/tts/voices

Mirrors `GET https://api.x.ai/v1/tts/voices` (\[xAI's reference\](https://docs.x.ai/developers/rest-api-reference/inference/voice)): the same response and errors. Send your `tcr_` key as `Authorization: Bearer`; the request goes to xAI with your stored xAI key. Not cached. An org out of credit is refused with HTTP 402 in xAI's error shape, `code` `insufficient_credits`.

#### Responses

- 200 xAI's response
- 400 A wrong \`tcr_\` key, or no xAI key stored for the org
- 401 No API key
- 402 The org is out of credit (\`insufficient_credits\`)

### GET `/xai/v1/tts/voices/{voice_id}` xAI: get a voice

GET https://api.media.ttscacherouter.dev/xai/v1/tts/voices/{voice_id}

Mirrors `GET https://api.x.ai/v1/tts/voices/{voice_id}` (\[xAI's reference\](https://docs.x.ai/developers/rest-api-reference/inference/voice)): the same response and errors. Send your `tcr_` key as `Authorization: Bearer`; the request goes to xAI with your stored xAI key. Not cached.

#### Parameters

- `voice_id` path, string Required

#### Responses

- 200 xAI's response
- 400 A wrong \`tcr_\` key, or no xAI key stored for the org
- 401 No API key
- 402 The org is out of credit (\`insufficient_credits\`)

### Soniox drop-in

### POST `/soniox/tts` Soniox: generate speech (REST)

POST https://api.media.ttscacherouter.dev/soniox/tts

Mirrors `POST https://tts-rt.soniox.com/tts` (\[Soniox's reference\](https://soniox.com/docs/api-reference/tts/generate_tts)): the same body, response and errors. Send your `tcr_` key as `Authorization: Bearer`; your stored Soniox key is used. The router splits `text` into sentences, serves each one your org has synthesized before from the cache and sends the rest to Soniox with the body's settings, one sentence at a time, each its own cache entry; a field left out counts as Soniox's default. Every format streams back in order as Soniox streams it, with the `Content-Type` Soniox answers that `audio_format` with: raw samples and MP3 frames one after another, under one WAV header for `wav` and one ID3 tag for `mp3`. The response carries only `Content-Type`. In `flac`, `opus` and `aac`, whose every Soniox response is a file of its own, the whole text is one request and one cache entry. A body the router doesn't read as one Soniox accepts (a missing required field, a field Soniox's reference doesn't list, a value of the wrong type, an unknown `audio_format`, text over 5,000 bytes) goes to Soniox verbatim, uncached, with Soniox's own answer. An org out of credit is refused with HTTP 402 in Soniox's error shape, `error_type` `insufficient_credits`. The real-time WebSocket, `/soniox/tts-websocket`, is a drop-in for Soniox's; see the docs.

#### Request body

- `model` string Required: A Soniox model, e.g. `tts-rt-v2`.
- `language` string Required: The language the text is read in, e.g. `en`.
- `voice` string Required: A Soniox voice, e.g. `Adrian`, or a cloned voice's id.
- `audio_format` "pcm_s16le" | "pcm_f32le" | "pcm_mulaw" | "pcm_alaw" | "wav" | "mp3" | "aac" | "opus" | "flac" Required
- `text` string Required: The text to speak.
- `sample_rate` integer | null: Left out, the format's default (24000; 8000 for `pcm_mulaw` and `pcm_alaw`).
- `bitrate` integer | null: `mp3`, `aac` and `opus` only, in bits per second. Left out, the format's default (128000; 64000 for `opus`).
- `speed` number | null, ≥ 0.7, ≤ 1.3
- `reduce_silence` boolean | null
- `client_reference_id` string | null, max length 256

#### Responses

- 200 The audio in the requested format, chunked.
- 400 Soniox refused the request (e.g. an unknown voice or language)
- 401 A missing or wrong \`tcr_\` key, or no Soniox key stored for the org (\`unauthenticated\`)
- 402 The org is out of credit (\`insufficient_credits\`), or your Soniox balance is exhausted
- 429 Your Soniox rate or concurrency limit

### GET `/soniox/v1/voices` Soniox: list cloned voices

GET https://api.media.ttscacherouter.dev/soniox/v1/voices

Mirrors `GET https://api.soniox.com/v1/voices` (\[Soniox's reference\](https://soniox.com/docs/api-reference/tts/voices/get_voices)): your Soniox project's cloned voices, with the same query (`limit`, `cursor`), response and errors. Send your `tcr_` key as `Authorization: Bearer`; the request goes to Soniox (`api.soniox.com`) with your query and your stored Soniox key. Not cached.

#### Responses

- 200 The provider's response

### GET `/soniox/v1/tts-models` Soniox: list models

GET https://api.media.ttscacherouter.dev/soniox/v1/tts-models

Mirrors `GET https://api.soniox.com/v1/tts-models` (\[Soniox's reference\](https://soniox.com/docs/api-reference/tts/get_tts_models)): the text-to-speech models with their languages and built-in voices. Send your `tcr_` key as `Authorization: Bearer`; the request goes to Soniox (`api.soniox.com`) with your query and your stored Soniox key. Not cached.

#### Responses

- 200 The provider's response

### Smallest AI drop-in

### POST `/smallestai/waves/v1/tts` Smallest AI: synthesize speech (REST)

POST https://api.media.ttscacherouter.dev/smallestai/waves/v1/tts

Mirrors `POST https://api.smallest.ai/waves/v1/tts` (\[Smallest AI's reference\](https://docs.smallest.ai/api-reference/models/text-to-speech/synthesize-speech)): the same body, response and errors. Send your `tcr_` key as `Authorization: Bearer`; your stored Smallest AI key is used. The router splits `text` into sentences, serves each one your org has synthesized before from the cache and sends the rest to Smallest AI with the body's settings, one sentence at a time, each its own cache entry; a `sample_rate`, `speed`, `output_format` or `math_notation` left out counts as Smallest AI's default (a `model` or `language` left out is its own setting). `session_id`, `request_id` and `word_timestamps` aren't sent and aren't part of the key; your `session_id` and `request_id` come back in `X-External-Session-Id` and `X-External-Request-Id`. With a `content_filter` that rejects, the whole text is one request and one cache entry. A body with `pronunciation_dicts` is cached by the dictionaries' ids: a dictionary edited in place reaches entries cached before only when they expire. A body the router doesn't read as one Smallest AI accepts (a field Smallest AI's reference doesn't list, a `null` or a value of the wrong type, an unknown `output_format`, text over 8,000 characters) goes to Smallest AI verbatim, uncached, with Smallest AI's own answer. An org out of credit is refused with HTTP 402 in Smallest AI's error shape, `error` `insufficient_credits`. The response comes once every sentence is ready, as one file with the `Content-Type` Smallest AI answers that `output_format` with (`application/octet-stream` for `pcm`, `audio/mpeg`, `audio/wav`, `audio/basic` for `ulaw` and `alaw`): raw samples one after another, one WAV header, MP3 frames under the first sentence's Info frame. Its MP3 sentences share the cache with `/v1/audio/speech` and `/v1/stream` at the same settings.

#### Request body

- `text` string Required: The text to speak.
- `voice_id` string Required: A Smallest AI voice of the model, e.g. `meher` (`lightning_v3.1_pro`) or `sophia` (`lightning_v3.1`), or a cloned voice's id, with the model it was cloned for.
- `model` string: `lightning_v3.1` or `lightning_v3.1_pro`. Left out, Smallest AI picks the model by the voice.
- `sample_rate` 8000 | 16000 | 24000 | 44100: Left out, Smallest AI's default (44100).
- `speed` number, ≥ 0.5, ≤ 2
- `language` string: A language code of the model, e.g. `en` or `hi`, or `auto`. Left out, Smallest AI's default.
- `output_format` "pcm" | "mp3" | "wav" | "ulaw" | "alaw"
- `pronunciation_dicts` string\[\]: Pronunciation dictionary ids, part of the cache key: a dictionary edited in place reaches cached entries only when they expire.

#### Responses

- 200 The audio in the requested format.
- 400 Smallest AI refused the request (e.g. a voice of another model, or an unsupported language or sample rate)
- 401 A missing or wrong \`tcr_\` key (\`unauthorized\`), or no Smallest AI key stored for the org (with a \`message\` that links to the dashboard)
- 402 The org is out of credit (\`insufficient_credits\`)

### POST `/smallestai/waves/v1/tts/live` Smallest AI: synthesize speech (SSE)

POST https://api.media.ttscacherouter.dev/smallestai/waves/v1/tts/live

Mirrors `POST https://api.smallest.ai/waves/v1/tts/live` (\[Smallest AI's reference\](https://docs.smallest.ai/api-reference/models/text-to-speech/synthesize-speech-sse)): the same body, server-sent events (`audio` events with base64 audio, then `done`) and errors. Send your `tcr_` key as `Authorization: Bearer`; your stored Smallest AI key is used. The router splits `text` into sentences, serves each one your org has synthesized before from the cache and sends the rest to Smallest AI with the body's settings, one sentence at a time, each its own cache entry; a `sample_rate`, `speed`, `output_format` or `math_notation` left out counts as Smallest AI's default (a `model` or `language` left out is its own setting). `session_id`, `request_id` and `word_timestamps` aren't sent and aren't part of the key; your `session_id` and `request_id` come back in `X-External-Session-Id` and `X-External-Request-Id`. With a `content_filter` that rejects, the whole text is one request and one cache entry. A body with `pronunciation_dicts` is cached by the dictionaries' ids: a dictionary edited in place reaches entries cached before only when they expire. A body the router doesn't read as one Smallest AI accepts (a field Smallest AI's reference doesn't list, a `null` or a value of the wrong type, an unknown `output_format`, text over 8,000 characters) goes to Smallest AI verbatim, uncached, with Smallest AI's own answer. An org out of credit is refused with HTTP 402 in Smallest AI's error shape, `error` `insufficient_credits`. The sentences' audio streams back as Smallest AI's `audio` events as each is ready, then `done`; a later sentence that fails breaks the stream off. Its `pcm`, `ulaw` and `alaw` sentences share the cache with `/v1/audio/speech` and `/v1/stream` at the same settings. The WebSocket at the same path, `wss://api.media.ttscacherouter.dev/smallestai/waves/v1/tts/live`, is a drop-in for Smallest AI's; see the docs.

#### Request body

- `text` string Required: The text to speak.
- `voice_id` string Required: A Smallest AI voice of the model, e.g. `meher` (`lightning_v3.1_pro`) or `sophia` (`lightning_v3.1`), or a cloned voice's id, with the model it was cloned for.
- `model` string: `lightning_v3.1` or `lightning_v3.1_pro`. Left out, Smallest AI picks the model by the voice.
- `sample_rate` 8000 | 16000 | 24000 | 44100: Left out, Smallest AI's default (44100).
- `speed` number, ≥ 0.5, ≤ 2
- `language` string: A language code of the model, e.g. `en` or `hi`, or `auto`. Left out, Smallest AI's default.
- `output_format` "pcm" | "mp3" | "wav" | "ulaw" | "alaw"
- `pronunciation_dicts` string\[\]: Pronunciation dictionary ids, part of the cache key: a dictionary edited in place reaches cached entries only when they expire.

#### Responses

- 200 Server-sent events: \`audio\` events, each \`{"audio": \<base64>, "done": false}\`, then \`{"done": true}\`.
- 400 Smallest AI refused the request (e.g. a voice of another model, or an unsupported language or sample rate)
- 401 A missing or wrong \`tcr_\` key (\`unauthorized\`), or no Smallest AI key stored for the org (with a \`message\` that links to the dashboard)
- 402 The org is out of credit (\`insufficient_credits\`)

### GET `/smallestai/waves/v1/{model}/get_voices` Smallest AI: list voices

GET https://api.media.ttscacherouter.dev/smallestai/waves/v1/{model}/get_voices

Mirrors `GET https://api.smallest.ai/waves/v1/{model}/get_voices` (\[Smallest AI's reference\](https://docs.smallest.ai/api-reference/models/text-to-speech/get-waves-voices)): a model's voices, with the same response and errors. Send your `tcr_` key as `Authorization: Bearer`; the request goes to Smallest AI. Not cached.

#### Parameters

- `model` path, string Required: The model's id in Smallest AI's voice paths: `lightning-v3.1` or `lightning-v3.1-pro`.

#### Responses

- 200 Smallest AI's response

### GET `/smallestai/waves/v1/voice-cloning` Smallest AI: list cloned voices

GET https://api.media.ttscacherouter.dev/smallestai/waves/v1/voice-cloning

Mirrors `GET https://api.smallest.ai/waves/v1/voice-cloning` (\[Smallest AI's reference\](https://docs.smallest.ai/api-reference/models/text-to-speech/list-voice-clones)): your Smallest AI account's voice clones, with the same response and errors. Send your `tcr_` key as `Authorization: Bearer`; the request goes to Smallest AI with your stored Smallest AI key. Not cached.

#### Responses

- 200 Smallest AI's response

### Cartesia drop-in

### POST `/cartesia/tts/bytes` Cartesia: synthesize speech (bytes)

POST https://api.media.ttscacherouter.dev/cartesia/tts/bytes

Mirrors `POST https://api.cartesia.ai/tts/bytes` (\[Cartesia's reference\](https://docs.cartesia.ai/api-reference/tts/bytes)): the same body, response and errors. Send your `tcr_` key as `X-API-Key` or `Authorization: Bearer`; your stored Cartesia key is used. The router splits `transcript` into sentences, serves each one your org has synthesized before from the cache and sends the rest to Cartesia with the body's settings and API version, one sentence at a time, each its own cache entry (the API version is part of the key); a field left out or `null` counts as Cartesia's default (`normalization` `auto`, a `generation_config` `speed` or `volume` of 1, `save` off), and a voice is the same however it is named (a string, `{"id"}`, `{"mode": "id", "id"}`); a `language` left out is its own setting. A transcript with a `speed`, `volume`, `emotion` or `spell` tag, which reaches past where it stands, is one request and one cache entry. A body with `pronunciation_dict_id` is cached by the dictionary's id: a dictionary edited in place reaches entries cached before only when they expire. A body the router doesn't read as one Cartesia accepts (no `Cartesia-Version`, a field Cartesia's reference doesn't list, a value of the wrong type, an `output_format` missing a field Cartesia requires, `save: true`) goes to Cartesia verbatim, uncached, with Cartesia's own answer. An org out of credit is refused with HTTP 402 in Cartesia's error shape. The sentences' audio streams back as each is ready, as one stream with the `Content-Type` Cartesia answers that container with (`audio/pcm`, `audio/wav`, `audio/mpeg`): raw samples one after another, one WAV header, one MP3 tag; a later sentence that fails breaks the body off. Its `mp3` sentences under API version `2025-04-16` share the cache with `/v1/audio/speech` and `/v1/stream` at the same settings.

#### Parameters

- `Cartesia-Version` header, string Required: Cartesia's API version, as Cartesia takes it. Errors are plain `Title: Message` text before 2026-03-01 and JSON from it on, as Cartesia's.

#### Request body

- `transcript` string Required: The text to speak.
- `model_id` string Required: A Cartesia model, e.g. `sonic-3.6`, `sonic-3` or a dated snapshot.
- `voice` any Required: A voice id, or `{"mode": "id", "id": …}` as older API versions take it.
- `output_format` object Required: `{"container": "raw" | "wav" | "mp3", "encoding", "sample_rate", "bit_rate"}`, as Cartesia takes it.
- `language` string
- `generation_config` object: `speed`, `volume` and `emotion`, as Cartesia takes them.
- `pronunciation_dict_id` string: Part of the cache key: a dictionary edited in place reaches cached entries only when they expire.

#### Responses

- 200 The audio in the requested format.
- 400 Cartesia refused the request (e.g. an unsupported model, voice or format)
- 401 A missing or wrong \`tcr_\` key, or no Cartesia key stored for the org
- 402 The org is out of credit

### POST `/cartesia/tts/sse` Cartesia: synthesize speech (SSE)

POST https://api.media.ttscacherouter.dev/cartesia/tts/sse

Mirrors `POST https://api.cartesia.ai/tts/sse` (\[Cartesia's reference\](https://docs.cartesia.ai/api-reference/tts/sse)): the same body, events and errors. Send your `tcr_` key as `X-API-Key` or `Authorization: Bearer`; your stored Cartesia key is used. The router splits `transcript` into sentences, serves each one your org has synthesized before from the cache and sends the rest to Cartesia with the body's settings and API version, one sentence at a time, each its own cache entry (the API version is part of the key); a field left out or `null` counts as Cartesia's default (`normalization` `auto`, a `generation_config` `speed` or `volume` of 1, `add_timestamps` and `add_phoneme_timestamps` off), and a voice is the same however it is named (a string, `{"id"}`, `{"mode": "id", "id"}`); a `language` left out is its own setting. A transcript with a `speed`, `volume`, `emotion` or `spell` tag, which reaches past where it stands, is one request and one cache entry. A body with `pronunciation_dict_id` is cached by the dictionary's id: a dictionary edited in place reaches entries cached before only when they expire. A body the router doesn't read as one Cartesia accepts (no `Cartesia-Version`, a field Cartesia's reference doesn't list, a value of the wrong type, an `output_format` missing a field Cartesia requires) goes to Cartesia verbatim, uncached, with Cartesia's own answer. An org out of credit is refused with HTTP 402 in Cartesia's error shape. `context_id` isn't sent and isn't part of the key; every event carries yours. The sentences' events stream back as each is ready (`chunk`, `timestamps`, `phoneme_timestamps`), word and phoneme timestamps running on across the response as one request's do, then one `done`; a later sentence that fails ends the stream with an `error` event.

#### Parameters

- `Cartesia-Version` header, string Required: Cartesia's API version, as Cartesia takes it. Errors are plain `Title: Message` text before 2026-03-01 and JSON from it on, as Cartesia's.

#### Request body

- `transcript` string Required: The text to speak.
- `model_id` string Required: A Cartesia model, e.g. `sonic-3.6`, `sonic-3` or a dated snapshot.
- `voice` any Required: A voice id, or `{"mode": "id", "id": …}` as older API versions take it.
- `output_format` object Required: `{"container": "raw", "encoding", "sample_rate"}`, as Cartesia takes it: the SSE makes raw audio only.
- `language` string
- `generation_config` object: `speed`, `volume` and `emotion`, as Cartesia takes them.
- `pronunciation_dict_id` string: Part of the cache key: a dictionary edited in place reaches cached entries only when they expire.
- `add_timestamps` boolean: Word timestamps as `timestamps` events.
- `context_id` string: Echoed in the events; not part of the cache key.

#### Responses

- 200 Cartesia's events.
- 400 Cartesia refused the request
- 401 A missing or wrong \`tcr_\` key, or no Cartesia key stored for the org
- 402 The org is out of credit

### GET `/cartesia/voices` Cartesia: list voices

GET https://api.media.ttscacherouter.dev/cartesia/voices

Mirrors `GET https://api.cartesia.ai/voices` (\[Cartesia's reference\](https://docs.cartesia.ai/api-reference/voices/list)): the same query, response and errors, with your stored Cartesia key. Not cached.

#### Responses

- 200 Cartesia's response

### GET `/cartesia/voices/{id}` Cartesia: get a voice

GET https://api.media.ttscacherouter.dev/cartesia/voices/{id}

Mirrors `GET https://api.cartesia.ai/voices/{id}` (\[Cartesia's reference\](https://docs.cartesia.ai/api-reference/voices/get)), with your stored Cartesia key. Not cached.

#### Parameters

- `id` path, string Required: The voice's id.

#### Responses

- 200 Cartesia's response

### Gemini drop-in

### POST `/gemini/v1beta/models/{model}:streamGenerateContent` Gemini: generate speech (streamed)

POST https://api.media.ttscacherouter.dev/gemini/v1beta/models/{model}:streamGenerateContent

Mirrors `POST https://generativelanguage.googleapis.com/v1beta/models/{model}:streamGenerateContent` (\[Gemini's reference\](https://ai.google.dev/api/generate-content#method:-models.streamgeneratecontent)): the same body, events and errors. Send your `tcr_` key as `x-goog-api-key` or `?key=`; Gemini gets your stored Gemini key. With `alt=sse`, the router splits the text into sentences and serves each from the cache or synthesizes it at Gemini with the body's settings, one at a time, streaming each sentence's audio as Gemini's events (`inlineData` parts) as it comes, then a last event with `finishReason: STOP` and the `usageMetadata` Gemini spent on this request (a sentence from the cache spends none). A 2.5 or 3.1 request whose text isn't in LiveKit's plugin's prompt form (`<instructions>:\n"<text>"`), or names speakers, is one cache entry, unsplit. A body the router doesn't read as a speech request, and a stream without `alt=sse`, go to Gemini as sent and aren't cached.

#### Parameters

- `model` path, string Required: A Gemini model, passed through (any model Gemini serves).
- `alt` query, "sse": `sse`, as Google's SDK sends it.

#### Request body

- `contents` object\[\] Required: As Gemini takes them. A request is split and cached when it has one content of one text part (what Google's SDK sends for a string), with an optional `speech_metadata` (`style`, `speaker`); anything else goes to Gemini as sent.
- `generationConfig` object: `responseModalities: ["AUDIO"]`, `speechConfig` and, for the 3.8 models, `response_format`, as Gemini takes them.

#### Responses

- 200 Gemini's events: each \`data:\` line a response whose parts carry base64 audio.
- 400 Gemini refused the request (e.g. an unknown voice or format), or a wrong \`tcr_\` key or no Gemini key stored for the org (\`API_KEY_INVALID\`)
- 402 The org is out of credit
- 403 No \`tcr_\` key (\`PERMISSION_DENIED\`)

### POST `/gemini/v1beta/models/{model}:generateContent` Gemini: generate speech

POST https://api.media.ttscacherouter.dev/gemini/v1beta/models/{model}:generateContent

Mirrors `POST https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent` (\[Gemini's reference\](https://ai.google.dev/api/generate-content#method:-models.generatecontent)): the same body, response and errors, with your stored Gemini key. The router splits the text into sentences as on `streamGenerateContent` and answers with one response once every sentence is ready: their audio in one part, and the `usageMetadata` Gemini spent on this request. A 3.8 request in its default WAV is one cache entry, unsplit: ask for `AUDIO_L16`, `AUDIO_MULAW` or `AUDIO_ALAW` in `generationConfig.response_format`.

#### Parameters

- `model` path, string Required: A Gemini model, passed through (any model Gemini serves).

#### Request body

- `contents` object\[\] Required: As Gemini takes them. A request is split and cached when it has one content of one text part (what Google's SDK sends for a string), with an optional `speech_metadata` (`style`, `speaker`); anything else goes to Gemini as sent.
- `generationConfig` object: `responseModalities: ["AUDIO"]`, `speechConfig` and, for the 3.8 models, `response_format`, as Gemini takes them.

#### Responses

- 200 Gemini's response: its part carries the base64 audio.
- 400 Gemini refused the request (e.g. an unknown voice or format), or a wrong \`tcr_\` key or no Gemini key stored for the org (\`API_KEY_INVALID\`)
- 402 The org is out of credit
- 403 No \`tcr_\` key (\`PERMISSION_DENIED\`)

### GET `/gemini/v1beta/voices` Gemini: list voices

GET https://api.media.ttscacherouter.dev/gemini/v1beta/voices

Mirrors `GET https://generativelanguage.googleapis.com/v1beta/voices` (\[Gemini's reference\](https://ai.google.dev/gemini-api/docs/speech-generation#voices)): the same query, response and errors, with your stored Gemini key. Not cached.

#### Responses

- 200 Gemini's response

### GET `/gemini/v1beta/models` Gemini: list models

GET https://api.media.ttscacherouter.dev/gemini/v1beta/models

Mirrors `GET https://generativelanguage.googleapis.com/v1beta/models` (\[Gemini's reference\](https://ai.google.dev/api/models#method:-models.list)): the same query, response and errors, with your stored Gemini key. Not cached.

#### Responses

- 200 Gemini's response

### GET `/gemini/v1beta/models/{model}` Gemini: get a model

GET https://api.media.ttscacherouter.dev/gemini/v1beta/models/{model}

Mirrors `GET https://generativelanguage.googleapis.com/v1beta/models/{model}` (\[Gemini's reference\](https://ai.google.dev/api/models#method:-models.get)): the same query, response and errors, with your stored Gemini key. Not cached.

#### Parameters

- `model` path, string Required: A Gemini model, passed through (any model Gemini serves).

#### Responses

- 200 Gemini's response

## OpenAPI document

The whole HTTP API as OpenAPI 3.1, for code generators and API clients. The WebSocket protocol has [its own page](https://docs.ttscacherouter.dev/clients/stream.md).

```shell
curl https://api.ttscacherouter.dev/openapi.json
```

It also lists the dashboard’s session endpoints (`/api/…`), which take the dashboard’s sign-in cookie rather than an API key and aren’t meant for your code.
