Skip to content
POST
https://api.voice213.com/api/v1/stt/estimate
curl -X POST https://api.voice213.com/api/v1/stt/estimate \
  -H "Authorization: Bearer $VOICE213_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"durationSeconds": 95.5, "model": "khasbha-stt"}'
{
  "success": true,
  "model": "khasbha-stt",
  "durationSeconds": 95.5,
  "billableSeconds": 96,
  "pricePerMinute": 3,
  "cost": 4.8,
  "currency": "DZD",
  "balance": 5000,
  "enough": true
}

Returns what a transcription, or a live session, of a given length would cost, without running it: the seconds Voice213 would bill, the model's price per minute 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 length of the audio in seconds, and the model. The estimate bills that length exactly as KhasbhaSTT and KhasbhaSTT LIVE do, per second and with the model's minimum, so the cost it returns is the cost you'll be charged for audio of that length at today's price.

Use it to:

  • Show a price to your own users before they upload a recording.
  • Check a long recording against your balance before you send it.
  • Compare a recording with a live session of the same length (the Python and JavaScript examples do this).

To read a file's length, use its player or ffprobe:

ffprobe -v error -show_entries format=duration -of csv=p=0 call.mp3

KhasbhaSTT measures the length from the decoded audio, so it can differ from what a player shows by a fraction of a second.

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
durationSecondsnumberrequired

The length of the audio in seconds, such as 95.5: more than 0, and at most the model's longest, 1,800 (30 minutes) for khasbha-stt and 3,600 (one hour) for khasbha-stt-live. Anything else gets 400 INVALID_DURATION, with the max for the model.

modelstringdefault: khasbha-stt

The model to price it with: khasbha-stt for a file, or khasbha-stt-live for a live session. Capitalization doesn't matter, and the names KhasbhaSTT and KhasbhaSTT LIVE work too. An unknown model gets 400 UNKNOWN_MODEL, which lists the models.

Response

application/json
successbooleanrequired

true.

modelstringrequired

The model the price is for, such as khasbha-stt.

durationSecondsnumberrequired

The length you sent.

billableSecondsnumberrequired

The seconds that would be billed: durationSeconds rounded up to the whole second (a remainder of 0.05 s or less isn't counted), or the model's minimum when that's lower: 30 seconds for khasbha-stt, 15 for khasbha-stt-live.

pricePerMinutenumberrequired

The model's price today, in dinars per minute of audio.

costnumberrequired

What the audio would cost, in dinars: billableSeconds × pricePerMinute ÷ 60, 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. It doesn't subtract what your running requests and live sessions have set aside, so with others running, a transcription can still get 402 when this says true. enough compares your exact balance: rely on it rather than comparing balance with cost. For a live session, false means the session would end with credit_limit before reaching this length, unless you top up: it can still start with 15 seconds' worth of credit.

Errors

StatusErrorWhen
400INVALID_DURATIONdurationSeconds is missing, isn't a number, is 0 or less, or is over the model's longest. The body has the max for the model.
400UNKNOWN_MODELmodel isn't a speech-to-text model. The body lists the models.
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. It keeps working while speech to text is paused for the API.

Was this page helpful?