Text-to-Speech API Documentation for YouTube Creators

By CreatorAudio editorial team · Updated 2026-11-19

This guide helps YouTube creators and freelancers integrate CreatorAudio’s text-to-speech API into their production workflow. You will learn how to generate natural-sounding voiceovers from scripts using simple HTTP requests or the OpenAI SDK, covering endpoints, parameters, and response formats specific to our TTS engine.

We provide concrete examples for getting your API key, making your first request, and handling rate limits. The documentation details supported languages, voice presets, and audio formats like MP3 and WAV, ensuring you can produce scalable voiceovers for videos without hiring additional voice actors.

Text-to-Speech API Documentation for YouTube Creators

Frequently asked questions

What is the base URL?

The API base URL is https://api.31u.info/v1. You send POST requests to /v1/audio/speech for synthesis and GET requests to /v1/voices or /v1/models for metadata. This endpoint structure mirrors the OpenAI speech API, ensuring compatibility with standard HTTP clients and SDKs that support custom base URLs.

Do I need the OpenAI SDK?

No, you do not need the OpenAI SDK, though it works by changing the base_url. You can use any standard HTTP client or library. The API accepts standard JSON bodies with fields like model, input, voice, and response_format, making it easy to integrate with your existing Python, Node, or Go workflows.

How do I set the language?

Pass the optional language field with an ISO code in your request JSON. If omitted, the system guesses the language from the script, defaulting to English for Latin text. For non-English Latin-script text, explicitly setting the language is recommended to ensure accurate synthesis across the 23 supported languages.

Can I use SSML?

No, the API does not support SSML. You send plain text in the input field. If you need pauses or emphasis, you can adjust the speed parameter or split your text into multiple requests. The API focuses on straightforward text-to-speech conversion without complex markup support.

What is the character limit?

Each request supports up to 4096 characters in the input field. Spaces and punctuation count toward this limit. For longer scripts, split your text into chunks of 4096 characters or less, generate audio for each part, and join the resulting audio files in your workflow.

How do I change the voice?

Include the voice field in your request JSON with one of the eight preset names: aria, nova, luna, sage, felix, milo, atlas, or orion. Each voice has a distinct tone, from warm narrators to energetic promo styles, matching the preset descriptions. You can select the voice that best fits your YouTube content style.

What formats are supported?

You can specify the response_format as mp3, wav, opus, flac, or pcm. MP3 is efficient for web delivery, while WAV and FLAC offer lossless quality. PCM provides raw audio data. Choose the format that suits your editing software and distribution requirements.

What happens if I hit the rate limit?

The limit is 60 requests per minute per key (10 per minute before the first top-up). Requests are processed sequentially, so exceeding the limit may cause delays as your request waits in the queue. Monitor your usage via the dashboard and consider spacing out requests for large batches.

How do I check my balance?

Log in to the /get-api-key/ page on 31u.info to view your balance, trial status, and characters used. The dashboard displays your current credit, usage history, and a ready-to-use cURL example. Your balance does not expire, and you can top up via USDT on the TRON network.

Is the API RESTful?

Yes, the API follows RESTful principles. You use standard HTTP methods: POST for generating speech and GET for retrieving voices or models. It returns standard JSON responses for metadata or binary audio data for synthesis. This design makes it easy to integrate into existing web applications or automation scripts.

Do I need authentication?

Yes, include an Authorization: Bearer tts-... header with your API key in every request. You can generate or view your key on the /get-api-key/ page. Each account has one active key; issuing a new one immediately invalidates the old one, so manage your keys carefully.

How do I handle long texts?

Split your text into parts of up to 4096 characters. Send each part as a separate POST request to /v1/audio/speech. Collect the returned audio files and join them in your preferred audio editor or script. This ensures each request stays within the character limit for successful synthesis.

Can I stream audio?

No, the API does not support streaming or real-time partial audio. You receive the complete audio file in the response after synthesis finishes. For long texts, you must wait for each chunk to generate before proceeding. This synchronous approach simplifies integration but requires handling file assembly.

Is there a WebSocket option?

No, there is no WebSocket option. The API uses standard HTTP POST requests for speech synthesis. You send text and receive the audio file in the response. This RESTful approach is reliable and easy to implement with any standard HTTP client without maintaining persistent connections.

First request

curl

curl https://api.31u.info/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.31u.info/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.31u.info/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

Get Your API Key

Sound wave illustration for: Get Your API Key

Access the /get-api-key/ page on 31u.info to create your account. You can register using Google for immediate access or email with a password. This step establishes your account for the API service.

Sign Up on the Site

Sign Up on the Site

Navigate to the registration page and choose your preferred method. Google sign-in provides instant access with a $0.50 trial credit valid for 7 days. Email registration works but starts without trial credit, requiring an immediate top-up to begin generating audio.

  • Google sign-in: instant access, $0.50 trial credit
  • Email + password: standard registration, no trial credit
  • Accounts are per site (31u.info)

Copy Your Key

Copy Your Key

Once registered, your dashboard displays your single active API key. Copy this key starting with 'tts-'. It is the only credential needed for authentication. You can generate a new key at any time, which instantly invalidates the previous one.

  • Key format: tts-...
  • One active key per account
  • New key invalidates old one immediately

Secure Your Key

Treat your API key like a password. It grants access to your billing and usage. While the key is visible in your dashboard, avoid sharing it in public repositories or client-side code where it can be extracted. Use environment variables in your production scripts.

First Request with Curl

Sound wave illustration for: First Request with Curl

Generate audio files directly from your script using a simple HTTP POST request. This section covers the fundamental curl command, the required JSON payload structure, and the binary response format you will receive.

The API accepts plain text input and returns synthesized speech after processing. Ensure your text does not exceed 4,096 characters per request to avoid truncation.

Basic Curl Command

Send your first synthesis request using the following curl command. Replace YOUR_API_KEY with your actual key and update the voice model if needed.

This command targets the speech endpoint and passes your script directly as the input body.

  • Endpoint: https://api.31u.info/v1/audio/speech
  • Method: POST
  • Auth: Authorization: Bearer YOUR_API_KEY

JSON Body Structure

The request body must be valid JSON containing the model, input, and voice fields. The model field accepts either tts-1 or tts-1-hd.

Specify the text content in input and select one of the eight available voices. Optional fields like speed allow fine-tuning from 0.25 to 4.0.

  • model: "tts-1" or "tts-1-hd"
  • input: Your script text (max 4096 chars)
  • voice: e.g., "aria", "nova", "atlas"
  • response_format: "mp3", "wav", "opus", "flac", or "pcm"

Response Format

On success, the API returns the audio file directly in the requested binary format. For example, if you requested MP3, the response body is the raw audio data.

If the request fails, you receive a JSON error object with a descriptive message. Failed requests do not incur charges.

Using the OpenAI SDK

Sound wave illustration for: Using the OpenAI SDK

Leverage the official OpenAI SDKs to integrate CreatorAudio’s TTS engine into your Python or Node.js workflows. This approach minimizes boilerplate code, allowing you to focus on script generation and video editing rather than HTTP request handling.

The API mirrors the OpenAI speech endpoint structure, meaning you only need to adjust the base URL and authentication header. Existing code patterns for text-to-speech remain largely unchanged.

Install the SDK

Install the official OpenAI client library for your preferred language. For Python, use pip install openai. For Node.js, run npm install openai.

Set Base URL

Configure the client to point to the CreatorAudio API base URL: https://api.31u.info/v1. This ensures all requests route through our infrastructure while maintaining compatibility with OpenAI’s request schema.

  • Base URL: https://api.31u.info/v1

Use Existing Methods

Call the standard Audio.speech() method as you would for OpenAI. Pass your tts-... API key in the Authorization header and specify the model (tts-1 or tts-1-hd). The SDK handles the JSON body and returns the audio file directly.

Endpoint Details

Sound wave illustration for: Endpoint Details

The API exposes three primary endpoints for generating audio and managing resources. The core synthesis endpoint accepts text and voice parameters, while metadata endpoints provide details on available voices and models. All requests require a valid Bearer token in the Authorization header.

Use the GET endpoints to verify available voice presets and language support before making synthesis requests. This ensures your script matches the supported languages and helps you select the appropriate voice style for your YouTube content.

POST /v1/audio/speech

Send your script here. The endpoint accepts a JSON body with model, input text, voice, and optional parameters like speed or language. It returns the audio file directly in the response body.

Text is limited to 4096 characters per request. For longer scripts, split the text and join the resulting audio files. Failed requests incur no charge.

  • Base URL: https://api.31u.info/v1
  • Method: POST
  • Auth: Bearer <your-api-key>

GET /v1/voices

Returns a list of all available voices, their associated languages, and supported output formats. Use this to determine which voice fits your content style, such as 'aria' for narration or 'felix' for promos.

Each voice supports all 23 languages. If the language parameter is omitted, the system guesses the language from the script's script, defaulting to English for Latin text.

  • Returns JSON array of voice objects
  • Includes language and format metadata

GET /v1/models

Lists the available TTS models. Currently, only 'tts-1' and 'tts-1-hd' are supported, both using the same engine and price point. Selecting either model results in identical cost.

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts two model identifiers, tts-1 and tts-1-hd, which utilize the same underlying engine and pricing structure. You select the desired model via the model field in the JSON payload. This field determines the model identifier but does not affect the cost per character.

Your input text is limited to 4,096 characters per request. Spaces and punctuation count toward this limit. For longer scripts, split the text into chunks of this size and join the resulting audio files sequentially to ensure consistent delivery and avoid truncation.

Model Selection

The API accepts two model identifiers, tts-1 and tts-1-hd, which utilize the same underlying engine and pricing structure. You select the desired model via the model field in the JSON payload. This field determines the synthesis quality but does not affect the cost per character.

  • Use tts-1 for standard generation.
  • Use tts-1-hd for high-definition output.
  • Both models cost $0.01 per 1,000 characters.

Input Text Limit

Your input text is limited to 4,096 characters per request. Spaces and punctuation count toward this limit. For longer scripts, split the text into chunks of this size and join the resulting audio files sequentially to ensure consistent delivery and avoid truncation.

  • Maximum 4,096 characters per request.
  • Includes spaces and punctuation.
  • Split long texts manually or via script.

Voice and Speed

Choose from eight preset voices, such as aria for clear narration or atlas for neutral news delivery. The voice parameter accepts these identifiers. You can adjust the playback speed between 0.25 and 4.0 using the speed field to match your video pacing requirements.

An optional language parameter accepts ISO codes. If omitted, the system guesses the language, defaulting to English for Latin script. Set this explicitly for non-English Latin text to ensure accurate pronunciation.

  • Select from 8 preset voices.
  • Adjust speed from 0.25 to 4.0.
  • Set language for non-English Latin text.
Request Parameters

Response Formats

Sound wave illustration for: Response Formats

The API returns audio files in your chosen format directly in the response body. You can select from MP3, WAV, Opus, FLAC, or PCM via the response_format parameter. This flexibility ensures compatibility with your specific editing software or hosting requirements without needing external conversion tools.

Each format serves a distinct workflow. MP3 offers efficient compression for web delivery, while uncompressed or lossless options preserve audio fidelity for professional post-production. Failed requests return no charge, ensuring you only pay for usable files.

MP3 Support

MP3 is the default format, providing a balance between file size and quality. It is ideal for direct upload to YouTube or embedding in web players. The generated audio is ready for immediate use in most media players.

This format handles the synthetic watermark invisibly and is the most bandwidth-efficient option for high-volume API usage.

  • Default format for most integrations
  • Ideal for web embedding and YouTube uploads
  • Efficient bandwidth usage

WAV and FLAC Options

Choose WAV for uncompressed audio or FLAC for lossless compression. These formats are suitable for professional editing or archival.

Use these when you need to preserve every nuance of the generated voice without generational loss during multi-stage editing workflows.

  • WAV: Uncompressed, widely supported
  • FLAC: Lossless compression for smaller file sizes
  • Best for archival and professional editing

Opus and PCM

Opus provides high-quality audio at very low bitrates, suitable for voice-heavy applications. PCM returns raw linear audio data, which is useful for specific software that requires uncompressed input streams.

Both formats ensure the audio data is delivered exactly as synthesized, without additional encoding artifacts.

  • Opus: High quality, low bitrate
  • PCM: Raw linear audio data
  • Useful for specific software integrations

Rate Limits

Sound wave illustration for: Rate Limits

CreatorAudio enforces a rate limit of 60 requests per minute per API key. This limit applies to all synthesized audio requests, regardless of text length. It ensures stable performance for high-volume YouTube creators producing daily content or freelancers managing multiple client scripts.

60 Requests Per Minute

The standard limit is 60 requests per minute for active accounts. This allows for efficient batch processing of long-form videos. Each request generates one audio file, so plan your workflow accordingly. If you exceed this limit, the API returns a 429 Too Many Requests error.

  • Limit applies per API key, not per account.
  • Limits reset every 60 seconds.
  • Exceeding the limit returns HTTP 429.

10 Requests Before Top-Up

New accounts start with a lower limit of 10 requests per minute. This applies before the first top-up. Once you add funds via USDT on the TRON network (TRC-20), the limit increases to 60 requests per minute.

  • Starts at 10 req/min.
  • Increases to 60 req/min after first top-up.
  • Minimum top-up is $5.

Queue Behavior

Requests are processed sequentially. Under heavy load, requests may wait in a queue. Longer texts take more time to synthesize, potentially slowing down subsequent requests. Short phrases usually complete in a few seconds, while longer scripts may take longer. Be patient during peak usage times.

  • Requests are processed one after another.
  • Longer texts take more generation time.
  • Queues may form under load.

Error Handling

Sound wave illustration for: Error Handling

Synthetic speech generation involves network variability and input constraints. Understanding how the API responds to errors helps you build robust workflows for your YouTube voiceovers without unexpected downtime or wasted credits.

Common Error Codes

The API returns standard HTTP status codes to indicate the result of your request. A 400 error typically means your JSON body is malformed or the input text exceeds the 4096-character limit per request. A 401 error indicates an invalid or expired API key. A 429 error signifies you have hit the rate limit of 60 requests per minute.

  • 400: Bad Request (invalid JSON or text length)
  • 401: Unauthorized (invalid API key)
  • 429: Too Many Requests (rate limit exceeded)

Retry Logic

For transient errors like 429 or 500-series server errors, implement exponential backoff. Start with a short delay, such as 1 second, and double it with each subsequent attempt. This prevents overwhelming the server when it is under load, ensuring your script processing remains stable during high-volume generation tasks.

Failed Request Refund

If synthesis fails due to a server error, your character count is not deducted. The API ensures you are not charged for audio files that were not successfully generated. This applies to both free trial credits and paid balance, ensuring fair usage for your YouTube content production.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. There is no phone line or live chat, keeping operations lean and cost-effective for creators.

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. Tether (USDT)
  3. LibriVox public-domain audiobooks
  4. OpenAI API reference: create speech
  5. openai-node on GitHub
  6. LibriTTS-R corpus (OpenSLR 141)
  7. MDN: Web Speech API
  8. openai-python on GitHub
  9. LibriTTS-R paper (arXiv 2305.18802)
  10. ISO 639 language codes
  11. Python documentation
  12. Creative Commons Attribution 4.0

More on this site