API Documentation for Text-to-Speech Integration

By VoxLingua editorial team · Updated 2026-11-19

This documentation provides the technical specifications for integrating the VoxLingua text-to-speech API. It details the RESTful endpoints, authentication mechanisms, and request structures required to convert text into audio files. The guide is designed for indie developers building language learning platforms and content aggregators who need reliable, programmatic access to synthetic speech generation.

Readers will find precise information on base URL configuration, available voices, and supported languages. The page includes practical examples for cURL and OpenAI SDK integration, along with explanations of rate limits and error handling. This resource enables developers to implement audio synthesis into their applications with clear, factual parameters and no ambiguity.

API Documentation for Text-to-Speech Integration

Frequently asked questions

How do I generate my API key?

Navigate to the /get-api-key/ page and sign in using Google or an email and password combination. The interface displays your active API key, current balance, and usage statistics. You can issue a new key at any time; the previous key becomes invalid immediately upon generation.

What is the exact format for the JSON request?

Send a POST request to /v1/audio/speech with a JSON body containing the model ("tts-1" or "tts-1-hd"), input text, voice preset, response format, and optional speed or language parameters. The input text must not exceed 4096 characters per request.

Does the OpenAI Python SDK work out of the box?

Yes, the official OpenAI SDKs work by changing the base_url to https://api.rm9.info/v1 and using your site-specific key. This allows you to use standard methods for speech generation without requiring a custom client library or additional dependencies.

What happens if I exceed the rate limit?

The limit is 60 requests per minute per key (10 per minute before the first top-up). Exceeding this limit will cause subsequent requests to queue or fail. Failed requests do not consume your character balance or incur charges.

Can I use the same key for multiple projects?

Yes, each account has one active key that can be used across multiple projects or services. If you need to revoke access for a specific project, you can issue a new key, which immediately invalidates the old one.

How do I specify the output format?

Include the response_format field in your JSON body with one of the following values: mp3, wav, opus, flac, or pcm. This parameter determines the audio encoding of the returned file.

Is the API compatible with JavaScript fetch?

Yes, the API accepts standard HTTP POST requests. You can use the JavaScript fetch API to send your JSON payload to the endpoint. Ensure you include the Authorization header with your Bearer token for authentication.

What is the maximum speed setting allowed?

The speed parameter accepts values between 0.25 and 4.0. A value of 1.0 represents normal playback speed. Adjusting this parameter scales the audio duration proportionally, allowing for faster or slower speech synthesis as needed.

Do I need to handle text splitting myself?

Yes, you must split texts longer than 4096 characters into smaller parts and join the resulting audio files. The API does not automatically handle long-text segmentation. Process requests sequentially to manage queue times effectively.

How do I detect which voice was used?

The API does not return metadata indicating the voice used in the response. You must track this information in your application by recording the voice parameter sent in your request. Every generated file carries an inaudible watermark that marks it as synthetic speech.

First request

curl

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

Authentication

Sound wave illustration for: Authentication

Access to the VoxLingua TTS API requires a valid Bearer token passed via the Authorization header. Each account is provisioned with a single active key, identified by the tts- prefix. This token authenticates all requests to the https://api.rm9.info/v1 base URL.

Bearer token structure

Bearer token structure

The authentication header must follow the standard format: Authorization: Bearer tts-<your_key>. This key serves as the sole credential for your account, ensuring that usage and billing are accurately attributed to your specific integration.

Key generation process

Key generation process

Upon signing in via Google or email, your unique API key is displayed on the dashboard. This key is immediately active and ready for use in your production or development environments without additional verification steps.

Key revocation rules

You may issue a new key at any time via the dashboard. Upon generation of a new key, the previous key becomes invalid instantly. This ensures immediate control over access for your language learning or content aggregation platforms.

Endpoint Configuration

Sound wave illustration for: Endpoint Configuration

Configure your client by setting the base URL to https://api.rm9.info/v1. This endpoint handles all text-to-speech operations and accepts standard JSON payloads compatible with OpenAI SDKs. Ensure your application points exclusively to this domain for reliable connectivity.

Base URL specification

The API resides at https://api.rm9.info/v1. All requests must target this base URL to ensure proper routing. Using the correct domain prevents authentication failures and ensures compatibility with standard HTTP clients.

Endpoint path details

HTTP method requirements

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts two model identifiers: "tts-1" and "tts-1-hd". Both utilize the identical underlying engine and carry the same price point of $10 per 1 million characters. Developers may select either identifier without incurring additional costs or processing differences.

Model selection (tts-1, tts-1-hd)

Both models share the same engine and pricing. Selecting "tts-1-hd" does not increase the per-character rate. Choose based on standard naming conventions if your existing infrastructure expects HD variants.

Input text constraints

The input field accepts a single string of up to 4096 characters. Spaces, punctuation, and special symbols count toward this limit. For texts exceeding 4096 characters, split the input into multiple requests and join the resulting audio files sequentially.

  • Maximum length: 4096 characters per request.
  • All characters, including spaces, are counted.
  • Split longer texts manually before sending.

Voice and language fields

Select one of eight voice presets from the voice parameter. The language field is optional; if omitted, the system guesses the language from the text script, defaulting to English for Latin script. Explicitly set language for non-English Latin text to ensure accuracy.

  • 8 voice presets available (e.g., aria, nova, felix).
  • Supports 23 languages; others are not supported.
  • Language detection defaults to English for Latin script.

Response Formats

Sound wave illustration for: Response Formats

The API returns the synthesized audio file directly in the response body, formatted according to your response_format selection (mp3, wav, opus, flac, or pcm). For texts exceeding 4096 characters, the client must split the input into multiple requests and join the resulting audio files.

Audio file delivery

Audio is delivered as the raw binary payload of the HTTP response. The content-type header matches the requested format, allowing standard HTTP clients to save the file directly without additional parsing logic.

Metadata inclusion

Request metadata, including timestamp, character count, and processing status, is retained server-side for billing purposes. Generated audio is returned in the response and not stored.

  • Input text is used only to produce the audio and is not used for training.

Error response structure

Failures return standard HTTP error codes with a JSON body detailing the issue. Failed requests incur no charge, with the cost returned in full if synthesis fails before completion.

Rate Limits

Sound wave illustration for: Rate Limits

VoxLingua enforces a strict rate limit of 60 requests per minute per API key to ensure stable processing. Each request consumes a portion of this quota, regardless of response format or model variant.

Requests per minute limit

The standard limit is 60 requests per minute. This cap applies uniformly to all active keys. Exceeding this threshold results in a 429 Too Many Requests error until the window resets.

Pre-payment limits

Accounts without a top-up are restricted to 10 requests per minute. This reduced capacity ensures system stability during the initial phase before credit verification is complete via TRC-20 transfer.

Queue behavior under load

Requests are processed sequentially. Under heavy load, new requests may enter a queue before synthesis begins. This sequential processing ensures audio integrity but may introduce latency during peak usage periods.

Rate Limits

CURL Example

Sound wave illustration for: CURL Example

The following example demonstrates a standard synthesis request using cURL. This command sends a JSON payload to the API endpoint, requesting audio generation for a short English text using the 'nova' voice.

Ensure your API key is correctly formatted in the authorization header. The request body specifies the model, input text, and desired output format. Adjust parameters such as speed or language code as needed for your specific use case.

Basic request structure

Send a POST request to https://api.rm9.info/v1/audio/speech. The endpoint accepts JSON bodies containing the synthesis parameters and returns the generated audio file directly in the response.

Header configuration

  • Authorization: Bearer tts-your-api-key-here
  • Content-Type: application/json

JSON body composition

  • model: tts-1 or tts-1-hd
  • input: The text string to convert (max 4096 characters)
  • voice: Voice preset identifier (e.g., nova, aria)
  • response_format: Output format (mp3, wav, opus, flac, pcm)
  • speed: Optional float between 0.25 and 4.0
  • language: Optional ISO 639-1 code for language selection

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

The official OpenAI SDKs work by changing the base_url to https://api.rm9.info/v1. Point the client to https://api.rm9.info/v1 instead of the standard OpenAI endpoint. This single configuration change allows you to use the same authentication headers and request structures you already know.

Base URL override

Set the base URL to https://api.rm9.info/v1. The request shape remains identical to the OpenAI speech endpoint, ensuring immediate compatibility with existing codebases without complex refactoring.

Client initialization

Initialize the SDK client using your Bearer token. Pass the modified base URL during instantiation. This establishes the connection to the VoxLingua infrastructure for all subsequent TTS requests.

Method compatibility

The standard POST method for speech generation works directly. You can use the same SDK methods for model and voice listing via GET endpoints.

Error Handling

Sound wave illustration for: Error Handling

The API returns standard HTTP status codes to indicate request processing outcomes. Successful synthesis returns 200 with the audio payload, while failures return 400, 401, or 429 statuses with a JSON error object containing a message field. Failed requests incur no charge, and the credit is returned to your account balance immediately.

Common error codes

Use 401 for invalid or revoked authentication keys. Use 400 for malformed JSON or invalid voice IDs. Use 429 when exceeding the 60 requests per minute limit per key.

  • 401: Unauthorized (invalid key)
  • 400: Bad Request (invalid parameters)
  • 429: Too Many Requests (rate limit exceeded)

Retry logic recommendations

Implement exponential backoff for 429 and 500 errors. Do not retry 400 errors as they indicate persistent configuration issues. Requests are processed sequentially; under load, queuing delays may occur, so allow sufficient time between retries.

Character limit errors

The API rejects requests with input text exceeding 4096 characters. For longer texts, split the input into chunks of 4096 characters or fewer, generate audio for each chunk, and concatenate the resulting audio files on the client side.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Selecting the appropriate voice preset ensures that the audio remains engaging without demanding excessive cognitive effort from the audience.

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. IETF RFC 7845: Ogg Opus
  3. openai-node on GitHub
  4. W3C WAI: making audio and video accessible
  5. ISO 639 language codes
  6. curl documentation
  7. FFmpeg documentation
  8. Node.js documentation
  9. TRON developer hub: TRC-20
  10. openai-python on GitHub
  11. MDN: Web Speech API
  12. LibriTTS-R corpus (OpenSLR 141)

More on this site