Rate Limits
Requests per minute, per day and at once, text and audio length, and how to stay within them
Rate limits keep the API fast and reliable for everyone. Every account has the same limits, whatever your plan: the API is open on every plan, Free included, and only your API credit sets how much you can generate and transcribe. An account can have up to 10 API keys, and they share its limits: the requests of all its keys count together, so more keys never mean more requests.
Limits
| Limit | Every API key |
|---|---|
| Requests per minute | 600 |
| Requests per day | 1,000 |
| Requests at once | 20 |
| Words per voice-over, tone directions included | 5,000 |
| Requests per minute from one IP address | 600 |
| JSON request body | 25 MB |
| File uploaded to POST /stt | 100 MB |
Your account's limits are also on the Developer Dashboard, and in the key.rateLimit field of GET /me.
Speech to text adds limits of its own, per file and per live session:
| Limit | KhasbhaSTT | KhasbhaSTT LIVE |
|---|---|---|
| Longest audio | 30 minutes per file | 1 hour per session |
| Largest file | 100 MB, uploaded or at a URL | — |
| Audio | Audio and video files | 16-bit PCM, mono, 16 kHz, streamed |
| At once | 20 per key, shared with voice-overs | 5 sessions per account |
| Requests per minute and per day | Each transcription counts once Voice213 starts reading its audio, even if it's then refused | Each token counts once |
| Downloading a URL | Within 60 seconds | — |
| Session token | — | Single use, valid 2 minutes |
| Custom vocabulary | — | Up to 50 terms of up to 40 characters |
| Without audio | — | A session ends after 60 seconds |
| Socket messages | — | Up to 64 KB each |
What counts
A voice-over or a live token counts toward your requests per minute and per day once it succeeds. When it fails, whatever the reason, it doesn't count.
A transcription counts once Voice213 starts reading its audio: its file has arrived, uploaded or downloaded from your url, and its fields are accepted. From there it counts once, however it ends. A file refused as unreadable (400 INVALID_MEDIA) or too long (400 AUDIO_TOO_LONG), a 402 on its measured price and a failure from that point on (502) each count like a success, but none of them is charged. A transcription refused before Voice213 starts reading its audio doesn't count: a missing or invalid field, a file over 100 MB, a url that can't be fetched, or a balance that can't pay for the shortest transcription.
Only voice-overs and transcriptions count toward your requests at once, from the moment Voice213 accepts them until they end, whether they succeed or fail. KhasbhaSTT LIVE sessions have a limit of their own: 5 at once per account.
| Endpoint | Checked against the per-minute and per-day limits | Counts toward them | Counts toward requests at once |
|---|---|---|---|
POST /tts | Yes | Yes, when it succeeds | Yes, while it runs |
POST /stt | Yes | Yes, once Voice213 starts reading its audio, even when it's then refused | Yes, while it runs |
POST /stt/live/token | Yes | Yes, when it succeeds | No |
GET /me | Yes | No | No |
POST /tts/estimate, GET /models, GET /tts/voices, GET /tts/tones, POST /stt/estimate, GET /stt/models | No | No | No |
A live session on the /ws/stt socket | No | No | No: it counts toward your live sessions at once |
Requests per minute
The minute starts with the first request that counts. Once your account's keys have made 600 requests between them within that minute, further requests get 429 until 60 seconds have passed since it started:
{
"error": "Rate limit exceeded: RPM limit exceeded",
"limit": 600
}This 429 has no Retry-After header: wait until the minute is over, then retry.
Requests per day
Once your account's keys have made 1,000 requests between them in a day, further requests get 429 until the day ends, at midnight server time:
{
"error": "Rate limit exceeded: Daily limit exceeded",
"limit": 1000
}Don't retry this one in a loop: it won't clear until the next day. If you regularly need more, contact us.
Requests at once
Your account can have up to 20 requests running at the same time, whichever of its keys sent them, voice-overs (POST /tts) and transcriptions (POST /stt) together. A request runs from the moment Voice213 accepts it until its audio or its transcript is ready, or it fails. Once 20 are running, the next one gets 429:
{
"error": "Rate limit exceeded: Concurrent request limit exceeded",
"limit": 20
}- A transcription takes its place as soon as its request arrives, so the time its file takes to upload counts too.
- A voice-over, or a transcription whose file has arrived, keeps running when your client cancels or stops waiting, until Voice213 finishes it (see When your client gives up), and keeps its place until then. A quick retry after a timeout can therefore hit this limit.
- Estimates, live tokens,
GET /meand the catalogue endpoints don't count, and are never refused by it. Live sessions don't take a place either: they have their own limit. - This
429has noRetry-Afterheader and doesn't count toward your per-minute or per-day limits. Retry once one of your running requests has ended.
A queue with a fixed number of workers, like the example below, keeps you under it.
Live sessions at once
An account can run up to 5 KhasbhaSTT LIVE sessions at the same time. A session runs from the moment its socket opens until it ends. With 5 running, POST /stt/live/token answers 429 with the code SESSION_LIMIT:
{
"error": "SESSION_LIMIT",
"message": "You already have 5 live sessions running.",
"limit": 5
}- The limit is checked again when the socket opens: a token created while fewer sessions were running can still find 5 running by then. The socket then sends the error
SESSION_LIMITand closes with4000, and nothing is charged. - Live sessions don't take any of your 20 requests at once, and don't count toward your per-minute or per-day limits: only the token request does.
- End sessions you no longer need with an
endmessage rather than leaving them open. A session also ends on its own after 60 seconds without audio.
Requests per IP address
The whole API also accepts up to 600 requests a minute from one IP address. Every response under /api carries the standard headers for this limit:
RateLimit-Policy: 600;w=60
RateLimit-Limit: 600
RateLimit-Remaining: 597
RateLimit-Reset: 42Past it, requests get 429 with {"error": "RATE_LIMITED"} and a Retry-After header giving the seconds to wait.
Text length
- Words per request: up to 5,000 in
POST /tts, in both formats, and in Estimate Cost. Every word counts, tone directions included. Longer texts get400 Max 5000 words exceeded, with thewordsyou sent and themaxWordsallowed. Long texts also take longer to generate, so split very long scripts. - Something to speak: a text made only of tone directions has nothing to speak, and gets
400 EMPTY_TEXT. - Unspoken text: tone directions, spaces and invisible characters stay free, but they can't outweigh the spoken text. A text may be at most twice its billable characters (counted as at least 100) plus 1,000 characters long, every character counted. Longer texts get
400 TEXT_TOO_LONG, with thecharsyou sent and themaxCharsallowed. See Too much unspoken text. - Request body: up to 25 MB of JSON, for every endpoint. Files uploaded to
POST /stthave a limit of their own, 100 MB (below).
Audio length
- Files:
POST /stttakes up to 30 minutes of audio, in a file of up to 100 MB, uploaded or at a publicurl. A longer recording gets400 AUDIO_TOO_LONG, with itsdurationSecondsand themaxDurationSecondsallowed, and a bigger file gets413 FILE_TOO_LARGE, with themaxFileMBallowed. Neither is charged: split the recording, or compress it, and send the parts. - Live sessions: up to 60 minutes each, or less if your server sets
maxSeconds(15 to 3,600) when it creates the token. The server warns you withENDING_SOON30 seconds before the end, then ends the session with the reasonmax_duration. A session your credit can no longer cover ends earlier, with the reasoncredit_limit. - Live audio pace: stream audio as it's recorded. Audio that runs more than 10 seconds ahead of real time is refused with
TOO_FAST, and the socket closes. - Live tokens: each one opens a single session, within two minutes of its creation.
- Vocabulary: up to 50 terms per live session, of up to 40 characters each.
POST /stt/estimate and GET /stt/models are free, and never count toward any of these limits.
Staying within the limits
Run requests through a queue with a fixed number of workers, and space them out rather than sending bursts. The SDKs retry a 429 on their own, after the API's Retry-After or a growing pause, except for your account's daily limit, which won't clear today. A semaphore keeps you under the 20 requests at once:
import asyncio
from voice213 import AsyncVoice213
MAX_PARALLEL = 5 # how many requests you run at once (20 at most)
async def main(texts):
client = AsyncVoice213() # reads VOICE213_API_KEY, and retries a 429 on its own
semaphore = asyncio.Semaphore(MAX_PARALLEL)
async def synthesize(text):
async with semaphore:
return await client.text_to_speech.create(text, model="voice213-lite", voice="nariman")
return await asyncio.gather(*(synthesize(text) for text in texts))
speeches = asyncio.run(
main(["مرحبا بيكم في Voice213", "(نبرة حماسية ومنعشة) خويا، شفت الساعة الجديدة؟ مقاومة للماء وبسوار جلدي أصلي!"])
)
for speech in speeches:
print(speech.audio_url, speech.cost)The SDKs retry twice by default. For a long batch, allow more: AsyncVoice213(max_retries=5) in Python, new Voice213({ maxRetries: 5 }) in JavaScript.
- Combine short texts into one request where it makes sense. One request of 1,000 words counts once; twenty requests of 50 words count twenty times. Every request is also billed at least 100 characters, so very short requests cost more per character.
- The same queue works for transcriptions, which share the 20 places with voice-overs. Each file is billed at least 30 seconds, so very short clips cost more per second.
- Save audio you generate more than once instead of generating it again.
- Read the free catalogue endpoints (
/models,/tts/voices,/tts/tones,/stt/models) once and keep the result: they rarely change.
Was this page helpful?