Skip to main content
Send text, a model and a voice to POST /v1/audio/speech, and NagaAI answers with the audio file itself. The endpoint follows the OpenAI Audio format, so the OpenAI SDK works unchanged. Choose a model whose operations include speech in GET /v1/models. Several families serve speech, for example eleven-v3, eleven-multilingual-v2 and the Gemini TTS models, and the examples below use eleven-v3.

Generate speech

The body of the response is the audio file, not JSON, and its Content-Type header names the format. Listen to a sample.

Choose a voice

Each model has its own voices, and voice is required. OpenAI voice names such as alloy and nova also work on ElevenLabs, Voxtral and Gemini TTS models, where NagaAI maps them to similar voices. If you want a specific voice on one of those models, use the name that model documents. instructions gives style directions such as pace or mood, on models that support them. speed is a multiplier of the model’s normal pace and must be greater than 0.

Choose a format

response_format is mp3 (default), opus, aac, flac, wav or pcm. Not every model produces every format, and a format the model cannot produce fails with 400: pcm is raw 24 kHz, 16-bit signed little-endian mono samples with no header, so wrap it in a WAV container before you play it.

Know the limits

input takes up to 32,768 characters. For longer text, split it at sentence boundaries and join the audio files. Each model’s pricing in GET /v1/models says what NagaAI counts for it. See Models for how to read the rows.

Troubleshooting

400 on response_format

The model cannot produce that format. Choose a format that your model produces, or omit the field to get the model’s default format.

400 with String should have at most 32768 characters

The text in input is too long. Split it into several requests.

400 with Input should be greater than 0

speed must be a number above zero.

400 model_not_found

The model does not exist or has no speech operation. Check its operations in GET /v1/models.

402 insufficient_quota

The balance is too low for a paid model. Add credits and send the request again.