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

# BYOK Voice Models

> Pass your own provider key on requests so billing runs against your provider account, while the SLNG cache still applies on top.

If you already have a contract with a text-to-speech provider, you can keep it. Bring Your Own Key (BYOK) lets you pass your own provider key on requests. Your key is forwarded upstream, so billing and rate limits run against your provider account, and [TTS Path Optimization](/execution-layer/tts-path-optimization) still applies on top.

## Placeholders

The snippets below use these placeholders. Replace them before running the code.

| Placeholder         | Replace with                                                          |
| ------------------- | --------------------------------------------------------------------- |
| `SLNG_API_KEY`      | An SLNG key from [app.slng.ai/api-keys](https://app.slng.ai/api-keys) |
| `YOUR_PROVIDER_KEY` | A provider key issued by the upstream TTS provider you are calling    |

## How Path Optimization applies

TTS path optimization runs before your request is forwarded, so a cache hit never reaches the upstream provider:

* **Cache hit**: the cached audio is returned, no provider call, and no billing event.
* **Cache miss**: the request is sent upstream with your key, the provider bills your account, and the response is cached for future requests.

## Supported providers

| Provider | Model                                                                                                                                                                  |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Cartesia | [Sonic 3](/api-reference/tts/cartesia-sonic-3/cartesia-sonic-3-ws)                                                                                                     |
| Deepgram | [Aura 2](/api-reference/tts/deepgram-aura-2/aura-2-english-ws)                                                                                                         |
| Kugel    | [Kugel 1 Turbo](/api-reference/tts/kugel-1-turbo/kugel-1-turbo-ws), [Kugel 1](/api-reference/tts/kugel-1/kugel-1-ws), [Kugel 2](/api-reference/tts/kugel-2/kugel-2-ws) |
| Murf     | [Falcon](/api-reference/tts/murf-falcon/murf-falcon-ws)                                                                                                                |
| Sarvam   | [Bulbul](/api-reference/tts/sarvam-ai-bulbul-v3/bulbul-v3-ws)                                                                                                          |
| Soniox   | [TTS RT v1](/api-reference/tts/soniox-tts-v1/soniox-tts-v1-ws)                                                                                                         |
| Gradium  | [Gradium TTS v1](/api-reference/tts/gradium-tts/gradium-tts-default-ws)                                                                                                |

## Send a BYOK request

Add the `X-Slng-Provider-Key` header alongside your standard SLNG `Authorization` header.

### HTTP

```bash highlight={3} theme={null}
curl -X POST "https://api.slng.ai/v1/tts/sarvam/bulbul:v3" \
  -H "Authorization: Bearer SLNG_API_KEY" \
  -H "X-Slng-Provider-Key: YOUR_PROVIDER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "I brought my own key to the party.",
    "target_language_code": "en-IN",
    "speaker": "shubh",
    "model": "bulbul:v3"
  }'
```

### WebSocket

Set `X-Slng-Provider-Key` as a header on the WebSocket upgrade request. The message flow after the upgrade is unchanged.

```http theme={null}
X-Slng-Provider-Key: YOUR_PROVIDER_KEY
```

<Note>
  The browser WebSocket API does not support custom headers. Set the provider key from a server-side WebSocket client.
</Note>

## Error handling

### HTTP

If the upstream provider rejects your key, the provider's error response is returned with this header:

```http theme={null}
X-Slng-Auth-Source: client_key
```

That header tells you the failure came from your provider key, not from SLNG.

### WebSocket

Auth failures surface as a WebSocket error frame after the upgrade is accepted, for example `backend_connection_failed`, with the upstream 401 or 403 detail included.

## Next steps

<CardGroup cols={2}>
  <Card title="Pronunciation Dictionaries" icon="database" href="/execution-layer/integration-guide">
    How structured output helps for better TTS behaviour
  </Card>

  <Card title="Drop-in gateway" icon="plug" href="/integrations/gateway">
    Route your existing stack through SLNG.
  </Card>
</CardGroup>
