# Text to Speech – Natural AI Voices, MP3/WAV, No API Key (`gazidev/text-to-speech`) Actor

Text to speech with 54 natural AI voices: turn texts, articles or audiobook chapters into MP3, WAV or OGG. Open-source Kokoro model, no API key or subscription, commercial use OK. 8 languages, speed, bulk, SRT timestamps. $0.10 per 1,000 characters.

- **URL**: https://apify.com/gazidev/text-to-speech.md
- **Developed by:** [Cemal Atakli](https://apify.com/gazidev) (community)
- **Categories:** AI, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 100 characters

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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Text to Speech – Natural AI Voices to MP3, WAV & OGG (No API Key)

Turn any text into natural-sounding speech with **54 neural AI voices** in 8 languages. Paste sentences, whole articles or audiobook chapters, pick a voice and get downloadable **MP3, WAV or OGG** files with public links in seconds.

The Actor runs the open-source **Kokoro-82M** text-to-speech model directly on Apify. There is **no API key, no ElevenLabs or OpenAI account and no per-voice subscription**. You pay only for the characters you convert, and the model's Apache-2.0 license allows commercial use of the audio.

### What it does

- Converts a list of texts (or every item of another Actor's dataset) to one audio file per text
- **54 voices**: US & British English (male and female), Spanish, French, Italian, Brazilian Portuguese, Hindi and Mandarin Chinese (beta)
- **Speed control** from 0.5× to 2×
- **MP3** (plays everywhere), **WAV** (24 kHz, for editing) or **OGG Opus** (tiny files for web and voice apps)
- **Long texts**: split into sentences, synthesized chunk by chunk and joined with natural pauses. Up to 100,000 characters per run by default (≈ 2 hours of audio)
- **Merge to one file**: join all texts into one audiobook-style file
- **SRT subtitles**: optional sentence-level timestamps for each file
- Bulk and API-friendly: every row has a public `fileUrl`, duration and file size

### Use cases

- **Audiobooks and articles to audio**: turn blog posts, newsletters and book chapters into MP3s or podcast episodes
- **Video voice-overs**: narration for YouTube, TikTok, Reels, explainer videos and slides, with SRT subtitles
- **E-learning**: course narration in English, Spanish, French, Italian, Portuguese or Hindi
- **Apps and IVR**: phone menu prompts, app notifications and voice bot replies (OGG Opus is perfect for that)
- **Accessibility**: listenable versions of documentation and web content
- **AI agents and automations**: give your scraper, LLM or Make/Zapier/n8n workflow a voice

### Input example

```json
{
  "texts": [
    "Welcome to our store! Orders over fifty dollars ship free.",
    "Chapter one. Alice was beginning to get very tired of sitting by her sister on the bank..."
  ],
  "voice": "af_heart",
  "language": "auto",
  "speed": 1.0,
  "format": "mp3",
  "bitrate": "96",
  "subtitles": false,
  "mergeToOneFile": false
}
```

To read texts from another Actor's results, set `datasetId` (ID or name) and `textField` (for example `text`, `markdown` or `article.body`). Every item becomes one audio file.

| Field | Default | Description |
|---|---|---|
| `texts` | 2 demo sentences | One audio file per text |
| `datasetId` / `textField` | – / `text` | Read texts from an Apify dataset |
| `voice` | `af_heart` | One of 54 voices (see the list in the input form) |
| `language` | `auto` | Pronunciation language; `auto` uses the voice's language |
| `speed` | `1.0` | 0.5 – 2.0 |
| `format` | `mp3` | `mp3`, `wav` or `ogg` (Opus) |
| `bitrate` | `96` | kbps for MP3/OGG |
| `subtitles` | `false` | Save an `.srt` file with sentence timestamps |
| `mergeToOneFile` | `false` | Also save one file with all texts joined |
| `splitLongText` / `maxChunkCharacters` | `true` / `400` | Sentence chunking for long texts |
| `maxCharacters` | `100000` | Safety limit for the whole run |

### Output example

One dataset row per text (the audio files are in the run's key-value store, with public links):

```json
{
  "index": 1,
  "textPreview": "Welcome to our store! Orders over fifty dollars ship free, and returns are accepted within 30 days.",
  "characters": 99,
  "voice": "af_heart",
  "language": "en-us",
  "speed": 1.0,
  "format": "mp3",
  "status": "ok",
  "durationSec": 6.38,
  "fileUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/speech-001.mp3",
  "fileKey": "speech-001.mp3",
  "sizeBytes": 77516,
  "subtitlesUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/speech-001.srt",
  "chunks": 1,
  "billedUnits": 1
}
```

Errors (for example an empty text) are returned as rows with `status: "error"`, `errorCode` and `error`, and are **not charged**. A `SUMMARY` record in the key-value store has the run totals.

### Pricing

Pay per use: **$0.10 per 1,000 characters**, billed as $0.01 per started 100 characters of each text (a 99-character sentence costs $0.01). Platform compute is included. Error rows, merged files and subtitles are free.

| | This Actor | ElevenLabs TTS Actor (dev00/elevenlabs-tts-actor) | PDF to MP3 (marielise.dev) |
|---|---|---|---|
| API key / external account | **Not needed** | Needs your own ElevenLabs API key and paid ElevenLabs credits | – |
| Cost model | $0.10 per 1,000 characters, all-inclusive | Actor price + your ElevenLabs plan | per run |
| Voices | 54 built-in voices, 8 languages | ElevenLabs voice library | – |
| Input | Texts or any Apify dataset, bulk | Texts | PDF files |
| Formats | MP3, WAV, OGG Opus + SRT | MP3 | MP3 |
| Users (last 30 days, Oct 2026) | new | 24 | 5 |

Examples: a 1,500-word blog post (~9,000 characters) ≈ $0.72; a 100,000-character book section ≈ $8.

### FAQ

**Do I need an ElevenLabs, OpenAI or Google API key?**
No. The voice model runs inside the Actor. You only need an Apify account.

**Can I use the audio commercially?**
The Kokoro-82M model weights are released under the **Apache-2.0** license, which allows commercial use. You are responsible for the text you convert. The voices are synthetic; do not use them to impersonate real people.

**How natural do the voices sound?**
Kokoro is one of the best-rated open TTS models. The best voices are `af_heart`, `af_bella` (US English) and `bf_emma` (British English). Non-English voices are good; Mandarin Chinese is marked beta because pronunciation of some characters can be wrong.

**How fast is it?**
It runs on CPU. At the default 2 GB memory expect very roughly one minute of processing per 1,000 characters (about one minute of audio); give the run more memory (4–8 GB = 2–4× more CPU) for long books. The price per character is the same at any memory size.

**Japanese?**
Not supported: the open phonemizer cannot read kanji.

**Numbers, dates, abbreviations?**
Numbers, money, dates and common abbreviations (Dr., p.m.) are read naturally in English. For unusual words, write them as they sound.

**Why is my long text split into chunks?**
Each chunk is up to ~400 characters, synthesized separately and joined with a short pause. This keeps quality stable on long texts. Turn off `splitLongText` to synthesize the whole text in one go.

**What happens when I reach my maximum cost per run?**
The Actor finishes the current text (shortened at a sentence end to what your budget covers) and stops gracefully. You are never charged more than your limit.

### Use with AI agents / Apify MCP

This Actor works as a tool for AI agents through the **Apify MCP server** (`https://mcp.apify.com`). Add the Actor to your MCP client (Claude, Cursor, VS Code, LangChain, n8n…) and the agent can call it with `{"texts": ["..."], "voice": "af_heart"}` and get back the `fileUrl` of each audio file. Typical prompts: *"Read this article aloud and give me an MP3"* or *"Create voice-overs for these 20 product descriptions"*.

You can also call it via the Apify API, the Python/JavaScript clients, or schedule it after a scraper with an integration (texts are read from the scraper's dataset with `datasetId`).

### Licenses and credits

- Model: [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) by hexgrad, **Apache-2.0** (ONNX export v1.0 from the [kokoro-onnx releases](https://github.com/thewh1teagle/kokoro-onnx/releases))
- Inference library: [kokoro-onnx](https://github.com/thewh1teagle/kokoro-onnx), MIT; ONNX Runtime, MIT
- Phonemizer: [espeak-ng](https://github.com/espeak-ng/espeak-ng) (GPL-3.0, used unmodified as a separate library via espeakng-loader, MIT) and phonemizer (GPL-3.0)
- Audio encoding: FFmpeg (LGPL/GPL), LAME, Opus

# Actor input Schema

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

One audio file per text. Each entry can be a sentence, an article or a whole book chapter (long texts are split into sentence chunks and joined automatically).

## `datasetId` (type: `string`):

Optional. Chain after another Actor (e.g. a scraper or an article extractor): every item's text field becomes one audio file.

## `textField` (type: `string`):

Field name in that dataset (dot notation for nested fields, e.g. `article.body`).

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

54 natural neural voices. The voice's language is used automatically unless you set Language.

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

How the text is read. Usually leave on Auto and pick a voice in your language. You can mix them, e.g. an American voice reading Spanish gives an accent.

## `speed` (type: `number`):

0.5 = half speed, 1 = normal, 2 = double speed.

## `format` (type: `string`):

Output file type. Audio is mono, 24 kHz.

## `bitrate` (type: `string`):

Ignored for WAV. 64–96 kbps is transparent for speech.

## `mergeToOneFile` (type: `boolean`):

Adds one extra audio file with all texts joined in order (e.g. chapters into one audiobook). Free: characters are charged once.

## `subtitles` (type: `boolean`):

Also save an .srt file per text with a timestamp for every sentence (chunks of max 200 characters). About 10% slower.

## `fileNamePrefix` (type: `string`):

Files are saved as `<prefix>-001.mp3`, `<prefix>-002.mp3`…

## `splitLongText` (type: `boolean`):

Recommended. Long texts are synthesized sentence by sentence and joined with natural pauses.

## `maxChunkCharacters` (type: `integer`):

Sentences are grouped into chunks up to this size.

## `maxCharacters` (type: `integer`):

The run stops after this many characters (the last text is cut at a sentence end). 100,000 characters ≈ 2 hours of audio.

## `modelVariant` (type: `string`):

Leave on Auto. Auto uses fp32 on x86 servers (Apify) and int8 on ARM. Same voice quality; only speed differs.

## Actor input object example

```json
{
  "texts": [
    "Hello! This voice was generated by an open-source AI model, with no API key and no subscription.",
    "Paste your own text, pick a voice and a format, and get a downloadable MP3 in seconds."
  ],
  "textField": "text",
  "voice": "af_heart",
  "language": "auto",
  "speed": 1,
  "format": "mp3",
  "bitrate": "96",
  "mergeToOneFile": false,
  "subtitles": false,
  "fileNamePrefix": "speech",
  "splitLongText": true,
  "maxChunkCharacters": 400,
  "maxCharacters": 100000,
  "modelVariant": "auto"
}
```

# Actor output Schema

## `audio` (type: `string`):

No description

## `results` (type: `string`):

No description

## `files` (type: `string`):

No description

## `summary` (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": [
        "Hello! This voice was generated by an open-source AI model, with no API key and no subscription.",
        "Paste your own text, pick a voice and a format, and get a downloadable MP3 in seconds."
    ],
    "voice": "af_heart",
    "speed": 1,
    "format": "mp3"
};

// Run the Actor and wait for it to finish
const run = await client.actor("gazidev/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": [
        "Hello! This voice was generated by an open-source AI model, with no API key and no subscription.",
        "Paste your own text, pick a voice and a format, and get a downloadable MP3 in seconds.",
    ],
    "voice": "af_heart",
    "speed": 1,
    "format": "mp3",
}

# Run the Actor and wait for it to finish
run = client.actor("gazidev/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": [
    "Hello! This voice was generated by an open-source AI model, with no API key and no subscription.",
    "Paste your own text, pick a voice and a format, and get a downloadable MP3 in seconds."
  ],
  "voice": "af_heart",
  "speed": 1,
  "format": "mp3"
}' |
apify call gazidev/text-to-speech --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gazidev/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/DU8wqpvgKqZLESTsy/builds/2Y8gUouwJEN1SEy4G/openapi.json
