Tīrtha is still being built, so some features and models may not work as expected yet. Billing always follows the prices shown. Something broken? Email [email protected].

Tīrtha

Models / hexgrad

Kokoro 82M

by hexgrad

Reads your text aloud.

Open weights · Apache-2.0Listed on Hugging Face Dec 26, 2024

Kokoro 82M turns written text into spoken audio. It is made by hexgrad. On Tīrtha it reads up to 4,096 characters per call.

Text to speechVoice: BellaWAV
Takes on TīrthaText
Gives backAn audio file
VoicesBella (af_bella)
Audio formatsWAV
Get an API key
tirtha/kokoro-82m

Add credits · Read the docs

Good at

  • Tiny and quick82 million parameters. The maker says it matches larger models while being faster.
  • Open weightsApache-2.0, so commercial use is allowed.
  • Clear EnglishOn Tīrtha it speaks in Bella, an American English voice.

Model card details

Made by
hexgrad
Kind
Text to speech
Licence
Apache-2.0
Listed on Hugging Face
Dec 26, 2024
Voice languages
American English (from the maker's voice list)
Parameters
82 million
Licence
Apache-2.0
Voices on Tīrtha
Bella (American English)
Read the full model card on Hugging Face →

Hear it

Made with Kokoro 82M. Real outputs, not edited, each with the exact text it read and the voice it used.

Bella (American English, female)Welcome back. Your order shipped this morning and should arrive on Friday. Reply to this message if you need anything else.AI-generated
Bella (American English, female)The bakery on the corner smells of cinnamon every Sunday morning.AI-generated
Bella (American English, female)Pack a flashlight, a map and some snacks before the hike.AI-generated

Open weights, Apache-2.0 licence. Maker facts from hexgrad's model card on Hugging Face (huggingface.co/hexgrad/Kokoro-82M). Limits are the ones Tīrtha enforces today.

Request and response

Fields you send

FieldRequiredValues
modelyestirtha/kokoro-82m
inputyesThe text to speak, 1 to 4,096 characters.
voicenoaf_bella (Bella (American English, female)). Default af_bella.
response_formatnowav only, which is the default.

Fields not in this table are refused with unknown_parameter. That includes speed, which no model here takes.

What comes back

HTTP/1.1 200 OK
Content-Type: audio/wav
Cache-Control: no-store

<the wav audio file, as bytes>

The body is the audio file itself, ready to save or play. There is no JSON wrapper and no link to fetch. You are billed for the characters of input you sent.

If something goes wrong

Errors come back as JSON: {"error": {"code", "message", "type"}}. A call that fails is not charged.

HTTPCodeWhat it means
400invalid_inputThe text is empty or over the limit: split it.
400invalid_voiceThe voice is not one this model has.
400invalid_response_formatOnly wav is served.
400unknown_parameterA field the API does not take. Send only the fields above.
400invalid_requestThe body is not a JSON object.
400content_policyRefused by content policy. Nothing was charged.
400request_rejectedThe request was rejected. Nothing was charged.
402billing_requiredThis needs a prepaid credit account. Add credits in your dashboard first.
402insufficient_creditsNot enough prepaid credit for this request. The message says how much it may need.
404model_not_foundThe model id is wrong, or is not this kind of model.
404model_not_pricedThis model is not available yet.
429media_busyThis model is busy right now. Retry in a few seconds. Nothing was charged.
503billing_unavailableBilling is temporarily unavailable. Please retry.
503unavailableTemporarily unavailable. Nothing was charged.

What a job costs

An article of about 1,000 words (6,000 characters) costs about -

Worked out from the live price above, at about 6 characters a word, counting spaces. Punctuation counts too.

How to use it

Pick it for clear, quick English speech from a small, open model.

Model id tirtha/kokoro-82m · POST https://api.tirtha.ai/v1/audio/speech

VoicesBella (af_bella)
Audio formatsWAV
Text per callup to 4,096 characters
Comes back asthe audio file itself
curl https://api.tirtha.ai/v1/audio/speech \ -H "Authorization: Bearer $TIRTHA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "tirtha/kokoro-82m", "input": "Your order has shipped. It should arrive on Friday.", "voice": "af_bella", "response_format": "wav"}' \ --fail-with-body -o speech.wav || cat speech.wav # on an error the file holds the JSON error
import os, re, requests API = "https://api.tirtha.ai/v1/audio/speech" H = {"Authorization": "Bearer " + os.environ["TIRTHA_API_KEY"]} MAX = 4096 # characters per call for this model def chunks(text, limit=MAX): """split at sentence ends; a sentence longer than the limit is cut at its last space""" out, cur = [], "" for s in re.split(r"(?<=[.!?])\s+", text.strip()): while len(s) > limit: # one very long sentence: cut it under the limit cut = s.rfind(" ", 0, limit) if " " in s[:limit] else limit if cur: out.append(cur) cur = "" out.append(s[:cut].strip()) s = s[cut:].strip() if cur and len(cur) + 1 + len(s) > limit: out.append(cur) cur = s else: cur = (cur + " " + s).strip() return [c for c in out + [cur] if c] text = "Your order has shipped. It should arrive on Friday." for i, part in enumerate(chunks(text), 1): r = requests.post(API, headers=H, timeout=120, json={"model": "tirtha/kokoro-82m", "input": part, "voice": "af_bella", "response_format": "wav"}) if not r.ok: # the error body says what to fix; a failed call is not charged e = r.json()["error"] raise SystemExit(f'{e["code"]}: {e["message"]}') with open(f"speech-{i}.wav", "wb") as f: f.write(r.content) # the response body is the audio file itself
// Node 18+. Keep TIRTHA_API_KEY on your server, never in a web page. import { writeFile } from "node:fs/promises"; const r = await fetch("https://api.tirtha.ai/v1/audio/speech", { method: "POST", headers: { "Authorization": `Bearer ${process.env.TIRTHA_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ model: "tirtha/kokoro-82m", input: "Your order has shipped. It should arrive on Friday.", voice: "af_bella", response_format: "wav" }), }); if (!r.ok) { const e = (await r.json()).error; throw new Error(e.code + ": " + e.message); } await writeFile("speech.wav", Buffer.from(await r.arrayBuffer())); // the body is the audio file