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

# HTTP examples

> Generate speech audio with the SLNG TTS HTTP API. Code samples in curl, Python, and Node.js for basic requests, voice selection, and streaming responses.

> [!TIP]
>
> Want to try TTS without setting up code? [Open the live demo](https://examples-gbcy.onrender.com) and test different models and voices in your browser.

These examples use the Deepgram Aura model; swap the endpoint path to use a different provider.

## 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) |

## Basic Request

Send text and receive a complete audio file in WAV format:

```bash cURL theme={null}
curl https://api.slng.ai/v1/tts/slng/deepgram/aura:2-en \
  -H "Authorization: Bearer SLNG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "aura-2-thalia-en",
    "text": "Hello from sunny Barcelona!"
  }' \
  --output hello.wav
```

```javascript JavaScript theme={null}
const response = await fetch(
  "https://api.slng.ai/v1/tts/slng/deepgram/aura:2-en",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer SLNG_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: "aura-2-thalia-en",
      text: "Hello from sunny Barcelona!",
    }),
  },
);

const audioData = await response.arrayBuffer();
// Play or save audioData
```

```python Python theme={null}
import requests

url = "https://api.slng.ai/v1/tts/slng/deepgram/aura:2-en"
headers = {
    "Authorization": "Bearer SLNG_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "model": "aura-2-thalia-en",
    "text": "Hello from sunny Barcelona!",
}

response = requests.post(url, headers=headers, json=data)
audio_data = response.content

# Save to file
with open("output.wav", "wb") as f:
    f.write(audio_data)
```

It will sound like this:

Hello from sunny Barcelona!

[Download](https://slng.mintlify.site/audio/hello.wav)

<audio controls preload="metadata" aria-label="Hello from sunny Barcelona!" src="https://slng.mintlify.site/audio/hello.wav">Your browser does not support the audio element.</audio>

***

## More Examples

### With Voice Selection (Deepgram Aura)

Beyond the audio generation, each model supports different parameters.

For example, to specify a voice in Deepgram Aura:

```bash highlight={6} theme={null}
curl https://api.slng.ai/v1/tts/slng/deepgram/aura:2-en \
  -H "Authorization: Bearer SLNG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from sunny Barcelona!",
    "model": "aura-2-theia-en"
  }' \
  --output hello-theia.wav
```

For the complete parameter reference, see the [Text-to-Speech](https://slng.mintlify.site/api-reference/tts/deepgram-aura-2/aura-2-english-ws.md) API reference.

### With a Different Model

Each model has its own endpoint and may use different parameters. For example, Rime Arcana uses `speaker` instead of `model`:

```bash highlight={1} theme={null}
curl https://api.slng.ai/v1/tts/slng/rime/arcana:3-en \
  -H "Authorization: Bearer SLNG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from Rime Arcana!",
    "speaker": "astra"
  }' \
  --output hello-arcana.wav
```

For all available models, endpoints, and their parameters, see the [TTS models page](https://slng.mintlify.site/models/tts.md).

To control how brand names, acronyms, and domain-specific terms are spoken, add a [pronunciation dictionary](https://slng.mintlify.site/pronunciation-dictionaries.md) to your TTS request.

For voice catalogs with audio samples, browse the [Voices](https://slng.mintlify.site/voices/deepgram-aura.md) section in the sidebar.

***

## Next Steps

> **[Live TTS demo](https://examples-gbcy.onrender.com)**
>
> Try TTS in your browser, no setup needed

> **[TTS WebSocket examples](https://slng.mintlify.site/examples/tts-websocket.md)**
>
> Stream audio in real time for voice agents

> **[Text-to-Speech models](https://slng.mintlify.site/models/tts.md)**
>
> Browse all TTS models and endpoints

> **[Pronunciation dictionaries](https://slng.mintlify.site/pronunciation-dictionaries.md)**
>
> Reuse pronunciation rules across TTS requests

> **[TTS API reference](https://slng.mintlify.site/api-reference/tts/deepgram-aura-2/aura-2-english-ws.md)**
>
> Endpoint-specific parameters


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.