Text to Speech

Create batch

Submit up to 100 text-to-speech items in one call.

POST/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:

FieldTypeDefaultDescription
itemsarrayrequired1 to 100 items (fields below).
metadataobject—Your own key/value data, stored with the batch.

Each item (the SDKs take voice_id / voiceId and output_format / outputFormat):

FieldTypeDefaultDescription
refstringitem_<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.
textstringrequired1 to 5,000 characters.
voice_idstringrequiredThe voice, e.g. vc_9f2ae1.
modelstringwistfare-tts-v1-betaThe text-to-speech model.
formatstringmp3mp3 or wav.
speednumber1.00.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

StatusCodeMeaning
401unauthorizedMissing, invalid or revoked API key.
402insufficient_credits / budget_exceededThe estimated cost of all items doesn't fit your balance or budget. Nothing was created or charged.
403read_only_key / account_suspendedThe key is read-only, or spending is suspended on the account.
409idempotency_in_progressA request with the same Idempotency-Key is still running.
422validation_error / idempotency_mismatchEmpty items, more than 100 items, duplicate refs, or an invalid item field; or an Idempotency-Key reused with a different body.
429rate_limitedRequest-rate limit reached. Retry after Retry-After seconds.

On this page