API Documentation: Integrate TTS into Your App

By Readio editorial team · Updated 2026-11-18

This documentation provides a practical guide for freelancers integrating our text-to-speech API into mobile applications. You will find clear instructions for authenticating requests, generating audio via simple HTTP calls, and handling responses with predictable character-based pricing. The guide focuses on concrete workflows, such as using the OpenAI SDK or raw cURL commands, to help you build reliable speech synthesis features without unnecessary complexity.

We assume you are comfortable with standard REST APIs and basic JSON handling. The instructions cover essential topics like key rotation, rate limits, and long-text splitting, ensuring your app remains stable under load. All examples use standard data, so you can copy, paste, and test immediately. Whether you are building a voice assistant or an audiobook reader, this page gives you the exact steps needed to get audio from text in minutes.

API Documentation: Integrate TTS into Your App

Frequently asked questions

How do I get an API key?

Sign up on the /get-api-key/ page using Google or an email and password. The dashboard displays your active API key, balance, and usage stats. Each account holds one active key; issuing a new one immediately invalidates the previous one.

What is the base URL?

The API base URL is https://api.omgbdwin.com/v1. Send POST requests to /audio/speech for synthesis. Use GET /v1/voices to list available options. This endpoint structure allows compatibility with standard HTTP clients and third-party SDKs.

Does the API support streaming?

No, the API does not support streaming, WebSocket connections, or real-time partial audio. You must send a full text request and wait for the complete audio file response. This synchronous approach simplifies integration for mobile app workflows.

How do I handle rate limits?

The limit is 60 requests per minute per key. New accounts start with 10 requests per minute until the first top-up. Requests process sequentially, so high load may cause queuing delays. Monitor your usage via the dashboard to stay within limits.

What is the maximum input length?

Each request supports up to 4096 characters. For longer texts, split the input into chunks of this size and join the resulting audio files. Spaces and punctuation count toward the character limit. This ensures predictable processing times and consistent audio quality.

Can I use the OpenAI SDK?

Yes, the official OpenAI SDKs work by changing the base_url to https://api.omgbdwin.com/v1. Use the same request shape as the OpenAI speech endpoint. Provide your API key via the Authorization header. This allows easy migration for existing OpenAI integrations.

How do I specify a language?

Pass the optional ISO language code in the request body. If omitted, the system guesses the language, defaulting to English for Latin script. Explicitly setting the language ensures correct pronunciation for non-English texts, such as Spanish, French, or German.

What formats are available?

Available response formats are mp3, wav, opus, flac, and pcm. Choose based on your mobile app’s audio handling capabilities. MP3 offers small file sizes, while WAV provides uncompressed quality. All formats are returned directly in the API response.

How do I handle errors?

Failed requests are free, and the charge is returned in full. Check the response status code for specific error details. Ensure your input text is within the 4096 character limit and your API key is valid. Use the dashboard to monitor usage and balance.

Is there a WebSocket endpoint?

No, there is no WebSocket endpoint. The API operates synchronously via standard HTTP POST requests. You send text and receive the complete audio file in the response. This design avoids the complexity of managing real-time connections for batch processing.

Can I use custom voices?

No, custom voice cloning or uploading your own voice is not supported. You can choose from eight preset voices: aria, nova, luna, sage, felix, milo, atlas, and orion. These voices are based on licensed recordings from LibriTTS-R and LibriVox.

How do I calculate costs?

Pricing is $10 per 1 million characters, or $0.01 per 1,000 characters. Spaces and punctuation count as characters. Failed requests are free. You can top up using USDT on the TRON network (TRC-20), with a minimum of $5. Balance does not expire and has no minimum spend.

What is the speed range?

The speed parameter ranges from 0.25 to 4.0. Adjust this value to make the speech slower or faster. Typical generation speed is roughly real time, producing about 25 characters of text per second. Short phrases may take a few seconds to process.

Do I need to install a library?

No, you do not need to install a specific library. You can use plain HTTP requests or the official OpenAI SDK. The API uses standard JSON bodies and Bearer token authentication. This makes it easy to integrate into any mobile app environment.

First request

curl

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

Authentication is handled via a single active API key per account. You generate this key on the /get-api-key/ page using Google or email login. The key starts with "tts-" and is required for all requests.

API Key Generation

API Key Generation

Create your key on the dashboard. Accounts signed up with email and password start without trial credit, while Google sign-ins receive $0.50. Only one key is active at a time.

Bearer Token Usage

Bearer Token Usage

Include the key in the HTTP header as Authorization: Bearer tts-.... This applies to both the speech endpoint and other API calls. Ensure no extra spaces are included in the token string.

Key Rotation

Generate a new key from your dashboard at any time. The previous key stops working immediately upon issuance of the new one. This allows instant revocation if a key is compromised in your mobile app environment.

  • Old key invalidates instantly
  • Generate new key anytime
  • No downtime required

Endpoint Overview

Sound wave illustration for: Endpoint Overview

The API provides three core endpoints for generating and managing speech: speech, voices, and models. The primary endpoint handles audio synthesis, while the others provide metadata about available voices and model configurations. All endpoints use standard HTTP methods and return JSON or binary data.

Speech Generation Endpoint

Send a POST request to /v1/audio/speech with your text and parameters to receive an audio file. This is the main workhorse endpoint for converting text to speech.

  • Endpoint: POST /v1/audio/speech
  • Returns: Audio file (mp3, wav, etc.)

Voices Listing Endpoint

Use GET /v1/voices to retrieve a list of all available voices, their associated languages, supported formats, and current pricing. This helps you select the right voice for your app's tone.

  • Endpoint: GET /v1/voices
  • Returns: JSON list of voice objects

Models Endpoint

Access GET /v1/models to view the available TTS models, such as tts-1 and tts-1-hd. This endpoint confirms the engine versions currently supported by the API.

  • Endpoint: GET /v1/models
  • Returns: JSON list of model objects

Request Parameters

Sound wave illustration for: Request Parameters

Configure the request payload to generate audio that fits your mobile app’s needs. The API accepts simple JSON fields, allowing you to control output quality, text length, and voice characteristics with minimal code overhead.

Model Selection

Choose between tts-1 for standard efficiency or tts-1-hd for higher fidelity. Both models use the same underlying engine and pricing structure, so you can switch without changing your integration logic.

Input Text Limits

Each request supports up to 4096 characters of input text. Spaces and punctuation count toward this limit. For longer content, split your text into chunks, generate audio for each part, and join the files on the client side.

Voice Selection

Select one of eight preset voices, such as nova for upbeat content or atlas for neutral news. Voices are based on licensed recordings and carry an inaudible synthetic watermark. You can specify a language ISO code to ensure correct pronunciation for Latin-script text that isn't English.

  • Female: aria, nova, luna, sage
  • Male: felix, milo, atlas, orion

Response Formats

Sound wave illustration for: Response Formats

The API returns synthesized audio as binary data in the response body. You can choose from MP3, WAV, Opus, FLAC, or PCM formats using the response_format parameter. Choose MP3 for smaller file sizes in mobile apps, or WAV/FLAC for higher quality when file size is less critical.

Audio Formats

Selecting the correct format balances bandwidth and audio fidelity. MP3 is recommended for most mobile use cases due to its efficient compression, while PCM provides raw data for immediate playback without decoding overhead.

Error Responses

Errors return a JSON object with an error field containing a message and type. Failed synthesis requests are free, so any character count deducted during a failure is returned to your balance. Always check the HTTP status code before parsing the body.

  • 400: Invalid parameters or malformed JSON
  • 401: Invalid or expired API key
  • 429: Rate limit exceeded (60 req/min)
  • 500: Internal synthesis server error

Rate Limit Headers

The response may include rate limit headers to help you manage requests. If you exceed 60 requests per minute, you receive a 429 status. New accounts start with a lower limit of 10 requests per minute until the first top-up is processed.

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

The API mirrors the OpenAI speech endpoint structure, allowing you to reuse existing client code with minimal changes. By adjusting the base URL, you can direct requests to our infrastructure without rewriting your audio generation logic.

This approach is ideal for freelancers who want to integrate TTS into mobile apps quickly, leveraging familiar SDKs for predictable results and straightforward debugging.

Base URL Configuration

Set your OpenAI SDK base URL to https://api.omgbdwin.com/v1. This directs all speech requests to our API while maintaining standard request shapes.

Ensure your authentication header uses the tts-... key format provided on your dashboard.

  • Base URL: https://api.omgbdwin.com/v1
  • Auth Header: Authorization: Bearer tts-<your-key>

SDK Initialization

Initialize the SDK using your standard library, ensuring the base URL points to our endpoint. Pass your API key in the authorization header.

The SDK handles JSON serialization and response parsing automatically, returning audio data as a file-like object.

Code Example

Here is a basic Python example using the openai library. Replace <your-api-key> with your key from /get-api-key/.

The code sends a text input and receives an MP3 file, ready for playback in your mobile app.

Adjust the model and voice parameters as needed. Remember that characters count towards your balance, so test with short strings first.

  • ```python import openai client = openai.OpenAI(base_url="https://api.omgbdwin.com/v1", api_key="tts-<your-key>") response = client.audio.speech.create(model="tts-1", voice="nova", input="Hello world", response_format="mp3") response.stream_to_file("output.mp3") ```
OpenAI SDK Integration

Curl Example

Sound wave illustration for: Curl Example

Use cURL to test your TTS integration directly from the terminal. This method requires no additional libraries, making it ideal for quick validation of your API key and voice selection before writing mobile app code.

Basic Request

Send a simple POST request to the speech endpoint. Replace YOUR_API_KEY with your credential and provide the text input.

  • POST https://api.omgbdwin.com/v1/audio/speech
  • Content-Type: application/json
  • Authorization: Bearer YOUR_API_KEY

Header Configuration

Include the Authorization header with your Bearer token. Set Content-Type to application/json to ensure the server parses your request body correctly.

  • Specify the model (e.g., tts-1)
  • Define the voice (e.g., aria)
  • Set response_format to mp3

Response Handling

Upon success, the API returns the audio file directly. Save this output to a local file on your device for immediate playback or further processing in your app.

Error Handling

Sound wave illustration for: Error Handling

Handling errors correctly ensures your mobile app remains responsive during API failures or network interruptions. Understanding common status codes helps you decide whether to retry immediately or alert the user.

This section covers how to interpret response codes, manage rate limits, and implement safe retry logic without exhausting your character balance unnecessarily.

Common Error Codes

The API returns standard HTTP status codes. A 4xx error indicates an issue with your request, such as an invalid voice ID or missing input text. A 5xx error suggests a temporary server issue.

If synthesis fails, the charge is returned in full. You can safely retry failed requests without incurring extra costs.

  • 400 Bad Request: Invalid parameters or missing input.
  • 401 Unauthorized: Invalid or expired API key.
  • 429 Too Many Requests: Rate limit exceeded.
  • 500–503: Temporary server errors; retry with backoff.

Retry Logic

Implement exponential backoff for 5xx errors. Start with a short delay (e.g., 1 second) and increase it with each retry.

Since requests are processed sequentially, under load a request may wait in a queue. Avoid aggressive polling to prevent queue congestion.

  • Use exponential backoff for transient errors.
  • Retry failed requests; they are free.
  • Limit concurrent retries to avoid overwhelming the queue.

Rate Limits

You are limited to 60 requests per minute per key. Before the first top-up, the limit is 10 requests per minute.

If you exceed the limit, the API returns a 429 status code. Wait until the window resets before retrying.

  • 60 requests/minute after top-up.
  • 10 requests/minute before first top-up.
  • Check X-RateLimit-Remaining header if available.

Advanced Usage

Sound wave illustration for: Advanced Usage

Beyond basic generation, the API allows precise control over audio characteristics and handling of larger content blocks. You can adjust playback speed and explicitly define languages to ensure accurate synthesis, especially when using Latin script for non-English languages.

Speed Control

Set the speed parameter between 0.25 and 4.0 to adjust playback rate. This is useful for matching voiceover pacing in mobile app tutorials or games without post-processing.

Language Specification

Pass the language field with an ISO code (e.g., es, fr) to force synthesis in a specific language. If omitted, the system guesses from the text script, defaulting to English for Latin text.

  • Supported: Arabic, Chinese, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Russian, Spanish, Swahili, Swedish, Turkish.

Long Text Splitting

The API limits input to 4096 characters. For longer texts, split your content into chunks, send each request, and join the resulting audio files client-side.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. This method allows for fast, low-cost transactions directly to your account balance.

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. openai-python on GitHub
  4. Tether (USDT)
  5. LibriTTS-R corpus (OpenSLR 141)
  6. W3C WAI: making audio and video accessible
  7. OpenAI API reference: create speech
  8. FFmpeg documentation
  9. MDN: Web Speech API
  10. TRON developer hub: TRC-20
  11. Creative Commons Attribution 4.0
  12. Python documentation

More on this site