Text to speech
Turn Kinyarwanda text into natural, lifelike speech as MP3 or WAV.
Send text and a voice; get back an audio file. wistfare-tts-v1-beta is trained for natural Kinyarwanda prosody, names and numbers, and works with every voice in your project: premade, cloned or designed.
from wistfareai import WistfareAI
client = WistfareAI() # reads WISTFARE_API_KEY
audio = client.text_to_speech.convert(
text="Muraho neza, murakaza neza kuri Wistfare.",
voice_id="vc_9f2ae1",
model="wistfare-tts-v1-beta",
)
with open("muraho.mp3", "wb") as f:
f.write(audio)
print(audio.generation_id, audio.audio_seconds, audio.cost_cents)Options
| Option | Default | Description |
|---|---|---|
text | required | 1 to 5,000 characters, enough for several paragraphs. |
voice_id | required | A voice from GET /v1/voices, e.g. vc_9f2ae1. |
model | wistfare-tts-v1-beta | The text-to-speech model. |
format (SDKs: output_format / outputFormat) | mp3 | mp3 (audio/mpeg) or wav (audio/wav), e.g. for telephony pipelines and post-processing. |
speed | 1.0 | Speaking rate from 0.5 (half speed) to 2.0 (double speed). |
The response body is the audio file. The headers X-Generation-Id, X-Audio-Seconds and X-Credits-Charged-Cents tell you the generation id, the audio length and what it cost. The SDKs return the audio as bytes (a bytes subclass in Python, a Uint8Array subclass in JavaScript) with those values attached as generation_id, audio_seconds and cost_cents (generationId, audioSeconds, costCents). See the reference.
Pricing
$0.15 per minute, metered per second, minimum 1¢ per request. The billed length is the longer of the clip's playback time and playback time × speed, so speeding speech up doesn't make it cheaper: a 30-second clip costs 8¢ at speed: 1.0 and 15¢ when it was generated at speed: 2.0. The estimated cost is held before generating and settled at the actual cost; failed requests cost nothing. See Pricing & billing.
Send an Idempotency-Key header to retry safely without paying twice.
Latency and long text
Audio is returned as a complete file: the connection stays open until generation finishes. There's no streaming synthesis. Text is generated sentence by sentence, so a single sentence typically takes about a second and longer passages take proportionally longer.
For faster perceived latency on long text, split it at sentence boundaries, send one request per sentence and play the clips as they arrive. For many clips where nobody is waiting, use batch generation.
Writing text that sounds right
- Write it the way it should be read. Punctuation drives pauses and intonation: use commas and full stops where a speaker would breathe.
- Spell out what's ambiguous. When a particular reading matters (a phone number digit by digit, a product code, an acronym), write it the way it should be spoken.
- Send Kinyarwanda text. The model is trained on Kinyarwanda; other languages aren't supported yet.