Estimate Transcription Cost
Get the price of a transcription or a live session from its length, free of charge
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"}'from voice213 import Voice213
client = Voice213() # reads VOICE213_API_KEY
# Ten minutes of audio, as a recording and as a live session
for model in ["khasbha-stt", "khasbha-stt-live"]:
quote = client.speech_to_text.estimate(600, model=model)
print(model, quote.billable_seconds, quote.cost, quote.enough)import Voice213 from "@voice213/sdk";
const voice213 = new Voice213(); // reads VOICE213_API_KEY
// Ten minutes of audio, as a recording and as a live session
for (const model of ["khasbha-stt", "khasbha-stt-live"]) {
const quote = await voice213.speechToText.estimate({ durationSeconds: 600, model });
console.log(model, quote.billableSeconds, quote.cost, quote.enough);
}{
"success": true,
"model": "khasbha-stt",
"durationSeconds": 95.5,
"billableSeconds": 96,
"pricePerMinute": 3,
"cost": 4.8,
"currency": "DZD",
"balance": 5000,
"enough": true
}{
"success": true,
"model": "khasbha-stt-live",
"durationSeconds": 600,
"billableSeconds": 600,
"pricePerMinute": 5,
"cost": 50,
"currency": "DZD",
"balance": 32.4,
"enough": false
}{
"error": "INVALID_DURATION",
"message": "`durationSeconds` must be a number of seconds above 0 and at most 1800.",
"max": 1800
}{
"error": "UNKNOWN_MODEL",
"message": "Unknown model 'khasbha-stt-pro'. Use one of: khasbha-stt, khasbha-stt-live (see GET /v1/stt/models).",
"models": ["khasbha-stt", "khasbha-stt-live"]
}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.mp3KhasbhaSTT measures the length from the decoded audio, so it can differ from what a player shows by a fraction of a second.
Authorizations
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/jsonThe 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.
khasbha-sttThe 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/jsontrue.
The model the price is for, such as khasbha-stt.
The length you sent.
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.
The model's price today, in dinars per minute of audio.
What the audio would cost, in dinars: billableSeconds × pricePerMinute ÷ 60, rounded to four decimals.
DZD.
Your API credit right now, in dinars, rounded to the centime.
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
| Status | Error | When |
|---|---|---|
400 | INVALID_DURATION | durationSeconds 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. |
400 | UNKNOWN_MODEL | model isn't a speech-to-text model. The body lists the models. |
401 | Missing API key. Pass it as 'Authorization: Bearer sk_live_...' | The request has no key. |
401 | Invalid or inactive API key | The key is wrong, switched off or deleted. |
403 | Account deactivated | The account that owns the key is deactivated or suspended. |
403 | API_ACCESS_BLOCKED (in code) | API access is switched off for the account. |
503 | MAINTENANCE (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?