Text to Speech
Create batch
Submit up to 100 text-to-speech items in one call.
POSThttps://api.voice.wistfare.com/v1/batches
Creates a batch and starts generating its items in the background (up to 4 at a time). The estimated cost of all items is held from your balance first; each item is then charged on its own when it succeeds, and the unused remainder is released. Accepts an Idempotency-Key header. Requires an API key with all permission. See the Batch generation guide.
from wistfareai import WistfareAI
client = WistfareAI() # reads WISTFARE_API_KEY
batch = client.text_to_speech.batches.create(
items=[
{"ref": "welcome", "text": "Ikaze kuri serivisi yacu.", "voice_id": "vc_9f2ae1"},
{"ref": "menu-1", "text": "Kanda rimwe kugira ngo uvugane n'umukozi.", "voice_id": "vc_9f2ae1"},
],
metadata={"project": "ivr-refresh"},
)
print(batch.id, batch.status)Request
JSON body:
| Field | Type | Default | Description |
|---|---|---|---|
items | array | required | 1 to 100 items (fields below). |
metadata | object | — | Your own key/value data, stored with the batch. |
Each item (the SDKs take voice_id / voiceId and output_format / outputFormat):
| Field | Type | Default | Description |
|---|---|---|---|
ref | string | item_<position> | Your id for the item: 1 to 64 letters, digits, ., _ or -, unique within the batch. Used to download its audio. Defaults to item_0, item_1, … by position. |
text | string | required | 1 to 5,000 characters. |
voice_id | string | required | The voice, e.g. vc_9f2ae1. |
model | string | wistfare-tts-v1-beta | The text-to-speech model. |
format | string | mp3 | mp3 or wav. |
speed | number | 1.0 | 0.5 to 2.0. |
Response
201 Created:
{
"id": "batch_4d81f7",
"status": "processing",
"item_count": 2,
"created_at": "2026-10-11T08:15:00Z"
}Poll GET /v1/batches/{id} until it finishes, or call batches.wait(id) in the SDKs. Batches and their audio are kept for 30 days.
Errors
| Status | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing, invalid or revoked API key. |
402 | insufficient_credits / budget_exceeded | The estimated cost of all items doesn't fit your balance or budget. Nothing was created or charged. |
403 | read_only_key / account_suspended | The key is read-only, or spending is suspended on the account. |
409 | idempotency_in_progress | A request with the same Idempotency-Key is still running. |
422 | validation_error / idempotency_mismatch | Empty items, more than 100 items, duplicate refs, or an invalid item field; or an Idempotency-Key reused with a different body. |
429 | rate_limited | Request-rate limit reached. Retry after Retry-After seconds. |