Klone V3 Flash
Klone V3 Flash (klone_v3_flash) is our fast, streaming voice-clone model and the recommended model on the Text to Speech API. It speaks in any Voice Arena voice, in 12 languages, as one-shot audio, a chunked HTTP stream, or over a WebSocket. It replaces Klone V2 Flash at the same price. For 48 languages, use Klone V2 Pro.
Quick start
- 1
Get an API key
Create a key in the Console and replace
YOUR_API_KEYin the examples below. - 2
Install the SDK
pip install -U "fonadalabs>=4.0" - 3
Make your first request
Generate speech in a Voice Arena voice with Klone V3 Flash. Replace YOUR_SHARE_ID with the voice's 8-character share ID.
from fonadalabs.tts.client import TTSClient client = TTSClient(api_key="YOUR_API_KEY") audio_bytes = client.generate_audio( text="नमस्ते, यह एक परीक्षण है।", language="Hindi", # required model="klone_v3_flash", # required share_id="YOUR_SHARE_ID", output_file="out.wav", )
Overview
Key characteristics
- Three ways to call it: one-shot
POST /v1/text-to-speech, chunkedPOST /v1/text-to-speech/stream, andWSS /v1/text-to-speech/ws. - Streaming starts playing fast: the first audio arrives in about 0.2 to 0.5 s.
- 12 languages: Bengali, English, Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, Telugu, Urdu.
- Up to 5,000 characters per request.
speed,duration,instructandnum_stepapply on/streamand/ws. One-shot Flash ignores them.
Request
API endpoint
Base URL: https://api.fonada.ai
Endpoint: /v1/text-to-speech (one-shot) or /v1/text-to-speech/stream
Method: POST
Content-Type: multipart/form-data (form fields, not JSON)
Authorization: Bearer YOUR_API_KEY
curl -X POST "https://api.fonada.ai/v1/text-to-speech" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=klone_v3_flash" \
-F "share_id=YOUR_SHARE_ID" \
-F "language=hi" \
-F "text=नमस्ते, यह एक परीक्षण है।" \
-F "output_audio_codec=mp3" \
-o out.mp3const form = new FormData()
form.append('model', 'klone_v3_flash')
form.append('share_id', 'YOUR_SHARE_ID')
form.append('language', 'hi')
form.append('text', 'नमस्ते, यह एक परीक्षण है।')
form.append('output_audio_codec', 'mp3') // optional, default wav
// Call from your backend, not the browser: keep your API key server-side.
// Do not set Content-Type yourself - FormData adds the multipart boundary.
const res = await fetch('https://api.fonada.ai/v1/text-to-speech', {
method: 'POST',
headers: { Authorization: 'Bearer YOUR_API_KEY' },
body: form,
})
if (!res.ok) {
const err = await res.json() // { detail: { error, message, details? } }
if (err?.detail?.error === 'rate_limit_exceeded') {
const wait = err.detail.details?.retry_after_seconds ?? 5
// wait `wait` seconds, then retry
}
throw new Error(err?.detail?.message || err?.detail || 'text-to-speech failed')
}
console.log('credits used:', res.headers.get('X-Credits-Used'))
const audio = Buffer.from(await res.arrayBuffer())Parameters (multipart form)
| Field | Required | Default | Description |
|---|---|---|---|
| text | Yes | — | Text to synthesize, 1 to 5,000 characters. Missing or empty: 400 empty_text. |
| model | Yes | — | klone_v3_flash. Missing or empty: 400 missing_model. Send it on every call, including stream and WebSocket. |
| language | Yes | — | Code (hi), name (Hindi) or tag (hi-IN). Missing or empty: 400 missing_language. See Languages. |
| share_id | One voice source | — | Catalog voice, 8 characters (same as the old API). |
| audio | One voice source | — | Reference clip upload: WAV/MP3/M4A/FLAC/OGG/WebM, up to 10 MB and 30 s. Enterprise only. |
| audio_url | One voice source | — | HTTPS URL of a reference clip. Enterprise only. |
| audio_text | No | auto | Transcript of audio / audio_url. Ignored with share_id. |
| output_audio_codec | No | wav (stream: pcm) | See Output formats. |
| speed | No | 1.0 | 0.25 to 4.0. Stream and WebSocket only. |
| duration | No | — | 0.1 to 60 s; overrides speed. Stream and WebSocket only. |
| instruct | No | — | Style, e.g. "calm, whispering". Stream and WebSocket only. |
| num_step | No | 32 | 8 to 64. Stream and WebSocket only. |
share_id, audio or audio_url. Zero returns 400 missing_audio_source; more than one returns 400 ambiguous_audio_source. Normal users use share_id.Response
The body of a successful response is the audio. Read it as a Blob or ArrayBuffer, not JSON. Content-Type follows the codec.
| Header | Meaning |
|---|---|
| X-Model | klone_v3_flash |
| X-Request-Id | Request ID. Log it and quote it to support |
| X-Credits-Used | Credits charged for this request |
| X-Output-Codec | Codec returned |
| X-Processing-Time-Ms, X-Upstream-Time-Ms | Timing |
Browsers cannot read X-Model, X-Credits-Used or X-Request-Id yet (they are not exposed through CORS). Read them in your backend.
Streaming
POST /v1/text-to-speech/stream takes the same form fields and returns chunked audio. Start playing as soon as bytes arrive. The default codec is pcm (16-bit, 24 kHz, mono). Always send model=klone_v3_flash.
const form = new FormData()
form.append('model', 'klone_v3_flash')
form.append('share_id', shareId)
form.append('language', 'hi')
form.append('text', text)
form.append('output_audio_codec', 'mp3') // stream default is pcm
const res = await fetch('https://api.fonada.ai/v1/text-to-speech/stream', {
method: 'POST',
headers: { Authorization: `Bearer ${apiKey}` }, // call from your backend, not the browser
body: form,
})
if (!res.ok) throw new Error((await res.json()).detail?.error)
const reader = res.body.getReader()
for (;;) {
const { value, done } = await reader.read()
if (done) break
// append value (Uint8Array) to your audio buffer / MediaSource
}| Header | Meaning |
|---|---|
| X-Model | klone_v3_flash |
| X-Request-Id | Request ID |
| X-Credits-Used | Credits charged |
| X-Output-Codec, X-Sample-Rate, X-Channels | Audio format, e.g. pcm, 24000, 1 |
- Error before audio starts: a normal JSON error, and the credits are refunded.
- Error after audio starts: the stream ends early, and the request is billed.
WebSocket
Connect to wss://api.fonada.ai/v1/text-to-speech/ws with the Authorization: Bearer header, or add ?api_key=YOUR_API_KEY where headers cannot be set. Do not put a customer's real key in browser code.
{"type":"ready","model":"klone_v3_flash","codecs":["pcm","wav","mp3","opus","mulaw","alaw"],
"default_codec":"pcm","sample_rate":24000,"channels":1}{"text":"नमस्ते","share_id":"YOUR_SHARE_ID","language":"hi","output_audio_codec":"pcm",
"model":"klone_v3_flash","request_id":"optional-your-id",
"speed":1.0,"duration":null,"instruct":null,"num_step":null}Send text, share_id, model (klone_v3_flash) and language in every message; the rest are optional. klone_v2_pro returns an error. For each utterance the server sends a start message, then binary frames with the audio, then an end message.
{"type":"start","request_id":"...","model":"klone_v3_flash","output_audio_codec":"pcm",
"sample_rate":24000,"channels":1,"credits_used":1.65}{"type":"end","request_id":"...","audio_bytes":151680,"first_audio_ms":182,"total_ms":900}{"type":"error","request_id":"...","status":400,"error":"invalid_language","message":"..."}- The connection stays open after an error, so you can send the next utterance.
- Utterances are processed in order, one at a time.
- An idle connection closes after 300 s.
- A bad key gets an error message, then the connection closes with code 1008.
Languages (12)
Pass a code, a name or a tag (case-insensitive). Anything else returns 400 invalid_language. Odia is or on Flash (ory on Pro); the name "Odia" works on both.
| Code | Language |
|---|---|
| bn | Bengali |
| en | English |
| gu | Gujarati |
| hi | Hindi |
| kn | Kannada |
| ml | Malayalam |
| mr | Marathi |
| or | Odia |
| pa | Punjabi |
| ta | Tamil |
| te | Telugu |
| ur | Urdu |
Output formats
| output_audio_codec | Format | Sample rate | Content-Type |
|---|---|---|---|
| wav (one-shot default) | WAV 16-bit mono | 24 kHz | audio/wav |
| pcm (alias linear16, stream default) | Raw s16le mono, no header | 24 kHz | audio/pcm |
| mp3 | MP3 128 kbps | 24 kHz | audio/mpeg |
| opus | Ogg Opus | 24 kHz | audio/ogg |
| mulaw (alias ulaw) | μ-law | 8 kHz | audio/basic |
| alaw | A-law | 8 kHz | audio/x-alaw-basic |
For browser playback use mp3 or wav; pcm needs the Web Audio API. pcm, mulaw and alaw have no header, so your player needs to be told the format. An unknown value returns 400 invalid_output_audio_codec.
Pricing
Priced per 10K characters, billed per character of input text. Klone V3 Flash costs the same as Klone V2 Flash did.
| Model | Price | Credits | Billing |
|---|---|---|---|
| Klone V3 Flash | ₹6 per 10K characters | ~500 credits | Billed per character |
- credits = max(round(characters ÷ your Flash rate × voice multiplier, 2), 0.01).
- Paid Voice Arena voices (2x or higher) multiply this rate. Uploaded and URL voices are billed at 1x.
- Credits are taken when the request starts and refunded if it fails (for
/stream, only if it fails before any audio).
See the full pricing page.
Rate limits
- Limits are per API key. The free tier allows 10 requests per minute.
- The wait time is in the body (
detail.details.retry_after_seconds).
{
"detail": {
"error": "rate_limit_exceeded",
"message": "Rate limit exceeded. You can make 10 requests per minute.",
"details": {
"rate_limit": 10,
"current_usage": 10,
"remaining": 0,
"retry_after_seconds": 37,
"rate_period": "minute"
}
}
}Errors
Errors are JSON: {"detail": {"error": "<code>", "message": "<text>"}}. On the WebSocket the same fields are flat inside {"type":"error", ...}. Two exceptions: 401 returns a plain-string detail, and 422 returns a FastAPI list, so handle both. Required fields are checked in this order: API key (401), then model, then language.
| HTTP | error | Cause |
|---|---|---|
| 400 | missing_model | model missing or empty (required, including in each WebSocket message). supported_models lists the choices. Nothing is charged |
| 400 | missing_language | language missing or empty (required, including in each WebSocket message). Nothing is charged; on the WebSocket the connection stays open |
| 400 | invalid_model | model is not klone_v3_flash or klone_v2_pro (supported_models lists them). klone_v2_flash is not accepted |
| 400 | streaming_not_supported | klone_v2_pro sent to /stream or /ws |
| 400 | empty_text / text_too_long | text is missing, or longer than 5,000 characters |
| 400 | missing_audio_source / ambiguous_audio_source | No voice source, or more than one of share_id / audio / audio_url |
| 400 | invalid_language | Language is not one of the 12 Flash languages |
| 400 | invalid_output_audio_codec | Unknown codec |
| 400 | invalid_speed / invalid_duration / invalid_num_step | Out of range on /stream or /ws |
| 400 | empty_audio / audio_decode_failed / audio_too_long / audio_text_required | Reference clip problems |
| 401 | plain-text detail, e.g. "Invalid API key" | Missing or invalid key |
| 403 | enterprise_only | audio / audio_url on a non-enterprise key |
| 403 | inactive_api_key / access_denied | Account problems |
| 404 | voice_not_found | Unknown share_id |
| 413 | audio_too_large | Reference clip over 10 MB |
| 422 | FastAPI list in detail | Field type or range wrong on one-shot |
| 429 | rate_limit_exceeded | Per-key limit (free tier: 10 per minute); see details.retry_after_seconds |
| 429 | credits_exhausted | Balance too low; see details.current_balance and details.estimated_cost |
| 500 / 502 | upstream_error / upstream_unreachable / upstream_empty / internal_error | Server side; retry, quoting X-Request-Id |
Python SDK
Flash and Pro share the same TTSClient. Always pass model="klone_v3_flash" and language: both are required on every call. Use generate_audio() for a file and stream_audio() to play while generating. See the Klone V2 Pro SDK section for authentication.
pip install -U "fonadalabs>=4.0"Upgrading from SDK 3.x
- Run
pip install -U "fonadalabs>=4.0". - Add
model=to every call; it is required now. klone_v2_flash→klone_v3_flashv2(Pro) →klone_v2_pro- ASR
v3→kapture_v3_1 last_stream_info.credits_charged→last_stream_info.credits_used
from fonadalabs.tts.client import TTSClient
client = TTSClient(api_key="YOUR_API_KEY")
audio_bytes = client.generate_audio(
text="नमस्ते, यह एक परीक्षण है।",
language="Hindi", # required
model="klone_v3_flash", # required
share_id="YOUR_SHARE_ID",
output_file="out.wav",
)import wave
from fonadalabs.tts.client import TTSClient
client = TTSClient(api_key="YOUR_API_KEY")
# Streams 16-bit PCM, 24 kHz, mono as it is generated
with wave.open("stream.wav", "wb") as wav:
wav.setnchannels(1)
wav.setsampwidth(2)
wav.setframerate(24000)
for chunk in client.stream_audio(
"नमस्ते, यह एक परीक्षण है।",
model="klone_v3_flash", # required
share_id="YOUR_SHARE_ID",
language="Hindi", # required
):
wav.writeframes(chunk)
print(client.last_stream_info.credits_used)import asyncio
from fonadalabs import TTSClient
async def main():
client = TTSClient(api_key="YOUR_API_KEY")
async with client.stream_session() as session:
async for chunk in session.speak(
"नमस्ते", language="Hindi", model="klone_v3_flash", share_id="YOUR_SHARE_ID"
):
... # play or save chunk (16-bit PCM, 24 kHz, mono)
print(session.last_info.credits_used)
asyncio.run(main())Deprecated
The following still work but are deprecated. Do not use them in new code.
- Klone V2 Flash (
klone_v2_flash): replaced by Klone V3 Flash. Not accepted on the new endpoints (400 invalid_model). POST /v1/voice-clone/chunks→POST /v1/text-to-speechPOST /v1/voice-clone/stream→POST /v1/text-to-speech/streamWSS /v1/voice-clone/ws→WSS /v1/text-to-speech/wsshare_idstays the same;X-Credits-Charged/credits_charged→X-Credits-Used/credits_used
FAQ
Both use POST /v1/text-to-speech with the same voices, headers and errors; the model field picks the model. Flash is faster, supports 12 languages, and is the only model that can stream (/stream and /ws). Pro supports 48 languages and is one-shot only. Flash costs a tenth of Pro; see Pricing.
