Endpoints
Speech synthesis
Turn Crimean Tatar text into speech. The request follows OpenAI’s audio/speech; the response is the audio file itself.
https://api.ana-yurt.dev/v1/audio/speechBearer key with the tts scope. Runs on the GPU machine.
#Request body
JSON, Content-Type: application/json.
| Name | Type | Description |
|---|---|---|
inputrequired | string | Text to speak, in Latin or Cyrillic. Up to 500 characters. Longer text gets |
voicerequired | string |
|
response_formatoptional | string |
Default: |
modeloptional | string | Ignored. Accepted so OpenAI clients that always send it keep working. |
Other OpenAI fields, such as speed or instructions, are ignored.
#Response
The body is the audio. Save it as a file or stream it to a player.
| response_format | Content-Type |
|---|---|
mp3 | audio/mpeg |
wav | audio/wav |
opus | audio/ogg; codecs=opus |
#Response headers
X-AY-Audio-Seconds: seconds billed for this request.X-Quota-Remaining-seconds: synthesis seconds left in the current window.X-AY-Model:omnivoice-crh.X-AY-Model-Version: the served checkpoint, e.g.omnivoice-crh-lora-v8b/checkpoint-5850.- The rate limit headers and
X-Request-Id.
#Limits and billing
- Billed in seconds of generated audio, rounded up, against the plan’s synthesis quota.
- Before the call the API reserves 0.1 s per input character plus 2 s. If that does not fit in what is left, the request gets
429 quota_exceededand nothing is charged. - One synthesis request per account at a time. The GPU machine runs one synthesis at a time for the whole API.
- A short sentence takes about 2 to 3 seconds. The API waits up to 90 seconds, then answers
504 timeout. - When the synthesis slot or the GPU is busy, the request waits up to 20 seconds (inside the same 90 seconds) before it answers
503 service_busy.
#Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request | Body not JSON, empty input, unknown voice or response_format. |
| 401 | invalid_api_key | Missing, unknown, revoked or expired key. |
| 403 | scope_not_allowed | The key has no tts scope. Also account_suspended. |
| 403 | voice_not_allowed | The key is limited to other voices. |
| 413 | payload_too_large | Input over 500 characters. |
| 429 | concurrent_request | A synthesis request of this account is already running. |
| 429 | rate_limited | The per-minute limit is reached. |
| 429 | quota_exceeded | Not enough synthesis seconds left. |
| 502 | upstream_error | The speech server failed. Retry. |
| 503 | service_busy | The synthesis slot or the GPU stayed busy for 20 s. Retry after Retry-After. |
| 503 | service_unavailable | The GPU machine is offline (Retry-After 300 s) or the model is not loaded (Retry-After 60 s, see status). |
| 504 | timeout | The model did not finish within 90 seconds. |
{
"error": {
"message": "voice must be one of servin, sevil",
"type": "invalid_request_error",
"code": "invalid_request"
}
}Longer text
Split text at sentence boundaries into parts of up to 500 characters, synthesise them one after the other, and join the audio with a tool such as ffmpeg.
Use of synthetic speech
Do not present generated speech as a real person’s recording (API Terms, section 4).
curl https://api.ana-yurt.dev/v1/audio/speech \
-H "Authorization: Bearer $AY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input": "Selâm! Bugün hava pek güzel.", "voice": "servin", "response_format": "mp3"}' \
-o speech.mp3HTTP/2 200
content-type: audio/mpeg
content-length: 19437
ratelimit-limit: 20
ratelimit-remaining: 19
ratelimit-reset: 3
x-ay-model: omnivoice-crh
x-ay-audio-seconds: 3
x-quota-remaining-seconds: 297
x-request-id: 31d841c3d06548fb988a420914a3a10a
<binary MP3, 24 kHz mono>