Skip to content
POST
https://api.voice213.com/api/v1/tts/estimate
Try it
curl -X POST https://api.voice213.com/api/v1/tts/estimate \
  -H "Authorization: Bearer $VOICE213_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "(نبرة تساؤل وتشويق) ملّيتو من الساعات اللي تتبدل بعد شهر؟ (نبرة واثقة وهادئة) الساعة الكلاسيكية تاعنا مقاومة للماء وبسوار جلدي أصلي. (نبرة عاجلة وحاسمة) كومونديو دركا، العرض ما يدومش!",
    "model": "voice213-pro-2"
  }'
{
  "success": true,
  "model": "voice213-pro-2",
  "chars": 123,
  "billableChars": 123,
  "pricePer1MChars": 12000,
  "cost": 1.476,
  "currency": "DZD",
  "balance": 5000,
  "enough": true
}

Returns what a voice-over would cost, without generating it: the characters Voice213 would bill, the model's price and the total in dinars, with your API credit and whether it's enough. It's free, and it doesn't count toward your rate limits.

Send the same text and model you would send to Text to Speech. The estimate counts characters exactly as the voice-over does, so the cost it returns is the cost you'll be charged at the same price. It also refuses the texts a voice-over would refuse, with the same 400: a text over 5,000 words, one with nothing to speak, or one where too much isn't spoken (TEXT_TOO_LONG).

Use it to:

  • Show a price to your own users before they confirm a voice-over.
  • Check a long script against your balance before you send it.
  • Compare models on your real script: send the same text with each model (the Python example does this).

Authorizations

Authorizationstringrequired

Your API key as a Bearer token: Bearer sk_live_.... You can send it in an x-api-key header instead. See Authentication.

Body

application/json
textstringrequired

The script you want to price, up to 5,000 words, tone directions included, as for a voice-over. A tone direction in parentheses isn't billed when it's at most 100 characters long, parentheses included, so it doesn't count; a longer one is priced like the rest of the text. A text longer than twice its billable characters plus 1,000, every character counted, is refused with 400 TEXT_TOO_LONG, as a voice-over would be.

modelstringdefault: voice213-lite

The model to price it with: voice213-lite, voice213-lite-2, voice213-pro, voice213-pro-1.5 or voice213-pro-2, as in Text to Speech. An unknown model is refused with 400 UNKNOWN_MODEL. The older quality values work too. A model paused for the API is still priced, although a voice-over with it gets 503 MODEL_DISABLED for now.

Response

application/json
successbooleanrequired

true.

modelstringrequired

The model the price is for, such as voice213-pro-2.

charsnumberrequired

The characters of text, without its free tone directions (those of up to 100 characters) and with runs of spaces counted once.

billableCharsnumberrequired

The characters that would be billed: chars, or 100 when chars is lower.

pricePer1MCharsnumberrequired

The model's price today, in dinars per million characters.

costnumberrequired

What the voice-over would cost, in dinars: billableChars × pricePer1MChars ÷ 1,000,000, rounded to four decimals.

currencystringrequired

DZD.

balancenumberrequired

Your API credit right now, in dinars, rounded to the centime.

enoughbooleanrequired

true when your API credit covers cost, by the same rule a voice-over uses. When it's false, the voice-over would fail with 402: top up first. It doesn't subtract what your running voice-overs have set aside: with others running, a voice-over can still get 402 when this says true. enough compares your exact balance, so rely on it rather than comparing balance with cost.

Errors

StatusErrorWhen
400text is requiredThe body has no text, or only spaces.
400EMPTY_TEXTtext has nothing to speak, such as a text made only of tone directions.
400Max 5000 words exceededtext is over 5,000 words, tone directions included. The body has words and maxWords.
400TEXT_TOO_LONGtext is longer than twice its billable characters plus 1,000: too much of it is tone directions, spaces or invisible characters. The body has chars and maxChars.
400UNKNOWN_MODELmodel isn't one of the five models. The body lists the models you can use.
401Missing API key. Pass it as 'Authorization: Bearer sk_live_...'The request has no key.
401Invalid or inactive API keyThe key is wrong, switched off or deleted.
403Account deactivatedThe account that owns the key is deactivated or suspended.
403API_ACCESS_BLOCKED (in code)API access is switched off for the account.
503MAINTENANCE (in code)The API is down for maintenance. Retry later.

An estimate never returns 402: when your credit is short, it says so with enough: false.

Was this page helpful?