API Documentation for Synthetic Voice Generation

By BookRead API editorial team · Updated 2026-11-19

This documentation provides the technical specifications for integrating BookRead API into audiobook production workflows. Developers will find precise details on generating API keys, configuring request parameters for synthetic voice generation, and handling responses in standard audio formats. The guide covers the complete lifecycle from authentication to output validation, ensuring reliable integration for self-publishing professionals.

Readers can immediately begin testing with provided cURL and Python SDK examples that demonstrate how to send text and receive audio files, using the official OpenAI SDKs. The reference includes all necessary endpoint definitions, rate limit constraints, and error codes required for scalable audio generation. This page serves as the primary technical resource for engineers building TTS pipelines without infrastructure overhead.

API Documentation for Synthetic Voice Generation

Frequently asked questions

What is the base URL for the API?

The API base URL is https://api.regal33.info/v1. You send POST requests to https://api.regal33.info/v1/audio/speech for synthesis. Use GET /v1/voices or GET /v1/models for metadata. This endpoint structure mirrors the OpenAI speech endpoint, allowing standard HTTP clients or SDKs to connect by adjusting the base URL configuration.

Which SDKs are compatible with this API?

The official OpenAI SDKs are compatible because the request shape matches the OpenAI speech endpoint. You simply change the base_url to https://api.regal33.info/v1 and use your BookRead API key. No proprietary SDK is required; the official OpenAI SDKs work by changing the base_url. You may also use any standard HTTP client library that supports JSON payloads and Bearer token authentication.

How do I set the language explicitly?

Include the optional 'language' field in your JSON body with the ISO code of your target language. Supported languages include English, Spanish, German, French, and 19 others. Explicitly setting this field ensures accurate pronunciation, especially for Latin-script text that might otherwise default to English if the language is not detected automatically.

What is the maximum input length per request?

Each request supports up to 4096 characters of input text. Spaces and punctuation count toward this limit. If your audiobook chapter exceeds this length, you must split the text into multiple requests. Generate each part separately and then join the resulting audio files to create the complete audio track.

Can I stream the audio response?

No, the API does not support streaming or WebSocket connections. Audio is returned as a complete file in the response body. You can choose formats like mp3, wav, opus, flac, or pcm. For large texts, you must manage the splitting and joining of audio files manually in your application logic.

How do I handle rate limit errors?

The limit is 60 requests per minute per key. If you exceed this, you will receive a rate limit error. Implement exponential backoff or queue your requests to stay within the limit. New accounts start with 10 requests per minute until the first top-up is processed. Monitor your usage via the dashboard.

What happens if the input text is too long?

Requests exceeding 4096 characters will fail. You must split your text into chunks of 4096 characters or fewer. Send each chunk as a separate POST request. Once you receive the audio files for each chunk, concatenate them in order to produce the final continuous audio file for your audiobook production.

Is the API synchronous or asynchronous?

The API is synchronous. You send a request and wait for the audio file to be generated and returned in the response. Processing is sequential, so under load, requests may queue. Typical speed is roughly real-time, but short phrases may take a few seconds to generate completely.

Can I use custom speed values?

Yes, you can adjust the speed using the 'speed' parameter. Valid values range from 0.25 to 4.0. This allows you to slow down narration for clarity or speed up content for summaries. The default speed is 1.0. Adjusting speed does not affect the character count or pricing of the request.

What is the default voice if none is specified?

If you do not specify a voice, the API uses a default voice determined by the system. Aria is a female preset described as warm and clear, suitable for narrators. You can choose from the other seven voices depending on your audiobook style requirements.

Are there any required headers besides authorization?

The only required header is 'Authorization: Bearer tts-...'. You must include your unique API key. The Content-Type header should be set to application/json for the request body. No other specific headers are mandatory. Ensure your key is active, as only one key is valid per account at any time.

How do I detect the language automatically?

If you omit the 'language' field, the API guesses the language from the script. Latin script text defaults to English. For other languages using Latin script, such as Spanish or German, you should explicitly set the 'language' field to ensure accurate pronunciation. Non-Latin scripts are detected based on character sets, though setting the language explicitly is recommended for accuracy.

What is the difference between tts-1 and tts-1-hd?

Both 'tts-1' and 'tts-1-hd' use the same engine and have the same price. The distinction is in the model identifier, though both use the same engine and price. Both models support all eight voices and all output formats. Choose either model based on your preference, as the audio quality and cost are identical.

Do I need to install any specific libraries?

No specific library is required. You can use any HTTP client that supports JSON and Bearer authentication. The official OpenAI SDKs work by changing the base URL. Standard libraries like requests in Python or axios in JavaScript are sufficient. No proprietary BookRead SDK or mobile SDK is needed for integration.

First request

curl

curl https://api.regal33.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.regal33.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.regal33.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 and Keys

Sound wave illustration for: Authentication and Keys

Access the API by generating a unique key via the /get-api-key/ dashboard. The key authenticates all requests and is tied to your account balance.

Generating your API key

Generating your API key

Sign in with Google or email to retrieve your key. A new key invalidates the previous one immediately upon generation.

Bearer token format

Bearer token format

Include the header Authorization: Bearer tts-... in every request. The key starts with tts-.

Key rotation policy

Key rotation policy

Issue a new key at any time. The old key stops working instantly, ensuring immediate security updates.

Endpoint Overview

Sound wave illustration for: Endpoint Overview

The API exposes three primary endpoints for synthetic voice generation. The POST endpoint processes text input into audio files, while the GET endpoints provide metadata on available voices and model specifications.

These endpoints enable audiobook producers to integrate voice synthesis directly into their production pipelines without managing infrastructure.

POST /v1/audio/speech

This endpoint accepts text input up to 4096 characters and returns an audio file. It supports multiple formats including MP3, WAV, OPUS, FLAC, and PCM. The request body must include the model, input text, voice selection, and response format.

  • Accepts JSON body with model, input, voice, and format parameters
  • Returns audio file directly in the response
  • Supports speed modulation between 0.25x and 4.0x

GET /v1/voices

Retrieve a list of all available voices, their associated languages, supported formats, and pricing details. This endpoint helps developers select the appropriate voice preset for their audiobook project before making synthesis requests.

  • Lists 8 voice presets
  • Shows supported languages and audio formats
  • Displays per-character pricing

GET /v1/models

Returns the available model configurations. The API currently offers tts-1 and tts-1-hd, both using the same engine and pricing structure. This endpoint allows integration tools to verify model availability dynamically.

  • Returns model identifiers and metadata
  • Confirms tts-1 and tts-1-hd availability
  • Provides engine details for compatibility checks

Request Parameters

Sound wave illustration for: Request Parameters

Define input parameters for the speech synthesis endpoint to generate audio files. The API accepts text strings with a strict maximum length of 4096 characters per request, including spaces and punctuation. For longer manuscripts, split the text into chunks and concatenate the resulting audio files sequentially.

Input text limits

Each request payload contains an input field holding the source text. The system processes up to 4096 characters per call. If your audiobook chapter exceeds this limit, you must segment the text and merge the outputs.

Voice selection

Select one of eight preset voices using the voice parameter. Options include female presets like aria and nova, or male presets such as atlas and orion. Each voice supports all 23 available languages; specify the language code if the script is ambiguous.

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

Speed modulation

Adjust playback speed using the speed parameter, ranging from 0.25 to 4.0. The default rate is 1.0. Modulating speed allows adjusted pacing for listener preference.

Response Formats

Sound wave illustration for: Response Formats

The API returns audio files in the requested format, allowing audiobook producers to select the optimal codec for distribution and archival. Each response contains the raw binary audio data, ready for immediate saving or processing.

MP3 output

MP3 is a supported format, providing efficient compression suitable for web streaming and standard audiobook platforms. It balances file size and quality effectively for general distribution.

WAV output

WAV offers uncompressed, high-fidelity audio ideal for master files and professional editing workflows. Use this format when preserving maximum audio quality is required before further processing.

OPUS and FLAC options

OPUS provides high-quality compression with smaller file sizes, suitable for voice-centric applications. FLAC offers lossless compression, preserving all audio details while reducing storage requirements compared to WAV.

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

The BookRead API maintains the same request shape as the OpenAI speech endpoint, allowing developers to use official OpenAI SDKs with minimal configuration. By updating the base_url to https://api.regal33.info/v1, existing codebases can route requests to our infrastructure without rewriting logic or replacing libraries.

This compatibility ensures that audiobook producers can integrate synthetic voice generation into their automated publishing pipelines using familiar tools. The SDK handles JSON serialization and response parsing consistently, reducing integration friction for self-publishing professionals who rely on standard development practices.

Base URL configuration

Set the API base URL to https://api.regal33.info/v1 in your OpenAI SDK client initialization. Ensure your authentication header uses the Authorization: Bearer format with your unique key, which follows the tts-... prefix. This directs all synthesis requests to the correct endpoint for audio generation.

The configuration requires only a single line change in most standard setups. Verify that your key is active and has sufficient balance before initiating batch processing for long-form text content.

  • Base URL: https://api.regal33.info/v1
  • Auth Header: Authorization: Bearer tts-<your-key>
  • No additional headers required

SDK compatibility

The official OpenAI Python and JavaScript SDKs work directly with this API. Parameters such as model, input, voice, response_format, and speed are passed exactly as defined in the standard specification. This allows seamless migration from other TTS services that adhere to the same schema.

Developers do not need to install custom packages or handle proprietary response structures. The SDK returns the audio file in the requested format, whether MP3, WAV, OPUS, or FLAC, ready for immediate storage or playback in your audiobook workflow.

  • Uses standard OpenAI request schema
  • Supports Python and JavaScript SDKs
  • No custom parsing logic needed

Code examples

Initialize the client with the custom base URL and your API key. Pass the text input, selected voice (e.g., 'aria' or 'atlas'), and desired format. The SDK returns the audio binary, which can be saved directly to your production server or processed further.

For batch processing, split texts exceeding 4096 characters into segments. Iterate through the segments using the same SDK call, then concatenate the resulting audio files. This approach ensures consistent voice quality across long narratives while respecting per-request character limits.

  • Set base_url to https://api.regal33.info/v1
  • Pass text via 'input' parameter
  • Handle audio response as binary data

Error Handling

Sound wave illustration for: Error Handling

Errors return standard HTTP status codes with JSON bodies detailing the cause. Failed synthesis requests incur no charge, and any deducted credit is returned to your balance immediately. This ensures predictable billing even during transient network issues or engine timeouts.

The API validates inputs strictly. If a request exceeds character limits or specifies an unsupported voice, the synthesis does not begin, and no characters are consumed from your account.

Common HTTP errors

A 400 Bad Request indicates malformed JSON or missing required fields like input or voice. A 401 Unauthorized occurs if the Bearer token is invalid or expired. A 500 Internal Server Error suggests a temporary engine issue; retry with exponential backoff.

  • 400: Malformed request body
  • 401: Invalid or missing API key
  • 500: Temporary engine failure

Rate limit responses

Exceeding 60 requests per minute returns a 429 Too Many Requests status. New accounts start with a 10 requests per minute limit. Increase your limit by topping up your balance with USDT (TRC-20).

  • 429: Rate limit exceeded
  • Check Retry-After header
  • Top up to increase limits

Invalid parameter errors

Errors occur if speed is outside 0.25–4.0, model is not tts-1 or tts-1-hd, or voice is not one of the eight presets. Ensure input does not exceed 4096 characters.

  • 422: Unsupported voice or model
  • 422: Speed out of range
  • 422: Input exceeds 4096 chars

Rate Limits

Sound wave illustration for: Rate Limits

Rate limits enforce fair usage and maintain service stability for audiobook production workflows. The standard allowance is 60 requests per minute per API key, processing requests sequentially. Long texts split into multiple parts may queue during high load, affecting generation time.

60 requests per minute

Each API key supports up to 60 requests per minute. Requests are processed sequentially, so under load, a request may wait in a queue. This limit applies uniformly regardless of the model used (tts-1 or tts-1-hd).

Initial limit for new accounts

New accounts start with a reduced limit of 10 requests per minute. This ensures system stability during the initial trial phase before any financial commitment is made.

Limit increases after top-up

Upon completing a top-up via USDT (TRC-20), the rate limit automatically increases to the standard 60 requests per minute. This change is immediate and requires no manual intervention or support ticket.

Testing the API

Sound wave illustration for: Testing the API

Verify your integration by generating short audio samples. Use the provided cURL command or Python script to confirm that your API key is valid and that the endpoint returns a file as expected. This step ensures your environment is correctly configured before processing longer audiobook chapters.

Always validate the response structure and file integrity. Check that the returned audio matches the requested format and voice. This prevents silent failures during batch production where thousands of characters are processed automatically.

cURL example

Send a basic synthesis request to test connectivity. The following command requests a 50-character English text using the 'nova' voice in MP3 format.

This request confirms that authentication and rate limits are functioning correctly. Ensure you replace YOUR_API_KEY with your actual token from the dashboard.

  • `curl -X POST https://api.regal33.info/v1/audio/speech -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model": "tts-1", "input": "Hello, this is a test.", "voice": "nova", "response_format": "mp3"}'`

Python SDK example

Use the OpenAI SDK with a custom base URL to generate speech programmatically. This approach is recommended for integrating with your production pipeline.

The code snippet demonstrates how to handle the response as binary data, which is efficient for storing generated audio files directly to disk.

  • import openai client = openai.OpenAI(base_url="https://api.regal33.info/v1", api_key="YOUR_API_KEY") `with open("output.mp3", "wb") as f: f.write(client.audio.speech.create(model="tts-1", voice="nova", input="Test text").content)`

Response validation

Confirm that the HTTP status code is 200 and the response body contains valid audio data. For MP3 files, verify the header bytes to ensure proper encoding. Check that the file size is non-zero and playable. If the response is empty or contains an error JSON, review the error object for details on invalid parameters or rate limits.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. A mismatch between the voice’s inherent tone and the listener’s age or preference can reduce engagement, regardless of audio fidelity.

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

More on this site