Generate Speech
Turn text into spoken audio through nRouter with one POST to /v1/audio/speech, using the same key, budgets, and request logs as your chat traffic.
Turn text into spoken audio with one POST to /v1/audio/speech. Send the text and a voice; the response is the audio file. Speech runs through the same key, budgets, and request logs as your chat traffic.
Send the request
curl -X POST https://api.nrouter.ai/v1/audio/speech \
-H "Authorization: Bearer $NROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"input": "Your order has shipped.",
"voice": "onyx",
"response_format": "mp3"
}' \
--output speech.mp3response_format defaults to mp3; opus, aac, flac, wav, and pcm are also supported.
Voices, speed, and length
The voices are alloy, echo, fable, onyx, nova, and shimmer. The speed field sets the playback rate from 0.25 (slowest) to 4.0 (fastest) and defaults to 1.0. One request takes up to 4,096 characters of input — longer text is rejected with HTTP 400, so split long passages into chunks and stitch the resulting audio files in order.
Choose the format for where the audio plays, not just for file size:
mp3— universal playback in browsers and mobile apps (the default)opus— low-bitrate streaming, VoIP, and WebRTC pipelinesaac— playback across iOS and Apple ecosystemsflac— lossless audio for archival and post-processingwav— uncompressed audio for players that should not spend time decodingpcm— raw 24 kHz 16-bit samples for digital signal processing
What you get back
The response is the audio file itself, in the format you requested — save it, stream it, or hand it to your player. The call appears in your request logs with its exact cost, like any other request. The full field list lives in the Audio Speech API reference, and errors use the same shape as everywhere — see Errors & Rate Limits.
FAQ
Next steps
- Audio Speech API — The full request and response reference
- Generate Images — One-POST image generation
- Errors & Rate Limits — Every status, code, and retry rule