# Kokoro Text to Speech - 54 voices, 9 languages, MP3 output (`superslowsloth/kokoro-text-to-speech`) Actor

Turn text into natural speech with the Kokoro-82M model. 54 voices, 9 languages, MP3/WAV/Opus/FLAC.

- **URL**: https://apify.com/superslowsloth/kokoro-text-to-speech.md
- **Developed by:** [Superslow Sloth](https://apify.com/superslowsloth) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $90.00 / 1,000 1,000 characters spokens

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Kokoro Text to Speech — 54 voices, 9 languages

Turns text into natural speech with [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M),
an open-weight text-to-speech model that punches far above its 82 million parameters.
54 voices across nine languages, delivered as MP3, WAV, Opus, FLAC or AAC.

Paste a list of texts. Get back one audio file per entry, plus a row describing each one.

### Input

| Field | Type | Default | What it does |
|---|---|---|---|
| `texts` | array | — | One entry per audio file. A long entry is split at sentence boundaries and joined back into a single file, so a whole article can go in one line. Up to 500,000 characters per run. |
| `voice` | select | `af_heart` | One of 54 voices. The first letter is the accent (`a` American, `b` British, `e` Spanish, `f` French, `h` Hindi, `i` Italian, `j` Japanese, `p` Portuguese, `z` Mandarin); the second is the speaker's gender. |
| `language` | select | `en-us` | Pronunciation rules the text is read with: `en-us`, `en-gb`, `es`, `fr-fr`, `hi`, `it`, `ja`, `pt-br`, `cmn`. |
| `speed` | select | `1.0` | 0.5x to 2.0x. 1.0 is the model's natural pace. |
| `audioFormat` | select | `mp3` | `mp3`, `wav`, `opus`, `flac`, `aac`. |

Match the language to the voice. A Japanese voice reading English under American
pronunciation rules sounds wrong in a way no amount of voice-shopping fixes.

### Output

The audio goes to the run's key-value store — a dataset record is JSON and cannot hold
bytes — and each dataset row carries its URL:

```
index             position of the text in your input list
audio_url         the generated file
duration_seconds  length of the audio
character_count   characters actually spoken
billed_units      what this row was charged: characters rounded up to the next 1,000
voice             the voice used
language          the pronunciation rules used
speed             the rate it was spoken at
audio_format      the container
sample_rate       24,000 Hz
chunks            how many synthesis chunks the text was split into
text              the text as it was spoken, after splitting and rejoining
```

### Billing

Pay per event, priced per 1,000 characters and rounded up, plus a small `actor-start` fee
covering the cold start and model load. The unit is characters rather than seconds of
audio so the price of a job is known **before** it runs: a 40,000-character article is
40 units whatever the voice does with it.

- An empty entry is not synthesised and not charged.
- A run stops as soon as your spending limit is reached, rather than continuing to
  generate audio you are not paying for.

### Quality notes

- Long text is split at sentence boundaries, never mid-sentence. A cut inside a sentence
  is audible — the prosody resets and the join clicks.
- The model runs on ONNX Runtime at full precision. The quantised build is roughly a
  third of the size but noticeably noisier on sibilants.
- Kokoro is expressive but not controllable: there are no SSML tags, no per-word emphasis
  and no emotion parameter. What you shape it with is punctuation and the voice choice.
- Numbers, abbreviations and units are read as written. `Dr.` and `3.5 kg` are handled;
  a bare `2026-08-30` is read as digits, so spell out anything you want spoken a
  particular way.

### What it does not do

- No voice cloning. The 54 voices are the voices.
- No streaming. This is a batch actor: it returns files, not a live audio stream.
- No word-level timestamps.

# Actor input Schema

## `texts` (type: `array`):

One entry per audio file. Long entries are split at sentence boundaries and joined back into a single file, so a whole article can go in one line. Up to 500,000 characters per run.

## `voice` (type: `string`):

Voice pack to speak with. The first letter is the accent (a: American, b: British, e: Spanish, f: French, h: Hindi, i: Italian, j: Japanese, p: Portuguese, z: Mandarin), the second is the speaker's gender.

## `language` (type: `string`):

Which pronunciation rules the text is read with. Match it to the voice: a Japanese voice reading English with American rules sounds wrong in a way no voice choice fixes.

## `speed` (type: `string`):

Playback rate the model speaks at. 1.0 is the model's natural pace.

## `audioFormat` (type: `string`):

Container the audio is delivered in. MP3 plays everywhere; WAV is uncompressed and much larger; Opus is the smallest at the same quality.

## `precision` (type: `string`):

Full precision sounds slightly cleaner on sibilants. Quantised is markedly faster, which on a per-character price is what you are paying for.

## Actor input object example

```json
{
  "texts": [
    "Kokoro is an open weight text to speech model with eighty two million parameters."
  ],
  "voice": "af_heart",
  "language": "en-us",
  "speed": "1.0",
  "audioFormat": "mp3",
  "precision": "int8"
}
```

# Actor output Schema

## `speech` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "texts": [
        "Kokoro is an open weight text to speech model with eighty two million parameters."
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("superslowsloth/kokoro-text-to-speech").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "texts": ["Kokoro is an open weight text to speech model with eighty two million parameters."] }

# Run the Actor and wait for it to finish
run = client.actor("superslowsloth/kokoro-text-to-speech").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "texts": [
    "Kokoro is an open weight text to speech model with eighty two million parameters."
  ]
}' |
apify call superslowsloth/kokoro-text-to-speech --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,superslowsloth/kokoro-text-to-speech"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/6DQwApBF6VGxM4zoo/builds/6jpVUfZlrUTGWebeX/openapi.json
