The Supertone API uses a credit-based billing model that is shared with Supertone Play. This page covers how credits work, how to forecast cost before generating, and the endpoints you should integrate into your observability stack.Documentation Index
Fetch the complete documentation index at: https://docs.supertoneapi.com/llms.txt
Use this file to discover all available pages before exploring further.
How credits work
- Credits are deducted per second of generated audio.
- Credits are shared with Supertone Play — the same balance applies to both. Credits charged in Play are immediately available to the API and vice versa.
- Both preset voices and custom voices deduct from the same balance.
predict_durationis free. No credits are deducted — use it for cost preview and pre-flighting.
Endpoints you should integrate
| Endpoint | Purpose |
|---|---|
POST /v1/predict-duration/{voice_id} | Forecast audio length (and therefore credit cost) before generating. |
GET /v1/credits | Current credit balance — alert when it’s low. |
GET /v1/voice-usage | Minutes generated per voice / style / language / model, by day (max 30 days). |
GET /v1/usage | Bucketed analytics with breakdowns by voice_id, voice_name, api_key, or model. |
Predict duration
predict_duration returns the expected length of generated speech for a given text, without producing audio. Use it to:
- Show users a “this will take ~12 seconds” estimate before generation.
- Forecast credit cost (no credits are deducted by this endpoint).
- Decide whether a sentence fits a UI slot or budget.
predict_duration does not auto-chunk — the same 300-character limit applies. For longer scripts, split yourself and sum the predicted durations.- Python
- TypeScript
- cURL
text, language, style, model, voice_settings — minus output_format, include_phonemes, and normalized_text (none of which affect the predicted length).
Tips for accurate forecasts:
- Speed changes the result.
voice_settings.speedmultiplies the duration. If you preview at one speed and generate at another, the actual length will differ. Use the same speed in both calls. - Match the model.
predict_durationaccepts the samemodelfield ascreate_speech. If your generation will use a specific model, predict against it.
predict_duration first and sum the durations to decide whether to proceed.
Daily balance check
A simple cron job that posts to your monitoring tool when the balance drops below a threshold gives you days of warning before a402 Payment Required outage.
- Python
- TypeScript
- cURL
Weekly per-voice report
Useful when you want to know which voices drive the most cost, or to flag a runaway integration. Maximum query window is 30 days; dates are UTC+0.- Python
- TypeScript
- cURL
Bucketed analytics for dashboards
GET /v1/usage supports hourly or daily buckets with multiple breakdowns. Use it to populate a dashboard panel or send rows to your metrics backend.
- Python
- TypeScript
- You can’t combine
voice_idandvoice_namein the samebreakdown_type. - If
start_timeandend_timehave different UTC offsets, the API ignoresend_time’s offset. - Page size is 1–20; paginate via
next_page_token.
Anomaly alerts
Two cheap, useful alerts:- Spend spike — compare today’s minutes-generated to the rolling 7-day median. Alert if today is more than (say) 3× the median.
- New voice in production — if a voice not in your expected set appears in
get_voice_usage, flag it. This catches accidental hard-coded test voices in production code.
Per-user attribution
The Supertone API itself doesn’t track end-user identities — your backend does. The pattern is:- Have your backend record each TTS call with
user_id,voice_id, predicted/actual duration, timestamp. - Roll up internally for billing or anti-abuse.
- Cross-check periodically against
get_voice_usageto make sure your records align with Supertone’s count.
Related
Create speech
Generate audio once you’ve forecasted the cost.
Rate limits
Per-minute request limits by tier.