Text to Speech API Documentation for Mobile Developers

By Vocalize editorial team · Updated 2026-11-18

This documentation provides a complete reference for integrating our cloud text-to-speech API into your mobile applications. You will find precise details on request parameters, supported audio formats, and authentication methods, ensuring you can generate high-quality speech files directly from your app’s audio engine. The guide is designed for freelance mobile developers who need reliable, high-quality text-to-speech without the overhead of enterprise infrastructure.

We offer a simple API that lets you focus on building features instead of managing voice infrastructure. By using the standard OpenAI SDK shape, you can easily switch your base URL and start generating audio with just a few lines of code. Whether you are building an audiobook app or an interactive assistant, this page gives you the concrete numbers and workflows you need to ship faster.

Text to Speech API Documentation for Mobile Developers

Frequently asked questions

How do I get an API key?

Sign up on https://rg777ok.com/get-api-key/ using Google or email and password. You receive one active key per account, visible on your dashboard. You can issue a new key anytime; the old one stops immediately. This key authenticates your requests to the API.

What is the base URL for the API?

The API base URL is https://api.rg777ok.com/v1. Use this base URL when configuring your HTTP client or SDK. All endpoints, including speech generation and voice listing, are relative to this base. Ensure your requests target https://api.rg777ok.com/v1/audio/speech for synthesis.

Which models are available?

Two models are available: tts-1 and tts-1-hd. Both use the same engine and pricing. Select the model that best fits your quality needs. The request body requires the model field to be set to either string value for successful synthesis.

How do I set the language?

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

What happens if I exceed the rate limit?

You get 60 requests per minute (10 before your first top-up). Requests process sequentially, so they may queue under load. Failed requests are free: if synthesis fails, the charge is returned in full, ensuring you only pay for successfully generated audio.

Can I use the OpenAI Python SDK?

Yes. The API matches the OpenAI speech endpoint shape. Change the SDK’s base_url to https://api.rg777ok.com/v1 and use your site’s key. This allows you to integrate TTS directly into your mobile app’s audio engine using familiar OpenAI SDK patterns.

How do I handle errors?

Check the HTTP status code and response body for error details. If synthesis fails, the charge is returned in full. Implement retry logic for transient errors, keeping in mind the rate limit of 60 requests per minute. Failed requests incur no cost.

What is the maximum input length?

The maximum input length is 4096 characters per request. For longer texts, split your content into parts of up to 4096 characters. Generate audio for each part separately, then join the resulting audio files to create the final output for your app.

First request

curl

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

Your API key is your single credential for all requests. Generate it instantly on the /get-api-key/ page using Google or email. One active key per account ensures clean tracking.

Pass this key in the Authorization header for every call. Keep it secure in your mobile app’s build config or backend proxy.

API Key Generation

Create your key via the dashboard. It starts active immediately. Use Google sign-in for a free trial credit; email accounts start with zero balance.

  • One active key per account
  • Google or email registration

Bearer Token Format

Use the header: Authorization: Bearer tts-your-key-here. The key format is tts-.... Do not include spaces or quotes in the token value.

Key Rotation

Generate a new key anytime from the dashboard. The old key stops working immediately. This is useful if you suspect leakage or want a fresh start.

  • Old key invalidates instantly
  • No downtime required

Endpoint Overview

Sound wave illustration for: Endpoint Overview

The API exposes three core endpoints for generating and managing audio. The Speech endpoint handles synthesis, while the Voices and Models endpoints provide metadata about available options without consuming characters.

Speech Endpoint

Send text to POST https://api.rg777ok.com/v1/audio/speech. Provide a JSON body with model, input, and voice. The API returns an audio file directly in the response.

Voices Endpoint

Call GET https://api.rg777ok.com/v1/voices to retrieve the 8 available voice presets, supported languages, and audio formats. This helps you configure your app’s voice selector without hardcoding values.

Models Endpoint

Call GET https://api.rg777ok.com/v1/models to confirm available model identifiers. Both tts-1 and tts-1-hd use the same engine and price, differing only in their identifier strings.

Endpoint Overview

Request Parameters

Sound wave illustration for: Request Parameters

Configure your TTS requests by selecting the model, input text, and voice. These three parameters define the output audio's quality, content, and character.

Model Selection

Choose between tts-1 for standard quality or tts-1-hd for higher fidelity. Both models use the same underlying engine and pricing, so pick based on your app’s audio requirements.

Input Text Field

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

  • Max 4096 characters per request
  • Spaces and punctuation count
  • Split manually for longer texts

Voice Selection

Select one of eight presets from aria to orion. Each voice supports all 23 languages. If the language is not English, explicitly set the language parameter to avoid guessing errors.

  • 8 presets: aria, nova, luna, sage, felix, milo, atlas, orion
  • Supports 23 languages
  • Set language for non-English Latin text

Response Formats

Sound wave illustration for: Response Formats

The API returns synthesized audio directly in the response body, allowing seamless integration into your mobile app’s audio engine. You can choose from five supported formats to balance quality and file size, ensuring optimal performance for your users’ devices.

Audio File Formats

Select your preferred output format via the response_format parameter. Supported formats include MP3, WAV, OPUS, FLAC, and PCM. MP3 is recommended for general use due to its small size and broad compatibility. WAV and FLAC provide uncompressed audio for higher fidelity needs. OPUS offers efficient compression for mobile data savings. PCM provides raw audio data for custom processing pipelines.

Response Headers

Standard HTTP headers accompany each response. The Content-Type header indicates the audio format returned. Response time varies based on text length, averaging roughly real-time for long texts. Short phrases may take a few seconds due to processing queues.

Error Responses

Errors are indicated by standard HTTP status codes. A 400 Bad Request indicates invalid parameters. A 429 Too Many Requests signals rate limit exhaustion. Failed synthesis returns a full refund to your balance. The response body includes a JSON object with an error field describing the issue. Use these codes to implement robust retry logic in your app.

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

Leverage your existing OpenAI SDK setup by simply redirecting the base URL to our API. This allows you to use the standard speech endpoint without writing custom HTTP parsers, keeping your mobile app’s audio engine clean and maintainable.

Base URL Configuration

Update your SDK’s base_url to https://api.rg777ok.com/v1. This single change routes all requests through our infrastructure while maintaining compatibility with the official OpenAI client library.

SDK Compatibility

The API mirrors the OpenAI speech endpoint structure, ensuring seamless integration with existing OpenAI SDKs. You can switch providers or test alternatives without rewriting your audio generation logic.

Code Examples

Initialize the client with your tts-... key and set the base URL. Pass your text, desired voice (e.g., 'nova'), and format. The SDK returns the audio file directly, ready for playback in your mobile app.

OpenAI SDK Integration

Rate Limits

Sound wave illustration for: Rate Limits

Each API key supports a steady throughput of 60 requests per minute. This consistent limit ensures your mobile app can generate audio smoothly without sudden drops in capacity, allowing you to plan your background synthesis tasks reliably.

Requests Per Minute

Your active key handles up to 60 synthesis requests every minute. Since requests are processed sequentially, longer texts may queue behind simpler ones. This predictable rhythm helps you maintain steady audio generation without overwhelming the service.

Pre-Topup Limits

New accounts start with a restricted limit of 10 requests per minute before the first top-up. This cap applies immediately upon key creation. Once you add USDT (TRC-20), the limit remains 60 requests per minute, but the restriction lifts, allowing full throughput from the start.

Handling Throttling

If you exceed the limit, the API returns a 429 error. Implement exponential backoff in your mobile client to retry automatically. This prevents your app from flooding the endpoint and ensures you stay within the allowed 60 requests per minute.

Error Handling

Sound wave illustration for: Error Handling

Failures are free. If synthesis fails, the charge is returned in full. Request metadata (time, characters, status) is kept for billing, so you can verify issues in your account dashboard.

Common Error Codes

The API returns standard HTTP status codes. Use 400-level codes for client errors and 429 for rate limits (60 requests/minute).

  • 400: Bad Request (invalid input)

Retry Logic

Respect the Retry-After header on 429 errors. Process requests sequentially; under load, a request may wait in a queue.

Refund Process

Failed requests are free. The charge is returned in full. You can verify these refunds in your account dashboard under the usage history section.

Error Handling

Quick Start with cURL

Sound wave illustration for: Quick Start with cURL

To get started, visit /get-api-key/ to sign in with Google or your email. Your unique API key appears immediately on the dashboard, ready for use.

Once you have your key, you can send your first speech request using the command line. This quick test confirms your integration is working before you add it to your mobile app.

Generate API Key

Navigate to the /get-api-key/ page and authenticate via Google or email. Your active key is displayed instantly, allowing you to copy it directly into your mobile project's configuration file.

First Request Example

Use this cURL command to generate speech. Replace YOUR_API_KEY with your actual key. This request uses the standard tts-1 model to convert text into an MP3 file.

```bash curl -X POST https://api.rg777ok.com/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 ```

Response Parsing

The API returns the audio file directly in the response body. Save this binary data to your local device or pass it straight into your app’s audio engine for playback.

If the request fails, you receive a JSON error object instead of audio. Failed requests incur no charge, ensuring your balance remains accurate even during debugging.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Build mobile apps that empower freelancers to work smarter and grow their businesses independently.

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. LibriVox public-domain audiobooks
  3. openai-node on GitHub
  4. Python documentation
  5. openai-python on GitHub
  6. ISO 639 language codes
  7. curl documentation
  8. TRON developer hub: TRC-20
  9. MDN: Web Speech API
  10. LibriTTS-R paper (arXiv 2305.18802)
  11. Node.js documentation
  12. Creative Commons Attribution 4.0

More on this site