Text-to-Speech API Documentation for Python Developers

By CreatorTTS Editorial Team · Updated 2026-11-19

This guide explains how to integrate the CreatorTTS API into Python workflows for YouTube content creation. You will learn to generate speech files using standard libraries or the OpenAI SDK by adjusting the base URL. The documentation covers authentication, request parameters, and error handling with concrete code examples.

Designed for developers and no-code creators, this page details the specific endpoints and voice presets available. You will find ready-to-use snippets for generating audio in MP3, WAV, or FLAC formats, along with explanations of rate limits and character constraints to ensure reliable script execution.

Text-to-Speech API Documentation for Python Developers

Frequently asked questions

How do I get an API key?

Sign up on the /get-api-key/ page using Google or email plus password. The page displays your active API key, balance, and usage statistics. You can issue a new key at any time, which immediately invalidates the previous one. Accounts created with email do not receive the free trial credit.

Can I use the OpenAI Python SDK?

Yes, the official OpenAI SDKs work perfectly. You simply change the base_url to https://api.playksr777.cc/v1 and provide your site-specific key. The request shape matches the OpenAI speech endpoint exactly, allowing you to use standard Python libraries.

What is the base URL for the API?

The base URL is https://api.playksr777.cc/v1. You use this endpoint for all API calls, including generating speech via POST requests. This URL is compatible with standard HTTP clients and the OpenAI Python SDK when configured correctly for your specific account key.

How do I set the response format?

Include the response_format field in your JSON body. Supported formats are mp3, wav, opus, flac, and pcm. The API returns the audio file directly in the response body. Choose the format that best fits your video editing workflow or playback requirements.

What happens if I exceed the rate limit?

The limit is 60 requests per minute per key. If you exceed this, requests may queue or fail. Failed requests are free, so you are not charged for retries. Initial usage starts at 10 requests per minute until you top up your balance.

Does the API support Python 3?

Yes, the API is a standard REST endpoint accessible from any Python 3 environment. Since it uses standard HTTP requests and JSON bodies, it works with any modern Python version. You can use libraries like requests or the official OpenAI Python client.

How do I handle audio streaming?

The API does not support streaming or WebSocket connections. It returns the complete audio file in the response after synthesis is finished. For long texts, you must split the input into parts, generate each audio file, and join them in your Python script.

Is the API key secure?

The API key authenticates your requests via the Authorization: Bearer header. Each account has one active key. You can rotate it instantly by issuing a new key, which invalidates the old one immediately. Keep your key secure to prevent unauthorized usage of your balance.

Can I rotate my API key?

Yes, you can issue a new key at any time from the dashboard. The new key becomes active immediately, and the old key stops working at once. This allows you to secure your account if you suspect the key has been compromised.

What is the maximum input length?

Each request supports up to 4096 characters of input text. For longer scripts, you should split the text into chunks of this size. Generate audio for each chunk and then join the resulting audio files to create a complete narration for your video.

How do I specify a language?

Include the language field with an ISO code in your request. If omitted, the system guesses the language, defaulting to English for Latin script. For non-English Latin text, always set the language explicitly to ensure correct pronunciation and voice selection.

Does the API return audio bytes or a URL?

The API returns the audio file directly in the response body. You receive the raw audio bytes or file data immediately after the synthesis process completes, allowing you to save it directly to your local drive.

Can I use multiple voices in one request?

No, each request supports only one voice preset. You must make separate API calls for each voice change. To create a multi-voice video, split your script, generate audio for each segment with the desired voice, and concatenate the files in your editing software.

How do I calculate character count?

Spaces and punctuation count as characters. The price is $0.01 per 1,000 characters ($10 per 1 million characters). Ensure your text length includes all spaces and punctuation marks to accurately estimate costs. The dashboard displays your current balance and characters used for precise tracking.

First request

curl

curl https://api.playksr777.cc/v1/audio/speech \
  -H "Authorization: Bearer $TTS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"tts-1","voice":"aria","input":"Hello from the API.","response_format":"mp3"}' \
  --output hello.mp3

Python (openai)

from openai import OpenAI

client = OpenAI(base_url="https://api.playksr777.cc/v1", api_key="tts-...")

with client.audio.speech.with_streaming_response.create(
    model="tts-1", voice="nova", input="Hello from Python.", response_format="mp3"
) as response:
    response.stream_to_file("hello.mp3")

Node.js (openai)

import OpenAI from "openai";
import fs from "node:fs";

const client = new OpenAI({ baseURL: "https://api.playksr777.cc/v1", apiKey: process.env.TTS_API_KEY });
const res = await client.audio.speech.create({ model: "tts-1", voice: "milo", input: "Hello from Node.js." });
fs.writeFileSync("hello.mp3", Buffer.from(await res.arrayBuffer()));
voice
ariafemale
novafemale
lunafemale
sagefemale
felixmale
milomale
atlasmale
orionmale
language
arالعربية
zh中文
daDansk
nlNederlands
enEnglish
fiSuomi
frFrançais
deDeutsch
elΕλληνικά
heעברית
hiहिन्दी
itItaliano
ja日本語
ko한국어
msBahasa Melayu
noNorsk
plPolski
ptPortuguês
ruРусский
esEspañol
swKiswahili
svSvenska
trTürkçe

Authentication

Sound wave illustration for: Authentication

Access the CreatorTTS API by generating a unique key on the /get-api-key/ page. You can sign up using Google or an email and password. The dashboard displays your active key, current balance, and usage statistics immediately after creation.

API Key Generation

API Key Generation

Keys are generated exclusively through the site's authentication page. Each account holds one active key at a time. If you need a fresh credential, you can issue a new key via the dashboard.

Bearer Token Usage

Bearer Token Usage

Include your key in the HTTP header as Authorization: Bearer tts-.... This token authenticates all requests to the API base URL. Ensure no extra spaces are included in the header value.

Key Rotation

Revoking your old key stops it immediately. This is useful if you suspect unauthorized use or want to rotate credentials regularly. The new key becomes active instantly upon generation.

Only one key is active per account. You cannot use multiple keys simultaneously for the same account.

  • Issue new key via /get-api-key/.
  • Old key stops at once.
  • One active key per account.

Endpoints Overview

Sound wave illustration for: Endpoints Overview

The API exposes three primary endpoints for managing speech synthesis. The Speech endpoint handles text-to-audio conversion, while Voices and Models endpoints provide metadata on available assets and engine configurations. The Models endpoint lists the available model variants.

Speech Endpoint

Send a POST request to /v1/audio/speech with your JSON payload. The system returns the generated audio file directly in the response body.

Voices Endpoint

Query GET /v1/voices to retrieve available voice presets, supported languages, and audio formats. This helps you select the correct voice ID for your synthesis requests.

Models Endpoint

Access GET /v1/models to list available model variants. Use this to verify the 'tts-1' and 'tts-1-hd' options before sending synthesis jobs.

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts plain text input up to 4096 characters per request. Spaces and punctuation count toward this limit. For longer scripts, split the text into chunks and join the resulting audio files sequentially.

You must specify one of eight voice presets. The system supports 23 languages, including English, Spanish, and German. If the language is not explicitly set, it defaults to English for Latin scripts.

Input Text

Send your script via the input field. The engine processes text at roughly real-time speed on long texts (about 25 characters per second of generation); short phrases take a few seconds. Ensure your payload stays under 4096 characters to avoid truncation.

  • Max 4096 characters per request
  • Spaces and punctuation count as characters
  • Split long texts manually before joining audio

Voice Selection

Choose from eight distinct voice profiles, ranging from warm narrators to energetic promo styles. Each voice supports all 23 listed languages. You can also optionally specify the language ISO code to ensure accurate pronunciation.

  • 8 presets: aria, nova, luna, sage, felix, milo, atlas, orion
  • Supports 23 languages
  • Language guessing defaults to English for Latin text

Response Format

Select your preferred audio codec from mp3, wav, opus, or flac. PCM is also available for uncompressed needs. The API returns the audio file directly in the response body for immediate download or playback.

  • mp3, wav, opus, flac, pcm
  • Direct audio file return
  • No streaming or partial chunks

Python Integration

Sound wave illustration for: Python Integration

To integrate CreatorTTS into your Python workflow, you can utilize the official OpenAI SDK by simply adjusting the base URL. This allows you to use familiar methods while routing requests to our API at https://api.playksr777.cc/v1.

OpenAI SDK Setup

Install the standard openai package via pip. Import the client class and initialize it using your unique API key. This approach leverages existing community resources and simplifies the transition for developers already familiar with OpenAI's library structure.

Base URL Configuration

Set the base_url parameter to https://api.playksr777.cc/v1 during client initialization. This directs all subsequent speech synthesis requests to our endpoints without requiring custom network logic or middleware adjustments.

Request Library

For those preferring direct HTTP calls, the requests library works seamlessly. Send a POST request to /v1/audio/speech with your JSON payload. Ensure the Authorization header includes your Bearer token for authentication.

Code Examples

Sound wave illustration for: Code Examples

This section provides ready-to-use code snippets for integrating the CreatorTTS API into your Python scripts. You can use standard HTTP libraries or the OpenAI SDK with a custom base URL to generate audio files directly from your text input.

The examples below demonstrate how to structure your requests, handle authentication, and process the returned audio data efficiently for your YouTube video production workflow.

cURL Example

Use this command to test the API directly from your terminal. Replace YOUR_API_KEY with your key from the dashboard.

```bash curl -X POST https://api.playksr777.cc/v1/audio/speech \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "tts-1", "input": "Hello world", "voice": "nova", "response_format": "mp3"}' \ -o output.mp3 ```

Python Requests Example

For programmatic integration, use the requests library. This script sends the text and receives the audio file as binary data.

```python import requests url = "https://api.playksr777.cc/v1/audio/speech" headers = {"Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"} payload = {"model": "tts-1", "input": "Hello world", "voice": "nova", "response_format": "mp3"} response = requests.post(url, headers=headers, json=payload) with open("output.mp3", "wb") as f: f.write(response.content) ```

JSON Body Structure

The API expects a JSON object with the following fields. The input field accepts up to 4096 characters.

```json { "model": "tts-1", "input": "Your text here", "voice": "nova", "response_format": "mp3", "speed": 1.0, "language": "en" } ```

  • model: "tts-1" or "tts-1-hd"
  • "voice": One of 8 presets
  • "response_format": mp3, wav, opus, flac, or pcm
  • "speed": 0.25 to 4.0
Code Examples

Audio Formats

Sound wave illustration for: Audio Formats

The API supports five audio formats to suit different YouTube production needs. You can choose MP3, WAV, Opus, FLAC, or PCM for the response_format parameter in your requests.

MP3 Support

MP3 is the default format and offers a good balance between file size and quality. It is widely compatible with most video editing software and YouTube’s upload system.

WAV Support

WAV provides uncompressed audio, ensuring no quality loss during editing. This format is ideal for high-fidelity voiceovers where you plan to apply further audio effects.

Opus and FLAC

Opus offers high-quality compression for efficient storage. FLAC provides lossless compression, preserving original audio quality while reducing file size compared to WAV.

Rate Limits

Sound wave illustration for: Rate Limits

Rate limits protect the API infrastructure during high-volume synthesis. Your account key allows up to 60 requests per minute once fully active, ensuring predictable throughput for batch processing YouTube scripts.

60 Requests Per Minute

Each active API key supports a maximum throughput of 60 requests per minute. This limit applies uniformly across all models and voices, allowing consistent performance for standard text-to-speech workflows without requiring complex load balancing for moderate usage.

Initial Limit

Accounts created with email and password start with a limit of 10 requests per minute before the first top-up. This lower tier prevents resource exhaustion during the trial phase while allowing sufficient testing of voice quality and integration logic.

Limit After Top-Up

After your first top-up of at least $5 via USDT (TRC-20), your rate limit increases to 60 requests per minute. The increase is automatic and applies immediately to your active key, enabling full production-scale synthesis.

Error Handling

Sound wave illustration for: Error Handling

The API returns standard HTTP status codes to indicate success or failure. A 200 OK response confirms audio generation, while 4xx errors typically indicate authentication or parameter issues. Failed synthesis requests are free, ensuring you are not charged for incomplete audio files.

Common Error Codes

Use 401 for invalid or expired API keys. A 429 status indicates you have exceeded the 60 requests per minute limit. Other 4xx codes signal missing required fields or unsupported parameters in the request body.

  • 401 Unauthorized: Check your Bearer token.
  • 429 Too Many Requests: Wait for the rate limit window to reset.
  • 400 Bad Request: Verify required fields like 'model' and 'voice'.

Retry Logic

Implement exponential backoff for transient errors like 429 or 503. Since requests are processed sequentially, short delays help avoid queue congestion. Retries should respect the rate limit to prevent further throttling.

Character Limit Error

Each request supports up to 4096 characters of input text. Exceeding this limit returns an error. Split long texts into chunks and join the resulting audio files programmatically to handle longer content efficiently.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. This limit ensures consistent processing speed but requires careful script management to avoid truncation or awkward pauses between joined segments.

Avatar of the voice aria
ariafemale
Avatar of the voice nova
novafemale
Avatar of the voice luna
lunafemale
Avatar of the voice sage
sagefemale
Avatar of the voice felix
felixmale
Avatar of the voice milo
milomale
Avatar of the voice atlas
atlasmale
Avatar of the voice orion
orionmale

23 languages

Any voice speaks any of these languages.

Sources and further reading

  1. Wikipedia
  2. openai-node on GitHub
  3. ISO 639 language codes
  4. openai-python on GitHub
  5. curl documentation
  6. Node.js documentation
  7. IETF RFC 7845: Ogg Opus
  8. FFmpeg documentation
  9. OpenAI API reference: create speech
  10. LibriVox public-domain audiobooks
  11. LibriTTS-R corpus (OpenSLR 141)
  12. TRON developer hub: TRC-20

More on this site