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

# Speech generation

> Turn text into audio through the API.

Use your [API key](/authentication) to generate narration, ad reads or spoken translations. For Claude or another agent, use [MCP voiceovers](/mcp/voiceovers).

## Generate an MP3

```bash cURL theme={null}
curl --fail-with-body https://www.ninjachat.ai/api/v1/audio/speech \
  -H "Authorization: Bearer $NINJACHAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"tts-1-hd","input":"Welcome to your next idea.","voice":"nova","response_format":"mp3"}' \
  --output narration.mp3
```

A successful response contains **audio bytes**, not a JSON URL. Errors return JSON. Response headers include `X-Request-ID` and `X-NinjaChat-Cost-USD`.

## Options

| Parameter         | Values                                                                                   |
| ----------------- | ---------------------------------------------------------------------------------------- |
| `model`           | Required: `tts-1` or `tts-1-hd`.                                                         |
| `input`           | Required: 1–4,096 characters.                                                            |
| `voice`           | Required: `alloy`, `ash`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage` or `shimmer`. |
| `response_format` | `mp3` (default), `opus`, `aac`, `flac`, `wav` or `pcm`.                                  |
| `speed`           | 0.25–4; default 1.                                                                       |

The REST API supports more audio formats than the MCP tool. Audio charges use your Developer Balance and are based on script length.
