Skip to main content
POST /v1/audio/speech has two modes, chosen by model. Every field works in both; only the defaults and the error shape differ. The model behind both is the same.

OpenAI SDK

Any OpenAI TTS client works with only base_url and api_key changed:
For one-word inputs (No, Ok) pass language (in the SDK: extra_body={"language": "es"}) or use a voice such as lucia.

Streaming

  • Audio is sent as soon as it is generated. With pcm the first bytes are audio; with wav a 44-byte header comes first.
  • mp3, opus, aac, flac and speed other than 1 go through an encoder that adds about 0.07 s to the first audio.
  • If the client closes the connection (for example on barge-in), synthesis stops.
  • With stream_format: "sse" the answer is Server-Sent Events: speech.audio.delta events with base64 audio, then speech.audio.done.

Answer headers

X-Sample-Rate: 24000, X-Language, X-Voice (always the voice id), X-Model: mihu-ses-v1.

Text handling

  • Normalization (normalize, on by default): numbers, amounts, dates, times and abbreviations are written out (“14.30” → “on dört otuz”). false reads the text as it is.
  • Generate and verify (verify, Turkish, off by default): a speech recognizer listens to each sentence chunk; a chunk it does not hear as written is said once more and the better take is sent. Fewer misread or skipped words, but the first audio comes about 2 s later. For files and prepared announcements, not for live calls.
  • Russian: stress marks are added automatically. Text that already carries them (U+0301 after the vowel, or + before it: з+амок) is kept as written. Latin words are said in Cyrillic; for a name that must sound a certain way, write it in Cyrillic.

Errors