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

> ## Agent Instructions
> The Venice API is OpenAI-compatible: use any OpenAI SDK with the base URL `https://api.venice.ai/api/v1` and a Venice API key, or pay per request from a USDC wallet through x402 with no account.
> Read model IDs from `GET /models` or `GET /models/traits` at runtime instead of hardcoding them from memory or from these pages. Models are added and retired often.
> Every model's price is in https://docs.venice.ai/pricing.md. Quote video and audio jobs with `POST /video/quote` or `POST /audio/quote` before you queue them.
> Search these docs from an MCP client at https://docs.venice.ai/mcp. The full agent guide is https://docs.venice.ai/agents.md.

# Text-to-Speech

> Generate spoken audio from text with Venice text-to-speech models and /audio/speech.

Text-to-speech turns written text into spoken audio. Choose a TTS model, select a voice supported by that model, send text to `/audio/speech`, and save the binary audio response.

Use this guide for standard voice generation. If you want to create speech from a custom reference voice, see [Voice Cloning](https://docs.venice.ai/guides/media/voice-cloning.md).

## Basic Usage

```python Python theme={"system"}
import os
from pathlib import Path

import requests

response = requests.post(
    "https://api.venice.ai/api/v1/audio/speech",
    headers={
        "Authorization": f"Bearer {os.environ['VENICE_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "model": "tts-kokoro",
        "voice": "af_sky",
        "input": "Hello, welcome to Venice Voice.",
    },
)

response.raise_for_status()
Path("speech.mp3").write_bytes(response.content)
```

```javascript Node.js theme={"system"}
import { writeFile } from "node:fs/promises";

const response = await fetch("https://api.venice.ai/api/v1/audio/speech", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.VENICE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "tts-kokoro",
    voice: "af_sky",
    input: "Hello, welcome to Venice Voice.",
  }),
});

if (!response.ok) {
  throw new Error(await response.text());
}

await writeFile("speech.mp3", Buffer.from(await response.arrayBuffer()));
```

```bash cURL theme={"system"}
curl https://api.venice.ai/api/v1/audio/speech \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tts-kokoro",
    "voice": "af_sky",
    "input": "Hello, welcome to Venice Voice."
  }' \
  --output speech.mp3
```

The successful response body is binary audio in the model's default format, not JSON. `tts-kokoro` currently defaults to MP3.

## Choose a Model and Voice

Voices are model-specific. The `voice` value must be valid for the `model` you choose.

Use the [Text-to-Speech Models](https://docs.venice.ai/models/text-to-speech.md) page to browse available models and voices. The voice picker lists the exact voice IDs to pass in your request.

> [!NOTE]
>
> Voice IDs are case-sensitive. If you switch TTS models, update the `voice` value at the same time.

## Request Shape

| Parameter | Type | Required | Description |
| - | - | - | - |
| `model` | string | Yes | Text-to-speech model ID. |
| `voice` | string | No | Voice ID supported by the selected model. Default: model-specific (Kokoro uses `af_sky`). |
| `input` | string | Yes | Text to synthesize, up to 4096 characters. |
| `response_format` | string | No | Requested output format: `mp3`, `opus`, `aac`, `flac`, `wav`, or `pcm`. Supported formats and the default are model-specific. |

## Output Format

You can omit `response_format` to use the model's default. Before choosing a file extension or overriding the format, query the Models API for the model's current `default_format` and `supported_formats`:

```bash theme={"system"}
curl "https://api.venice.ai/api/v1/models?type=tts" \
  -H "Authorization: Bearer $VENICE_API_KEY" |
  jq '.data[] | select(.id == "tts-kokoro") | .model_spec | {default_format, supported_formats}'
```

The response `Content-Type` identifies the returned audio format. Requesting a format that the selected model does not support returns HTTP `400`.

## Production Tips

* Cache generated audio when the source text and voice are reused.
* Normalize and proofread text before synthesis. Punctuation affects pacing and intonation.
* Store output with the correct file extension for the model's response format.

## Related Resources

> [!TIP]
>
> Narrating something longer than a few sentences? [Narrating Articles with Text-to-Speech](https://docs.venice.ai/guides/media/article-narration.md) covers the 4096-character input cap, splitting text on sentence boundaries, joining the pieces into one audio file, and streaming for interactive playback.

* [Audio Speech API](https://docs.venice.ai/api-reference/endpoint/audio/speech.md)
* [Text-to-Speech Models](https://docs.venice.ai/models/text-to-speech.md)
* [Narrating Articles with Text-to-Speech](https://docs.venice.ai/guides/media/article-narration.md)
* [Voice Cloning Guide](https://docs.venice.ai/guides/media/voice-cloning.md)


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