Text-to-Speech API Documentation for Developers

By Audiobook API editorial team · Updated 2026-11-18

This documentation provides the technical specifications for the Audiobook API, enabling developers to integrate text-to-speech synthesis into their publishing workflows. You will find precise details on the POST /v1/audio/speech endpoint, including request parameters for model selection, voice presets, and language codes. The guide covers authentication via Bearer tokens, rate limits of 60 requests per minute, and response formats such as MP3 and WAV, ensuring you can generate audio files programmatically with predictable behavior.

Designed for indie authors and small publishing startups, this page helps you convert long-form texts into audiobooks at scale. We explain how to handle character limits, queueing behavior, and audio concatenation without managing infrastructure. Whether you prefer using the OpenAI SDK or plain HTTP requests, these docs provide the concrete examples and curl commands needed to start generating synthetic speech immediately.

Text-to-Speech API Documentation for Developers

Frequently asked questions

What is the base URL for the API?

The API base URL is https://api.999rbd.com/v1. All requests, including speech synthesis and voice listing, are directed to this endpoint. You can use the official OpenAI SDKs by pointing them to this base URL, ensuring compatibility with standard TTS workflows.

How do I set the base URL in the OpenAI SDK?

Configure the OpenAI SDK by setting the base_url parameter to https://api.999rbd.com/v1. Use your API key for authentication via the Authorization header. This allows you to use the standard speech endpoint while leveraging familiar SDK methods for making requests to our text-to-speech service.

What is the maximum length of the input text?

Each request supports a maximum of 4096 characters for the input text field. Spaces and punctuation count toward this limit. If your audiobook chapter exceeds this length, you must split the text into smaller chunks and concatenate the resulting audio files manually or via your own script.

Can I specify the output format?

Yes, you can specify the output format using the response_format parameter. Supported formats include mp3, wav, opus, flac, and pcm. This allows you to choose the optimal audio quality and file size for your specific publishing workflow, whether for web streaming or high-fidelity archival.

How do I handle long texts over 4096 characters?

Split your text into parts of up to 4096 characters each. Send each part as a separate POST request to the speech endpoint. Then, join the resulting audio files in your application. This approach ensures compliance with character limits while allowing you to generate full-length audiobooks efficiently.

What happens if I send an invalid voice name?

The API will return an error response indicating the invalid voice. Valid voices are aria, nova, luna, sage, felix, milo, atlas, and orion. Ensure you use one of these eight presets to avoid synthesis failures. You can retrieve the full list of available voices via the GET /v1/voices endpoint.

Is the API compatible with other SDKs?

Yes, the API follows the same request shape as the OpenAI speech endpoint. Any SDK that supports OpenAI-compatible base URLs and JSON bodies will work. You simply need to update the base_url to https://api.999rbd.com/v1 and provide your API key for authentication in the Authorization header.

How do I rotate my API key?

You can issue a new API key at any time from your account dashboard. When a new key is issued, the old one stops working immediately. This ensures secure access control. You can generate a new key to revoke access for any compromised or unused keys without affecting your balance.

What is the default language if not specified?

If the language parameter is not set, the system guesses the language from the script. Latin script text defaults to English. For non-English Latin-script text, you should explicitly set the language parameter to ensure accurate synthesis. Supported languages include Arabic, Chinese, French, German, and many others.

Can I change the speed of the audio?

Yes, you can adjust the playback speed using the speed parameter. This allows you to fine-tune the narration pace for your audiobook. The speed value must be a number between 0.25 and 4.0. Lower values slow down the voice, while higher values increase the playback speed significantly.

What are the valid speed values?

The valid speed values range from 0.25 to 4.0. You can set any decimal value within this range to control the voice speed. For example, 1.0 is normal speed, 2.0 is double speed, and 0.5 is half speed. This flexibility helps match the pacing to your content.

Does the API return metadata with the audio?

The API returns the audio file in the response body. Request metadata such as time, characters, and status are kept for billing purposes. You can track usage and status via your account dashboard or by checking the response headers for standard HTTP status codes.

How do I detect errors in the response?

Check the HTTP status code of the response. A non-2xx status indicates an error, such as invalid input or rate limits. The response body will contain error details. Failed requests are free, so you will not be charged for characters processed during a failed synthesis attempt. Review the status code to handle errors appropriately.

Is there a test endpoint?

There is no dedicated test endpoint. You can test the API by sending a simple POST request to the speech endpoint with a short text string. Use the GET /v1/voices endpoint to list available voices and formats. This allows you to verify connectivity and authentication before processing larger audiobook texts.

First request

curl

curl https://api.999rbd.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.999rbd.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.999rbd.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 for the Audiobook API relies on a single active Bearer token per account. Include the header Authorization: Bearer tts-... in every request to the base URL https://api.999rbd.com/v1. This standard approach allows immediate compatibility with existing OpenAI SDKs by simply adjusting the base URL configuration.

Bearer Token Usage

Bearer Token Usage

Include the header Authorization: Bearer tts-... in every request to the base URL https://api.999rbd.com/v1. This standard approach allows immediate compatibility with existing OpenAI SDKs by simply adjusting the base URL configuration.

API Key Management

API Key Management

Each account maintains one active API key visible on the /get-api-key/ dashboard. The key supports up to 60 requests per minute once funded (or 10 per minute before the first top-up). Failed synthesis requests do not consume characters or incur charges, preserving your balance during debugging phases.

Key Rotation

Generate a new key directly from the dashboard at any time. The previous key becomes invalid immediately upon creation of the new one, ensuring secure transitions without downtime for long-running audiobook production pipelines.

Endpoint Overview

Sound wave illustration for: Endpoint Overview

The Audiobook API provides three primary endpoints for generating and managing audio content. The core synthesis endpoint accepts text and parameters to return audio files, while the metadata endpoints allow you to retrieve available voice configurations and model details dynamically.

POST /v1/audio/speech

This endpoint processes your input text and returns the generated audio file. It accepts a JSON body containing the model, input text, voice selection, and output format. Requests are processed sequentially, so longer texts or high load may introduce queueing delays.

  • Endpoint: POST https://api.999rbd.com/v1/audio/speech
  • Accepts JSON body with model, input, voice, and response_format
  • Returns binary audio data or error details

GET /v1/voices

Retrieve a list of all available voices, their associated languages, and supported output formats. This endpoint helps you verify which voices support specific languages before initiating synthesis, ensuring optimal voice selection for your audiobook content.

  • Endpoint: GET https://api.999rbd.com/v1/voices
  • Returns voice ID, name, gender, and supported languages
  • Includes available response formats for each voice

GET /v1/models

Fetch the list of available TTS models, primarily tts-1 and tts-1-hd. This endpoint confirms the current model versions and their pricing tiers.

  • Endpoint: GET https://api.999rbd.com/v1/models
  • Returns model ID, name, and associated pricing
  • Confirms available engine versions for synthesis

Request Parameters

Sound wave illustration for: Request Parameters

Configure your API requests with precise parameters to generate audiobooks efficiently. The model determines audio quality, while input limits ensure compatibility with our character-based billing system.

Voice selection and language settings control the output style. You can combine any voice with any supported language, allowing for flexible narration strategies across different genres.

Model Selection

Choose between "tts-1" and "tts-1-hd". Both engines share the same price of $0.01 per 1,000 characters. Select "tts-1-hd" for higher fidelity.

Input Text Limits

Each request accepts up to 4,096 characters. Longer manuscripts require splitting text into chunks. Concatenate the resulting audio files to complete the audiobook.

  • Characters include spaces and punctuation.
  • Split texts at logical sentence boundaries.

Voice and Language Options

Select from eight preset voices, such as Aria for narrators or Felix for promotional content. Each voice supports all 23 listed languages. Set the language code explicitly for non-English Latin text to ensure accurate pronunciation.

  • Voices: aria, nova, luna, sage, felix, milo, atlas, orion.
  • Supported languages: Arabic, Chinese, English, French, German, Spanish, etc.

Response Formats

Sound wave illustration for: Response Formats

The API returns raw binary audio data in the response body, allowing direct integration into audio players or file storage systems. The format is determined by the response_format parameter in your request, ensuring compatibility with your existing audio pipeline without additional conversion steps.

Supported formats include MP3, WAV, Opus, FLAC, and PCM. MP3 is the standard choice for web delivery due to its balance of quality and file size. WAV and FLAC provide lossless audio, ideal for archiving or further editing. Opus offers efficient compression for streaming, while PCM provides raw linear audio data for precise processing. (Note: The API does not support real-time streaming; audio is returned as a complete file in the response body.)

MP3 Output

MP3 is a widely used format for audiobook distribution. It provides good audio quality at a reasonable file size, making it suitable for web playback and mobile applications. The generated MP3 files are standard-compliant and can be played by most media players and audiobook apps.

  • Standard MP3 encoding for broad compatibility
  • Optimized for web playback and mobile apps
  • Balances quality and file size effectively

WAV, Opus, FLAC, PCM

WAV and FLAC offer uncompressed, lossless audio quality, preserving every detail of the synthesized speech. These formats are ideal for professional editing, master archiving, or high-fidelity playback where file size is less critical. Opus provides efficient compression with good quality, suitable for bandwidth-constrained environments. PCM delivers raw, uncompressed audio data, allowing for maximum control in custom audio processing pipelines.

  • WAV: Uncompressed, lossless, widely supported
  • FLAC: Lossless compression, smaller than WAV
  • Opus: Efficient compression, good for bandwidth-constrained environments
  • PCM: Raw audio data for custom processing

Binary Audio Stream

The API returns the audio file as a binary stream in the HTTP response body. This allows developers to directly write the data to a file or pipe it into an audio player without intermediate storage. The response headers include content-type and content-length to aid in proper handling of the binary data.

  • Direct binary response for efficient processing
  • No intermediate file storage required
  • Headers include content-type and content-length

Error Handling

Sound wave illustration for: Error Handling

The API returns standard HTTP status codes to indicate success or failure. A 200 OK response confirms that the audio synthesis completed successfully and includes the audio data in the response body.

Common HTTP Errors

Use 400 Bad Request for malformed JSON or missing required fields, 401 Unauthorized for invalid or missing API keys, and 500 Internal Server Error if the synthesis engine encounters an unexpected issue.

  • 400: Invalid JSON structure or missing 'input' field.
  • 401: Invalid or expired Bearer token.
  • 500: Internal synthesis engine failure.

Rate Limit Exceeded

If you exceed 60 requests per minute, the API returns a 429 Too Many Requests status. New accounts start with a 10 requests per minute limit until the first top-up is processed.

  • 429: Rate limit exceeded.
  • Retry-After header indicates seconds to wait.

Invalid Input Messages

Ensure the input text does not exceed 4096 characters. If the voice or model ID is invalid, a descriptive error message is returned in the JSON body to help you correct the request payload.

  • Input exceeds 4096 characters.
  • Invalid voice or model ID.
Error Handling

Rate Limits

Sound wave illustration for: Rate Limits

The API enforces a standard rate limit of 60 requests per minute per active key. This ceiling accommodates the sequential processing of audio synthesis, ensuring stable throughput for indie authors converting long-form manuscripts. Each request consumes a portion of this quota regardless of text length, so efficient batching matters when generating entire chapters.

60 Requests Per Minute

New accounts start with a reduced limit of 10 requests per minute. This restriction applies until the first top-up is processed. Once funded via USDT on TRON, the limit increases to the standard 60 requests per minute, allowing for smoother generation workflows without immediate throttling.

Pre-Turnover Limit

Before your first top-up, you are restricted to 10 requests per minute. This ensures fair usage during the trial phase. The limit lifts automatically once your USDT transfer is confirmed on the blockchain, typically within minutes.

Queue Behavior

Requests are processed sequentially within the rate limit window. Under load, additional requests may wait in a queue before synthesis begins. This ensures audio quality remains consistent but means generation time may extend during high traffic periods.

Integration Examples

Sound wave illustration for: Integration Examples

The API accepts standard JSON payloads, allowing immediate integration with existing workflows. Use the provided cURL snippet for quick validation or the OpenAI SDK for structured language bindings by changing the base URL.

cURL Command

Send a synthesis request by posting JSON to the speech endpoint. Include your Bearer token in the Authorization header and specify the desired voice and format.

  • POST https://api.999rbd.com/v1/audio/speech
  • Headers: Authorization: Bearer tts-...
  • Body: {"model": "tts-1", "voice": "nova", "input": "Hello world", "response_format": "mp3"}

OpenAI SDK Configuration

Point the official OpenAI SDK to our base URL. Initialize the client with your API key and use the standard audio.speech.create method.

Python Script

Use the OpenAI Python library to handle the request. Set base_url to https://api.999rbd.com/v1 and pass your key. The library handles the JSON serialization automatically.

Voice and Model Details

Sound wave illustration for: Voice and Model Details

The API offers two model variants, tts-1 and tts-1-hd, which utilize the same underlying engine and pricing structure. This uniformity ensures that upgrading audio fidelity does not alter your cost per character or require changes to your voice selection logic.

Both models support the full set of eight voice presets and all 23 supported languages. The choice between models affects only the output file's audio quality, not the voice characteristics or language capabilities available to your application.

TTS-1 vs TTS-1-HD

Both tts-1 and tts-1-hd share identical pricing at $0.01 per 1,000 characters. They use the same engine, meaning voice selection and language support remain consistent regardless of the model chosen. Developers can switch between them based on storage or quality needs without affecting billing logic.

Available Voices

Eight presets cover diverse audiobook styles, from warm narration to energetic promos. Each voice supports all 23 languages, allowing a single voice to handle multilingual projects. Generated audio includes an inaudible synthetic watermark for identification.

- 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

Language Codes

The API supports 23 languages, including Arabic, Chinese, English, German, Japanese, and Spanish. If the language parameter is omitted, the system guesses the language from the script, defaulting to English for Latin text. For non-English Latin-script content, explicitly setting the language code is recommended to ensure accuracy.

- Arabic (ar), Chinese (zh), Danish (da), Dutch (nl), English (en), Finnish (fi), French (fr), German (de), Greek (el), Hebrew (he), Hindi (hi), Italian (it), Japanese (ja), Korean (ko), Malay (ms), Norwegian (no), Polish (pl), Portuguese (pt), Russian (ru), Spanish (es), Swahili (sw), Swedish (sv), Turkish (tr)

  • Arabic (ar)
  • Chinese (zh)
  • Danish (da)
  • Dutch (nl)
  • English (en)
  • Finnish (fi)

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Indie publishers benefit from paying only for what they produce, avoiding minimum monthly commitments common in traditional TTS services.

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. Creative Commons Attribution 4.0
  3. LibriTTS-R corpus (OpenSLR 141)
  4. FFmpeg documentation
  5. OpenAI API reference: create speech
  6. ISO 639 language codes
  7. openai-node on GitHub
  8. MDN: Web Speech API
  9. Node.js documentation
  10. curl documentation
  11. IETF RFC 7845: Ogg Opus
  12. W3C WAI: making audio and video accessible

More on this site