# Text to Speech (`hgservices/text-to-speech`) Actor

Turn any text into natural-sounding speech with AI voices in seconds. Powered by world class AI models, with multilingual voices and MP3, WAV, FLAC, Opus & AAC output. No setup or coding required.

- **URL**: https://apify.com/hgservices/text-to-speech.md
- **Developed by:** [Harish Garg](https://apify.com/hgservices) (community)
- **Categories:** AI, MCP servers, Agents
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.06 / 1,000 characters converted to speeches

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use 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

## Text to Speech (Deepgram Aura)

**Text to Speech** converts any text into **natural-sounding speech audio** in seconds using **Deepgram's Aura-2** AI voice models. Paste in a sentence or a paragraph, pick a **voice** and an **audio format**, and get back a ready-to-play audio file — **MP3, WAV, FLAC, Opus, or AAC** — that you can download, stream, or drop straight into your apps and automations.

No servers, no audio engineering, and no separate voice-API account to manage. Running on the Apify platform gives you **API access, scheduling, monitoring, automatic retries**, and one-click integration into automation tools like **Make, Zapier, and n8n**.

### Why use Text to Speech?

- **Accessibility** — turn articles, docs, and notifications into audio people can listen to on the go.
- **Voiceovers & narration** — create natural voice tracks for videos, product demos, and e-learning courses.
- **IVR & voice notifications** — generate spoken prompts for phone systems, alerts, and voice assistants.
- **Content at scale** — batch-convert blog posts, newsletters, or scripts into audio automatically.
- **Fast prototyping** — hear how your copy sounds across many voices before you commit.

### How to use Text to Speech

1. Click **Try for free** and open the **Input** tab.
2. Paste the **text** you want to convert (up to 2,000 characters per run).
3. Choose a **voice** (e.g. _Aura 2 · Thalia_) and an **audio format** (MP3 by default).
4. Click **Start** and wait a few seconds.
5. Open the **Output** tab to **play and download** your audio file.

That's it — no setup, no API keys, no coding required.

### Input

Configure your run from the **Input** tab or via the API.

| Field    | Type              | Description                                                                     |
| -------- | ----------------- | ------------------------------------------------------------------------------- |
| `text`   | string (required) | The text to convert to speech. Up to 2,000 characters.                          |
| `model`  | string            | Aura-2 voice model — featured voices across English, Spanish, Dutch, French, German, Italian, and Japanese. Default `aura-2-thalia-en`. |
| `format` | string            | Output audio format: `mp3`, `wav`, `flac`, `opus`, or `aac`. Default `mp3`.     |
| `speed`  | string            | Speaking-rate multiplier (`1` = normal). Optional; not supported by all voices. |

Example input:

```json
{
    "text": "Welcome to our podcast. In today's episode, we explore how AI voices are changing the way we create and consume content.",
    "model": "aura-2-thalia-en",
    "format": "mp3"
}
````

### Output

Your generated audio file is saved and made available for download, along with a data record describing the run. You can export the data in **JSON, HTML, CSV, or Excel**.

Example output record:

```json
{
    "audioUrl": "https://api.apify.com/v2/key-value-stores/XXXX/records/audio-1784257804976.mp3",
    "audioKey": "audio-1784257804976.mp3",
    "text": "Welcome to our podcast. In today's episode...",
    "model": "aura-2-thalia-en",
    "format": "mp3",
    "characterCount": 118
}
```

#### Data table

| Field            | Description                                          |
| ---------------- | ---------------------------------------------------- |
| `audioUrl`       | Direct link to download the generated audio file.    |
| `audioKey`       | The name of the stored audio file.                   |
| `text`           | The input text that was converted.                   |
| `model`          | The voice used.                                      |
| `format`         | The audio format of the output file.                 |
| `characterCount` | Number of characters converted (used for billing).   |

### Pricing

This Actor uses Apify's **pay-per-event** pricing — you pay a small, predictable amount per run with **no separate voice-API bill to manage**:

| Charge | When it applies | What it covers |
| --- | --- | --- |
| **Run start** | Once per run | Starting the run and spinning up the audio generation. |
| **Characters converted** | Per run | The text-to-speech generation itself, billed per character of text. |

Because each run converts up to 2,000 characters, the cost per run is small and easy to predict. The exact prices are shown on this Actor's page in Apify Store, and **all voice-generation costs are already included** — you never need your own voice-API account.

New Apify users get free monthly usage credits to try the Actor at no cost.

### Tips & advanced options

- Keep each run under **2,000 characters**; split longer content into multiple runs.
- Choose `wav` or `flac` for lossless quality, or `mp3`/`aac`/`opus` for smaller files.
- Use the `speed` field to slow down or speed up narration where supported.
- **Automate at scale** by calling the Actor via the [Apify API](https://docs.apify.com/api/v2) or by scheduling recurring runs.

### FAQ and support

**Which languages are supported?** Aura-2 offers featured voices in English, Spanish, Dutch, French, German, Italian, and Japanese, with more added over time. Choose the `model` that matches your language.

**Is there a character limit?** Yes — up to 2,000 characters per run.

**What audio formats can I get?** MP3, WAV, FLAC, Opus, and AAC.

**Can I use the audio commercially?** Audio is generated with Deepgram's Aura-2 models; review Deepgram's terms for your specific use case.

Found a bug or have a feature request? Open an issue on this Actor's **Issues** tab. Custom voice or workflow needs can be accommodated on request.

# Actor input Schema

## `text` (type: `string`):

The plain text to convert into spoken audio (no SSML markup). Limited to 2000 characters per run — roughly a couple of minutes of speech. Longer input is rejected, so split large text into several runs.

## `model` (type: `string`):

The Deepgram Aura-2 voice used to generate the speech. The voice you pick also determines the spoken language and accent. Each option is labelled as Language, Accent, Gender, Age · Name. Featured voices cover English, Spanish, Dutch, French, German, Italian, and Japanese.

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

The file format of the generated audio. MP3 is the smallest and most widely compatible; WAV and FLAC are lossless (larger, best for editing); Opus is efficient for streaming; AAC works well for Apple and mobile playback.

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

Speaking rate multiplier that adjusts the pace of the generated speech (1 = normal). Deepgram Aura supports 0.7–1.5. For Spanish voices, keep it at 0.9 or above; lower values may introduce disfluencies.

## Actor input object example

```json
{
  "text": "Hi there, and thanks for stopping by! This is a quick demo of natural-sounding text to speech. Paste in your own script — a podcast intro, a voiceover, an audiobook chapter, or an IVR message — pick a voice, and you'll have a polished audio file in seconds.",
  "model": "aura-2-thalia-en",
  "format": "mp3",
  "speed": "1"
}
```

# Actor output Schema

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

Generated audio files in the key-value store

## `dataset` (type: `string`):

Generated speech metadata with audio URLs

# 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 = {
    "text": "Hi there, and thanks for stopping by! This is a quick demo of natural-sounding text to speech. Paste in your own script — a podcast intro, a voiceover, an audiobook chapter, or an IVR message — pick a voice, and you'll have a polished audio file in seconds."
};

// Run the Actor and wait for it to finish
const run = await client.actor("hgservices/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 = { "text": "Hi there, and thanks for stopping by! This is a quick demo of natural-sounding text to speech. Paste in your own script — a podcast intro, a voiceover, an audiobook chapter, or an IVR message — pick a voice, and you'll have a polished audio file in seconds." }

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

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

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

```

## CLI example

```bash
echo '{
  "text": "Hi there, and thanks for stopping by! This is a quick demo of natural-sounding text to speech. Paste in your own script — a podcast intro, a voiceover, an audiobook chapter, or an IVR message — pick a voice, and you'\''ll have a polished audio file in seconds."
}' |
apify call hgservices/text-to-speech --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=hgservices/text-to-speech",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Text to Speech",
        "description": "Turn any text into natural-sounding speech with AI voices in seconds. Powered by world class AI models, with multilingual voices and MP3, WAV, FLAC, Opus & AAC output. No setup or coding required.",
        "version": "0.0",
        "x-build-id": "U0c6sNJjGOS9zqLpY"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/hgservices~text-to-speech/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-hgservices-text-to-speech",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/hgservices~text-to-speech/runs": {
            "post": {
                "operationId": "runs-sync-hgservices-text-to-speech",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/hgservices~text-to-speech/run-sync": {
            "post": {
                "operationId": "run-sync-hgservices-text-to-speech",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "text"
                ],
                "properties": {
                    "text": {
                        "title": "Text to convert",
                        "maxLength": 2000,
                        "type": "string",
                        "description": "The plain text to convert into spoken audio (no SSML markup). Limited to 2000 characters per run — roughly a couple of minutes of speech. Longer input is rejected, so split large text into several runs."
                    },
                    "model": {
                        "title": "Voice model",
                        "enum": [
                            "aura-2-thalia-en",
                            "aura-2-andromeda-en",
                            "aura-2-helena-en",
                            "aura-2-apollo-en",
                            "aura-2-arcas-en",
                            "aura-2-aries-en",
                            "aura-2-celeste-es",
                            "aura-2-estrella-es",
                            "aura-2-nestor-es",
                            "aura-2-rhea-nl",
                            "aura-2-sander-nl",
                            "aura-2-beatrix-nl",
                            "aura-2-agathe-fr",
                            "aura-2-hector-fr",
                            "aura-2-julius-de",
                            "aura-2-viktoria-de",
                            "aura-2-livia-it",
                            "aura-2-dionisio-it",
                            "aura-2-fujin-ja",
                            "aura-2-izanami-ja"
                        ],
                        "type": "string",
                        "description": "The Deepgram Aura-2 voice used to generate the speech. The voice you pick also determines the spoken language and accent. Each option is labelled as Language, Accent, Gender, Age · Name. Featured voices cover English, Spanish, Dutch, French, German, Italian, and Japanese.",
                        "default": "aura-2-thalia-en"
                    },
                    "format": {
                        "title": "Audio format",
                        "enum": [
                            "mp3",
                            "wav",
                            "flac",
                            "opus",
                            "aac"
                        ],
                        "type": "string",
                        "description": "The file format of the generated audio. MP3 is the smallest and most widely compatible; WAV and FLAC are lossless (larger, best for editing); Opus is efficient for streaming; AAC works well for Apple and mobile playback.",
                        "default": "mp3"
                    },
                    "speed": {
                        "title": "Speaking speed",
                        "enum": [
                            "0.7",
                            "0.8",
                            "0.9",
                            "1",
                            "1.1",
                            "1.25",
                            "1.5"
                        ],
                        "type": "string",
                        "description": "Speaking rate multiplier that adjusts the pace of the generated speech (1 = normal). Deepgram Aura supports 0.7–1.5. For Spanish voices, keep it at 0.9 or above; lower values may introduce disfluencies.",
                        "default": "1"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
