Skip to main content
This standalone API speaks text supplied by your application. For speech generated as part of a model reply, see Audio responses.

Generate speech

Use the standard text-to-speech endpoint when you want a complete WAV file. The response body is binary audio, and the response headers include X-Language-Code. To save the generated audio to history, set store=true. When stored, the response also includes X-Tts-Id, and persistence completes before the response returns.

Stream speech for lower latency

Use streaming text-to-speech when you want playback to start before the full audio file is ready. Choose mp3 for smaller payloads or pcm for uncompressed audio (returned as audio/wav). To save the generated audio to history, set store=true. When stored, the response includes X-Tts-Id. History persistence for streaming is best-effort and completes shortly after the stream ends, so an immediate lookup by X-Tts-Id can briefly return 404. If persistence fails or is skipped (for example, if the audio exceeds the 25MB history cap), the id is never assigned and lookups keep returning 404.

Supported languages

Set language to the language of your text, or leave it as auto (the default) to detect it from the text. Both endpoints accept these ISO 639-1 codes: Any other language value returns 400 Bad Request. With auto, X-Language-Code reports the language the API detected. If that language is not in the table, the request still succeeds: the text is spoken with the English voice, and X-Language-Code is en. If your text may be in an unsupported language, check X-Language-Code before you use the audio.