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

# Audio Speech

> Convert text to audio

## Headers

**Authorization** `string` *required*

Bearer token authentication. Format: `Authorization: Bearer sk-xxxxxx`

## Body

Format: `application/json`

**model** `string` *required*

Model ID

**input** `string` *required*

Text to convert, up to 4096 characters

**voice** `string` *required*

Voice, allowed values: `alloy`, `echo`, `fable`, `onyx`, `nova`, `shimmer`

**response\_format** `string` (default: mp3)

Audio output format, allowed values: `mp3`, `opus`, `aac`, `flac`, `wav`, `pcm`

**speed** `number` (default: 1)

Speech speed, range `0.25` to `4`

## Response

### 200 Success

Format: `audio/mpeg`

**response** `file`

Audio file

Format: `binary`

```bash cURL theme={"dark"}
curl -X POST "https://t.ato2.nodesms.com/v1/audio/speech" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tts-1",
    "input": "The quick brown fox jumped over the lazy dog.",
    "voice": "alloy"
  }' \
  --output speech.mp3
```

```python Python theme={"dark"}
from openai import OpenAI

client = OpenAI(
    api_key="sk-xxxxxx",
    base_url="https://t.ato2.nodesms.com/v1"
)

response = client.audio.speech.create(
    model="tts-1",
    voice="alloy",
    input="The quick brown fox jumped over the lazy dog."
)
response.stream_to_file("speech.mp3")
```

```text 200 theme={"dark"}
(audio binary data, Content-Type: audio/mpeg)
```


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