Inference APIs
Models/Speech/Kokoro 82M
Text to speech54 voicesMP3 / WAV8 languages
Modality
Text → Audio
Price
$5.2 / 1M characters
300 chars → audio
0.84 s
Model ID
hexgrad/Kokoro-82M

Quickstart

You need an API key to call this model. Create a free account or log in.

Set INFERENCE_API_KEY to your key from the API Keys page, then run:

curl https://api.inferenceapis.com/v1/audio/speech \
  -H "Authorization: Bearer $INFERENCE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "hexgrad/Kokoro-82M",
    "input": "Hello! This is Kokoro 82M speaking.",
    "voice": "af_heart",
    "response_format": "mp3"
  }' --output speech.mp3
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.inferenceapis.com/v1",
    api_key=os.environ["INFERENCE_API_KEY"],
)
with client.audio.speech.with_streaming_response.create(
    model="hexgrad/Kokoro-82M",
    voice="af_heart",
    input="Hello! This is Kokoro 82M speaking.",
    response_format="mp3",
) as response:
    response.stream_to_file("speech.mp3")
import fs from "node:fs";
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.inferenceapis.com/v1",
  apiKey: process.env.INFERENCE_API_KEY,
});
const audio = await client.audio.speech.create({
  model: "hexgrad/Kokoro-82M",
  voice: "af_heart",
  input: "Hello! This is Kokoro 82M speaking.",
  response_format: "mp3",
});
fs.writeFileSync("speech.mp3", Buffer.from(await audio.arrayBuffer()));

Endpoint

POST https://api.inferenceapis.com/v1/audio/speech
Headers Authorization: Bearer $INFERENCE_API_KEY
Content-Type: application/json
Compatible OpenAI wire format. /openai/v1/… is accepted too, so Groq-style base URLs work with only the host changed.

Model IDs and aliases

Send any of these as model; they all resolve to this model.

IDNote
hexgrad/Kokoro-82MCanonical
kokoroAlias
kokoro-82mAlias
tts-1Alias

Request body

ParameterTypeDescription
model required string Model ID: hexgrad/Kokoro-82M
input required string The text to speak. Up to 20,000 characters per request.
voice string Voice id. Default af_heart. See the voice list below.
response_format string mp3 (default), wav or raw (PCM).
speed number Playback speed multiplier, e.g. 1.1.
language string Language hint for multilingual voices, e.g. en, ja.

Voices

Click a voice to copy its id. Hear them in the playground.

Response

200 OK · audio
Binary audio (Content-Type: audio/mpeg for mp3, audio/wav for wav).
Headers:
  X-Usage-Characters: 42        # characters billed for this request

Pricing

Price$5.2 / 1M characters
BillingPay as you go from prepaid credits. No subscription, no daily request or token cap. See all pricing.

Notes

  • Voice ids are prefixed by language and gender: af_ American female, am_ American male, bf_/bm_ British, jf_/jm_ Japanese, zf_/zm_ Mandarin, ef_/em_ Spanish, ff_ French, hf_/hm_ Hindi, if_/im_ Italian, pf_/pm_ Portuguese.
  • Billing is per character of input text; the X-Usage-Characters response header reports the metered count.

Compare Kokoro 82M with…

Languages

Per-language voice lists and samples: text-to-speech languages.

Errors

Errors use the OpenAI envelope: {"error": {"message", "type", "code"}}. 401 missing or invalid key · 402 insufficient_balance · 404 model_not_found · 503 model_unavailable. See the error reference and provider error guides.