Documentation & Integration Guide for Text-to-Speech API

By LumaVoice editorial team · Updated 2026-11-18

This guide helps indie mobile developers integrate LumaVoice’s text-to-speech API quickly. You will find concrete examples for authentication, request structures, and error handling. The documentation covers parameters needed to generate audio files directly into your app without relying on a custom SDK, as we do not provide our own official SDK. Instead, you can use standard tools like the OpenAI SDK or simple cURL commands.

We focus on practical, step-by-step integration details for mobile environments. This page explains how to handle rate limits, rotate keys, and manage character counts so you can deliver reliable narration to your users efficiently. You can send text and receive audio files using standard HTTP requests, ensuring a straightforward workflow for indie developers who need reliable narration without complex integrations.

Documentation & Integration Guide for Text-to-Speech API

Frequently asked questions

Do I need a specific SDK version?

No specific SDK is required. The API uses the same request shape as the OpenAI speech endpoint, so official OpenAI SDKs work by changing the base_url to https://api.play7u77.com/v1. You can also use plain HTTP requests with your API key for authentication.

How do I rotate my API key?

You can issue a new key at any time from your dashboard. The new key becomes active immediately, and the old one stops working at once. This ensures seamless rotation without downtime for your mobile app integration.

What is the maximum input length?

The maximum input length is 4096 characters per request. For longer texts, you should split the content into parts of up to 4096 characters and join the resulting audio files. Spaces and punctuation count toward this limit.

Can I send audio in Opus format?

Yes, you can request audio in Opus format by setting the response_format field to opus. Other supported formats include mp3, wav, flac, and pcm. The API returns the audio file directly in the response.

Does the API support streaming?

No, the API does not support streaming, WebSocket connections, or real-time partial audio. You send a POST request and receive the complete audio file in the response. This simplifies integration for mobile apps that do not need real-time playback.

How do I handle rate limit errors?

Your key allows 60 requests per minute (10 before the first top-up). If you exceed this limit, implement exponential backoff to retry. Since the API facts do not explicitly state whether failed requests count toward your rate limit, treat all requests as potentially counting. This ensures your retry logic remains robust and avoids unexpected errors during high-volume usage.

Is the voice model versioned?

The model field accepts tts-1 or tts-1-hd, which use the same engine. There is no explicit versioning system like v1.1 or v2.0. The voices are based on licensed recordings from LibriTTS-R (CC BY 4.0), sourced from LibriVox public-domain audiobook readings, ensuring consistent synthetic speech output.

Can I use custom pronunciation?

No, the API does not support phoneme dictionaries or custom pronunciation lexicons. You cannot upload custom pronunciation rules. The system uses standard voice presets to interpret the input text, so ensure your input text is spelled correctly for accurate speech.

Do I need to specify the language?

It is optional but recommended. If not set, the language is guessed from the script, defaulting to English for Latin text. For non-English Latin-script text, you should explicitly set the language parameter to ensure accurate synthesis.

How long does a request take?

Long texts generate at roughly real-time speed, processing about 25 characters of text per second. Short phrases typically take a few seconds to synthesize. Since requests are processed sequentially, heavy load may cause your request to wait in a queue before generation begins.

Are there WebSocket endpoints?

No, there are no WebSocket endpoints. The API uses standard HTTP POST requests to https://api.play7u77.com/v1/audio/speech. You receive the audio file in the response body, making it easy to integrate into mobile apps using standard HTTP libraries.

Does the API support SSML?

No, the API does not support SSML (Speech Synthesis Markup Language). You cannot use tags for pauses, emphasis, or pronunciation. The input is plain text, and the system relies on the voice presets to determine the speech pattern.

Can I download the audio later?

No. The API returns the audio file directly in the response but does not store it on our servers. You must save the file to your own storage immediately after receiving the response. While we keep request metadata (time, characters, status) for billing purposes, the generated audio itself is not retained. Ensure your app handles the download and storage logic to preserve the audio for later use.

Is the API compatible with iOS and Android?

Yes. The API uses standard HTTP, so it works on any platform making HTTP calls. Use the OpenAI SDK or plain HTTP libraries in your iOS and Android apps by setting the base_url to https://api.play7u77.com/v1. Send a POST request to /v1/audio/speech with your API key and text to receive audio files directly in your app.

First request

curl

curl https://api.play7u77.com/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.play7u77.com/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.play7u77.com/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

Secure your API access with a Bearer token. Include the header Authorization: Bearer tts-... in every request to identify your account. This single key authenticates all your text-to-speech calls.

Bearer token usage

Add the Authorization: Bearer tts-... header to each POST request. This token links your usage to your specific account balance and rate limits.

One active key per account

Your account maintains only one active API key at any time. You can generate a new key from your dashboard at any time.

Key rotation process

When you issue a new key, the previous one becomes invalid immediately. There is no overlap period, so update your app configuration promptly to avoid service interruption.

Speech endpoint

Sound wave illustration for: Speech endpoint

The core synthesis happens at the POST /v1/audio/speech endpoint. You send your text payload, and the API returns the generated audio file in a single response. Unlike streaming endpoints, this API returns the complete audio file in a single response, eliminating the need for partial buffer handling or WebSocket connections during synthesis.

Use the official OpenAI SDK or standard HTTP clients. Configure the base URL to https://api.play7u77.com/v1. The request shape matches the standard speech endpoint, making integration straightforward for mobile apps already using familiar HTTP libraries.

JSON body structure

Structure your request as a JSON object. Include the model, input text, and voice preset. You can optionally specify the response format, speed, and language. The API processes the text and returns the binary audio data directly in the response body.

Ensure the input text does not exceed 4096 characters per request. For longer content, split your text into smaller chunks, synthesize each part, and join the resulting audio files in your app.

  • model: "tts-1" or "tts-1-hd"
  • input: The text string to synthesize
  • voice: One of the 8 available presets
  • response_format: mp3, wav, opus, flac, or pcm
  • speed: Float between 0.25 and 4.0
  • language: Optional ISO code

Required fields

You must provide the model, input text, and voice. The model determines quality (tts-1 or tts-1-hd), both using the same engine and price. The input is your source text, and the voice selects one of the eight presets for tone and gender.

Specify the response format if you need a specific audio type. MP3 is the default, but you can choose WAV, OPUS, FLAC, or PCM. If you do not set a language, the system guesses it from the script, defaulting to English for Latin text.

Speech endpoint

Models available

Sound wave illustration for: Models available

Choose between two model identifiers that control the request format. Both tts-1 and tts-1-hd utilize the identical synthesis engine and voice presets, ensuring consistent audio character across your mobile app's narration. This uniformity simplifies integration since you do not need to manage separate voice configurations for different quality tiers.

tts-1 standard

Use tts-1 for standard synthesis requests. This model identifier is compatible with the official OpenAI SDKs when you adjust the base URL. It accepts the same JSON body structure as other TTS endpoints, making it easy to swap into existing mobile app workflows without significant code changes.

tts-1-hd high quality

Select tts-1-hd to request high-definition audio output. Despite the "hd" designation, there are no documented audio quality improvements or subtle enhancements in the engine processing compared to the standard model. The primary difference is the identifier sent in the JSON body, which you may prefer for clarity in your app's logs.

Same engine price

Both models incur the same rate: $10 per 1 million characters. There is no price premium for the HD label. You can switch between tts-1 and tts-1-hd in your code without affecting your billing or character count calculations, allowing you to standardize your pricing logic regardless of the model used.

Voice parameters

Sound wave illustration for: Voice parameters

Choose from eight preset voices optimized for mobile narration, ranging from warm narrators to neutral news anchors. All voices support any of the 23 supported languages, allowing flexible localization without switching voice models.

8 preset voices

Select from eight presets tailored for different audio styles. Female voices include Aria (warm narrator), Nova (upbeat), Luna (storytelling), and Sage (instructional). Male options are Felix (energetic promo), Milo (conversational), Atlas (neutral news), and Orion (deep documentary).

  • Aria: warm, clear narrator
  • Nova: bright, upbeat
  • Luna: soft, storytelling
  • Sage: calm, instructional
  • Felix: energetic, promo
  • Milo: friendly, conversational
  • Atlas: neutral, news
  • Orion: deep, documentary

Speed control 0.25-4.0

Adjust playback speed between 0.25 and 4.0 to fit your app's pacing. Standard generation takes roughly 25 characters per second. Requests are processed sequentially, so queue wait times may apply under load.

Optional language code

Set the language field with an ISO code for precise control. Without it, the API guesses the language from the script, defaulting to English for Latin text. Use the parameter for non-English Latin-script text to ensure accuracy.

Response formats

Sound wave illustration for: Response formats

Select the response_format parameter to define how the synthesized audio is encoded. MP3 is the default output, providing efficient compression suitable for most mobile app integrations and streaming scenarios.

MP3 default output

MP3 is the default format, balancing file size and compatibility. It is ideal for standard playback in mobile applications where bandwidth efficiency matters.

WAV and Opus options

WAV offers uncompressed audio, preserving the original signal quality without data loss. Opus provides high-quality compression at low bitrates, suitable for efficient network transmission.

PCM and FLAC support

PCM returns raw, uncompressed audio data, while FLAC delivers lossless compression, reducing file size while maintaining perfect audio fidelity compared to WAV. Use these for archival or precise editing needs.

Response formats

Rate limits

Sound wave illustration for: Rate limits

Your API key allows 60 requests per minute once your account is fully active. This limit applies per key, so you can manage concurrency by rotating keys if needed. Requests are processed sequentially, meaning heavy loads may queue briefly.

60 requests per minute

Under normal operation, you can generate up to 60 audio files every minute. This throughput is sufficient for most mobile app workflows, such as generating narration for multiple screens or batches of content.

10 per minute initially

New accounts start with a lower limit of 10 requests per minute. This cap helps verify your integration before you begin scaling usage in your mobile application. It prevents accidental bursts from overwhelming the service during early testing.

Limit increases after top-up

The limit increases to 60 requests per minute once you add funds to your account. This change happens within minutes of a successful top-up via USDT (TRC-20). Top-ups are processed automatically, allowing you to resume higher volume usage quickly.

Error handling

Sound wave illustration for: Error handling

Handling API errors is straightforward. The service returns standard HTTP status codes to indicate success or failure. When the synthesis engine encounters an issue, it returns a specific error code along with a message describing the problem, allowing your application to log the incident accurately.

HTTP status codes

Successful requests return a 200 OK status with the audio file in the response body. Common errors include 400 Bad Request for invalid parameters, 401 Unauthorized for missing or incorrect API keys, and 429 Too Many Requests when exceeding your rate limit. Each error response includes a JSON object with a code and a human-readable message.

  • 200: Success
  • 400: Invalid input parameters
  • 401: Authentication failure
  • 429: Rate limit exceeded

Retry logic guidelines

Implement exponential backoff for transient errors like 429 or 503. Since requests are processed sequentially, under heavy load a request may wait in a queue before synthesis begins. If you receive a 429, wait for the duration specified in the Retry-After header before retrying. Avoid immediate retries to prevent hammering the server.

Failed request refunds

If synthesis fails due to a service-side error, the charge is returned in full. Failed requests are free, so you do not lose credit for errors caused by the service. You can verify refund status in your account dashboard under usage history. Note that retries for client-side errors (like invalid text) are charged separately.

Error handling

SDK integration

Sound wave illustration for: SDK integration

The API mirrors the OpenAI speech endpoint structure, allowing you to reuse existing integration logic. Use the official OpenAI SDKs directly. Point the client to our base URL and authenticate with your LumaVoice key. This works for Python, Node.js, and other supported languages.

OpenAI SDK compatibility

The API mirrors the OpenAI speech endpoint structure, allowing you to reuse existing integration logic. Use the official OpenAI SDKs directly. Point the client to our base URL and authenticate with your LumaVoice key. This works for Python, Node.js, and other supported languages.

Changing base_url

Update your SDK client configuration to use our endpoint as the base URL. Set base_url to https://api.play7u77.com/v1 in your client initialization. This ensures all requests route correctly to our synthesis engine without modifying the request body schema.

cURL example command

For quick testing, use the standard cURL command. Send a POST request to the speech endpoint with your Bearer token and JSON body containing the model, input text, and voice selection. Replace the placeholder key with your actual LumaVoice API key.

  • Replace YOUR_API_KEY with your secret key
  • Set model to tts-1 or tts-1-hd
  • Include input text up to 4096 characters

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Design intuitive interfaces that resonate with users to boost your mobile app adoption.

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. curl documentation
  3. IETF RFC 7845: Ogg Opus
  4. Node.js documentation
  5. LibriTTS-R paper (arXiv 2305.18802)
  6. ISO 639 language codes
  7. openai-node on GitHub
  8. MDN: Web Speech API
  9. Tether (USDT)
  10. TRON developer hub: TRC-20
  11. OpenAI API reference: create speech
  12. LibriTTS-R corpus (OpenSLR 141)

More on this site