Skip to content

Text to speech ​

Uzbek text becomes an audio file: send the text, get the recording back. Text to speech is in beta and open to every account.

Coming soon

  • A streaming model. Audio arrives in pieces without waiting for the whole text: for voice agents and live calls.
  • Many new live voices.

Voices ​

voiceVoice
zeboZebo, female voice (the default)
dostonDoston, male voice

GET /v1/tts/voices returns this list with an available field: a voice is available when at least one server serves it right now.

Role and style ​

Both voices speak in one of their roles and one of that role's styles. The default is role operator, style neutral.

roleStyles (style)
operator — a call-centre operatorneutral, warm, cheerful, calm, empathetic
assistant — a voice assistantneutral, warm, cheerful, calm, empathetic

Each voice's roles and styles come in GET /v1/tts/voices in the roles field; a role's first style is its default. The price does not depend on the style.

POST /v1/tts: speak a text ​

The same project token as for transcription. The body is JSON:

FieldWhat it is
textThe text, up to 4,000 characters. Latin or Cyrillic script; numbers, dates, phone numbers and web addresses are read as words
voicezebo or doston, zebo by default
roleoperator (the default) or assistant
styleA style of the role: neutral (the default), warm, cheerful, calm, empathetic
formatmp3, wav (the default) or ogg (Opus)
sample_rateThe file's rate, 8000–48000 Hz; by default the voice's own, 22050 Hz
dialectConversational pronunciation, as in everyday Tashkent speech: "hozir" sounds like "hozi", "bo‘lib" like "bo‘p". On unless false; turn it off for formal text and news
hesitationstrue adds pauses and sounds like "Aa…" and "Eee…" where a live speaker would make them, so a call sounds less synthetic; off unless true. The cabinet's "Conversational speech" turns on this and dialect together
no_waittrue answers at once with the job's id instead of waiting for the audio

[pause] in the text makes a short pause and [laugh] a laugh. There are no other tags or markup. The dialect pronunciation keeps Uzbek words: it does not swap in Russian loans such as "dostavka" or "skidka".

bash
curl -X POST https://console.gapi.uz/v1/tts \
  -H "Authorization: Bearer $GAPI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text": "Assalomu alaykum! Buyurtmangiz ertaga soat 10 da yetkaziladi.", "voice": "zebo", "format": "mp3"}' \
  -o salom.mp3

A 200 answer is the audio file itself (audio/mpeg, audio/wav or audio/ogg) with the headers X-Job-Id, X-Voice, X-Audio-Seconds and X-Cost-G. With Accept: application/json the answer is JSON: id, voice, role, style, said (the text as the voice read it), format, sample_rate, audio_seconds and audio_b64 (the file in base64).

The request waits up to two minutes for the audio. If the text was not spoken by then, the answer is 202 with id and result_url: fetch the file from there.

GET /v1/tts/{id}: the result ​

A finished job's audio, in the same form as the POST /v1/tts answer; while the job is still working, JSON with state (queued, running). The audio is kept for 24 hours, then the answer is 410 result_expired.

GET /v1/tts: recent requests ​

The project's requests, newest first: ?limit= up to 100 (20 by default) and ?offset=. Each has id, state, voice, role, style, format, chars, cost_g, audio_seconds, created_at, finished_at, text, said, expires_at and result_url. text is the text you sent and stays in the history; said (the text as the voice read it) is there while the audio is kept.

Price ​

3.2 g per 1,000 characters of the text sent, spaces included. The price is known before the speech is made: it comes back in X-Cost-G (and in cost_g with no_wait), is reserved with the request and charged when the audio is ready. A request that fails costs nothing.

Errors ​

CodeWhat it means
403 tts_not_availableText to speech is not open to this account yet
400 tts_text_empty, 400 tts_text_too_longThe text is empty or longer than 4,000 characters
400 tts_voice_unknownNo such voice; the hint lists them
400 tts_role_unknown, 400 tts_style_unknownThe voice has no such role or style; the hint lists them
400 tts_format_unsupported, 400 tts_sample_rate_unsupportedA format or rate that is not supported
503 tts_voice_unavailable, 503 no_runner_for_ttsThe voice, or every speech server, is restarting; try again in a couple of minutes
429 insufficient_balanceThe balance is less than the text costs