Skip to content

Kokoro

Fast, clear narration in 54 ready-made voices.

kokoro

Samples

0:00 / 0:09
Transcript

The river bends past the old mill, where a narrow footbridge crosses to the orchard on the far bank, and the path climbs gently into the hills.

Voice af_heart

Capabilities

Voices
54 built-in voices; the first letter of the id names the language, the second the gender (af_heart: American English, female)
Languages
8: English (US and UK), Spanish, French, Hindi, Italian, Japanese, Brazilian Portuguese, Chinese
Speed
0.5 to 2.0, set with speed
Text
Up to 20,000 characters per request
Voice cloning
Not supported; clone with OmniVoice
Output
MP3, WAV or Opus, set with response_format

Request

The request for the sample above.

curl

curl https://api.albastov.com/v1/audio/speech \
  -H "Authorization: Bearer $ALBASTOV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kokoro",
    "voice": "af_heart",
    "input": "The river bends past the old mill, where a narrow footbridge crosses to the orchard on the far bank, and the path climbs gently into the hills."
  }' \
  --output river.mp3

Python

import os
from openai import OpenAI

client = OpenAI(base_url="https://api.albastov.com/v1", api_key=os.environ["ALBASTOV_API_KEY"])

with client.audio.speech.with_streaming_response.create(
    model="kokoro",
    voice="af_heart",
    input="The river bends past the old mill, where a narrow footbridge crosses to the orchard on the far bank, and the path climbs gently into the hills.",
) as response:
    response.stream_to_file("river.mp3")

JavaScript

import { writeFile } from "node:fs/promises";

const response = await fetch("https://api.albastov.com/v1/audio/speech", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ALBASTOV_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "kokoro",
    voice: "af_heart",
    input: "The river bends past the old mill, where a narrow footbridge crosses to the orchard on the far bank, and the path climbs gently into the hills.",
  }),
});
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);
await writeFile("river.mp3", Buffer.from(await response.arrayBuffer()));

Every parameter, response header and error: Speech reference.