Skip to main content
For coding agents, discover the current recommended TTS shortlist first with GET /v1/models?recommended_for=tts, then send the selected model explicitly to this endpoint.

Request Body

Synchronous request timeout: This non-chat endpoint waits for the routed model to finish. Large inputs, long audio, or large batches can exceed common 30s client defaults, so set your HTTP client timeout to at least 120s. Supported optional fields vary by model family. AI Sonar validates this field matrix before routing: OpenAI TTS accepts voice, instructions, response_format, stream_format, and speed; MiniMax speech accepts voice, voice_id, response_format, stream_format, and speed; Gemini TTS accepts prompt, language_code, voice, response_format, stream_format, speed, and temperature; narrower Vidu/Kling-style TTS routes may accept only input and stream_format. Unknown top-level fields, including user, return 400 unsupported_parameter instead of being ignored.
string
default:"tts-1"
TTS model. Examples include tts-1, gpt-4o-mini-tts, speech-02-hd, and gemini-2.5-flash-tts. Query GET /v1/models?recommended_for=tts for the current shortlist.
string
required
The text to generate audio for. Maximum 4096 characters.
string | object
Voice selector. Pass a built-in voice name such as nova, a Gemini voice such as Kore, or an object like { "id": "voice-id" } for compatible custom voices.
string
Provider-native voice selector for MiniMax-compatible speech models.
string
Optional style or delivery instructions for OpenAI-compatible TTS models that support them.
string
Optional speaking style prompt for Gemini TTS models.
string
Optional language code, for example en-US, for Gemini, xAI, and compatible TTS routes.
string
Audio format. Common values include mp3, opus, aac, flac, wav, and pcm; supported values vary by model family.
string
default:"audio"
AI Sonar delivery format: audio or sse. stream_format=sse is not supported for tts-1 or tts-1-hd.
number
Speech speed for model families that support it (0.25 to 4.0).
number
Sampling temperature for Gemini-compatible TTS routes (0 to 2).

Response

Returns the audio file in the requested format.

Voice Samples

Response example

Important fields

string
Event or message type returned by the API.
binary
Raw response body. Save it directly instead of parsing it as JSON.