Comprehensive Documentation for Text-to-Speech API Integration

By LegalTTS Reader editorial team · Updated 2026-11-18

This documentation guides legal tech startups through integrating the LegalTTS Reader API into their compliance and accessibility workflows. You will learn how to convert contracts, briefs, and regulatory texts into clear, consistent narration using standard HTTP requests. The guide covers authentication, parameter configuration, and OpenAI SDK integration, ensuring your team can process legal documents efficiently without managing complex infrastructure.

Designed for developers building specialized legal applications, this page provides concrete examples and precise technical details. You will find ready-to-use cURL commands, OpenAI SDK configurations, and a complete reference for supported voices, languages, and audio formats. Use this reference to implement reliable text-to-speech conversion that maintains the professional tone required for legal reviews and accessibility standards.

Comprehensive Documentation for Text-to-Speech API Integration

Frequently asked questions

What is the base URL for the API?

The API base URL is https://api.mae44bet.com/v1. You send POST requests to /v1/audio/speech. This endpoint accepts JSON bodies containing your text, voice selection, and format preferences. The structure mirrors standard TTS endpoints, making integration straightforward for legal tech applications processing contracts or briefs.

How do I authenticate my requests?

Include your API key in the Authorization header as a Bearer token. The format is: Authorization: Bearer tts-... You receive one active key per account. If you issue a new key, the previous one stops immediately. Ensure your key is valid before sending requests to avoid authentication errors.

Can I use the OpenAI Python SDK?

Yes, the official OpenAI SDKs work by changing the base_url to https://api.mae44bet.com/v1. Use the standard speech endpoint with your site’s key. This allows you to leverage existing code structures. You do not need a custom SDK. Just update the base URL configuration in your client setup.

What is the maximum character limit?

Each request supports up to 4096 characters in the input field. For longer legal documents, split the text into parts of this size and join the resulting audio files. Spaces and punctuation count toward the limit. This ensures consistent processing times and predictable billing for your compliance review workflows.

How do I specify a specific voice?

Include the voice parameter in your JSON body with one of the eight presets: aria, nova, luna, sage, felix, milo, atlas, or orion. Each voice offers a distinct tone suitable for different contexts, from calm narration to energetic promos. Select the voice that best fits your document’s tone.

Does the API support streaming?

No, the API does not support streaming or WebSocket connections. You receive the complete audio file after synthesis finishes. Requests are processed sequentially, so under load, you may experience queue delays. This synchronous approach ensures reliable delivery of full audio files for your legal document processing needs.

What happens if I exceed rate limits?

The limit is 60 requests per minute per key (10 per minute before the first top-up). Exceeding this may cause delays as requests queue. Failed requests are free, but successful ones count toward your limit. Monitor your usage to ensure smooth processing of your legal texts without interruption.

How do I handle audio format selection?

Specify the response_format parameter in your request body. Options include mp3, wav, opus, flac, and pcm. Choose the format that best suits your storage and playback requirements. All formats are generated from the same engine, ensuring consistent audio quality regardless of the selected format.

Is there a limit on concurrent requests?

Requests are processed one after another. There is no explicit concurrency limit, but queueing occurs under load. This sequential processing ensures stable performance. For high-volume legal document processing, consider spacing out requests or splitting large texts to manage queue times effectively and maintain predictable turnaround times.

How do I rotate my API key?

Issue a new key from your account dashboard. The new key becomes active immediately, and the old one stops at once. This ensures secure access control. You can rotate keys anytime without downtime. Use the new key in your Authorization header for all subsequent API requests to your legal TTS service.

What is the speed range allowed?

The speed parameter accepts values between 0.25 and 4.0. Adjusting speed allows you to control narration pace for legal briefs or contracts. Faster speeds may reduce generation time, while slower speeds enhance clarity. Test different speeds to find the optimal balance between efficiency and comprehension for your audience.

Do I need to set the language field?

It is optional. If omitted, the language is guessed from the script, defaulting to English for Latin text. For non-English Latin-script text, set the language field explicitly. Supported languages include Arabic, Chinese, English, French, German, Spanish, and others. Correct language setting ensures accurate pronunciation in your legal documents.

How long are audio files stored?

Generated audio is returned in the response and not stored by the API. Input text is used only for synthesis and not for training. Request metadata is kept for billing purposes. You are responsible for storing the returned audio files if you need to retain them for your legal records.

Can I send multiple texts in one call?

No, each request handles one text input up to 4096 characters. For multiple texts, send separate requests. You can split long documents into parts and join the audio files afterward. This approach ensures each segment is processed correctly and allows for better error handling in your legal tech workflows.

First request

curl

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

Sound wave illustration for: Authentication Setup

Access the /get-api-key/ page on mae44bet.com to create your account using Google or email. The dashboard displays your unique API key, initial balance, and usage statistics. This key authenticates all requests to the API base https://api.mae44bet.com/v1.

Generate API key

Generate API key

Sign up on the /get-api-key/ page to receive your key. Accounts created via Google start with a $0.50 trial credit valid for seven days. Email-based accounts begin with zero balance.

Bearer token format

Bearer token format

Include your key in the request header as Authorization: Bearer tts-.... Ensure the prefix tts- is included exactly as displayed on your dashboard.

Key rotation policy

Generate a new key from the dashboard at any time. The previous key stops working immediately upon the creation of the new one, ensuring secure access during transitions.

First Request Example

Sound wave illustration for: First Request Example

Send a POST request to the speech endpoint with your text and selected voice. The API returns the synthesized audio file in the response body.

This approach allows legal tech platforms to instantly convert contract clauses or brief excerpts into accessible audio for compliance reviews.

cURL command example

Use the following command to generate speech. Replace YOUR_API_KEY with your secret token and adjust the voice and input text as needed.

  • curl -X POST https://api.mae44bet.com/v1/audio/speech \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "tts-1", "input": "The defendant agrees to the terms.", "voice": "sage"}'

JSON body structure

The request body is a standard JSON object. It includes the model identifier, the raw text input, and the desired voice preset.

  • model: "tts-1" or "tts-1-hd"
  • input: String up to 4096 characters
  • voice: One of eight presets (e.g., sage, atlas)
  • response_format: mp3, wav, opus, flac, or pcm

Required fields

Only three fields are strictly required to initiate synthesis. The model determines quality and price, while the voice defines the narrator's character.

  • model
  • input
  • voice

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

The API mirrors the OpenAI speech endpoint structure, allowing you to reuse existing integrations with minimal adjustments. Simply update the base URL to point to the LegalTTS Reader endpoint. This ensures that standard HTTP libraries and SDKs work without custom middleware.

Base URL configuration

Set your SDK's base URL to https://api.mae44bet.com/v1. This single change directs requests to the correct backend while maintaining compatibility with standard JSON payloads. All other endpoint paths remain identical to the OpenAI specification.

Standard SDK usage

Use the official OpenAI SDK or plain HTTP. Pass your API key via the Authorization: Bearer header. The SDK handles the request serialization, sending your legal text to the synthesis engine and returning the audio file.

Client initialization

Initialize the client with your secret key and the custom base URL. Ensure you handle the response as binary data or save the returned file directly. The SDK manages the connection, letting you focus on integrating audio into your legal tech stack.

  • Use base_url parameter in client constructor
  • Pass key via standard environment variable or config object
  • No custom client class required

Supported Parameters

Sound wave illustration for: Supported Parameters

The API accepts two model identifiers: "tts-1" and "tts-1-hd". Both utilize the same underlying synthesis engine and incur identical pricing regardless of selection. Choose based on your specific audio quality requirements for legal briefs without worrying about cost variations.

Model selection

Use "tts-1" for standard narration or "tts-1-hd" for higher fidelity. Both models support the full range of 8 voice presets and all available audio formats. The choice affects audio clarity but not the character count billing or rate limits.

Voice presets

Select from eight distinct voice profiles optimized for clarity. Female options include Aria (warm narrator), Nova (upbeat), Luna (storytelling), and Sage (calm). Male options include Felix (energetic), Milo (conversational), Atlas (neutral news), and Orion (deep documentary).

Each voice can speak all 23 supported languages. For non-English text in Latin script, explicitly set the language parameter to ensure accurate pronunciation.

Speed adjustments

Adjust playback speed between 0.25 and 4.0 using the speed parameter. This allows legal teams to accelerate lengthy contract reviews or slow down complex legal jargon for better comprehension during accessibility testing.

Audio Formats

Sound wave illustration for: Audio Formats

Select the response_format parameter in your POST request to determine the output structure. The API accepts mp3, wav, opus, and flac, allowing you to balance file size and fidelity for your legal document workflows.

MP3 output

MP3 is the default format, offering a compact file size suitable for web playback and quick audio previews of contracts. It provides sufficient clarity for standard narration tasks without excessive storage overhead.

WAV support

Choose WAV for uncompressed, high-quality audio that preserves every detail of the synthetic speech. This format is ideal for archival purposes or when integrating with audio editing tools for compliance reviews.

FLAC and OPUS

FLAC offers lossless compression, maintaining original audio quality while reducing file size. OPUS provides efficient compression for bandwidth-constrained environments, ensuring clear playback of lengthy legal briefs.

Audio Formats

Rate Limits and Queues

Sound wave illustration for: Rate Limits and Queues

The API enforces a standard rate limit of 60 requests per minute per active key. This capacity is generally sufficient for batch-processing legal briefs or contract reviews.

60 requests per minute

Once your account is active and funded, you can send up to 60 synthesis requests every minute. This limit applies per API key, so ensure you are using the correct key for your production environment.

Initial limit cap

New accounts start with a reduced limit of 10 requests per minute. This constraint remains in effect until you perform your first top-up. Once you top up, the limit automatically increases to the full 60 requests per minute.

Processing order

Requests are processed sequentially in the order they are received. If you send multiple requests simultaneously, they will queue and synthesize one after another. Under heavy load, you may experience slight delays before generation begins.

Error Handling

Sound wave illustration for: Error Handling

Synthesis failures return standard HTTP error codes, ensuring your application can react programmatically. Common issues include invalid character limits, unsupported voices, or temporary server congestion. Each response includes a clear error message to help you debug request parameters quickly.

When errors occur, implement exponential backoff to handle transient network issues. For rate limit errors, wait before retrying. If a request fails completely, the system guarantees no charge, so you can safely retry without worrying about double billing.

Common error codes

The API returns standard HTTP status codes to indicate success or failure. Use 4xx codes to identify client-side issues like invalid JSON or missing fields. Use 5xx codes for temporary server-side issues that may resolve on retry.

  • 400 Bad Request: Invalid input or missing required fields.
  • 429 Too Many Requests: Exceeded 60 requests per minute limit.
  • 503 Service Unavailable: Temporary server overload, try again later.

Retry logic

Implement exponential backoff for 5xx errors to avoid overwhelming the server during high load. For 429 errors, wait the duration specified in the retry-after header before making the next request. This ensures smooth integration even during peak usage times.

  • Wait 1 second, then 2, then 4 seconds for exponential backoff.
  • Respect the retry-after header for rate limit errors.
  • Retry up to 3 times before alerting the user.

Billing adjustments

Failed requests are free. If synthesis fails, the charge is returned in full, so you can safely retry without worrying about double billing. Balance updates reflect only successful generations, ensuring accurate cost tracking for your legal tech applications.

  • Failed requests incur no charge.
  • Successful generations are billed immediately.
  • Balance updates reflect only successful generations.

Voice and Language Codes

Sound wave illustration for: Voice and Language Codes

LegalTTS Reader provides eight distinct voice presets optimized for reading contracts and briefs. Each voice offers a specific tonal quality, from the warm narration of Aria to the neutral clarity of Atlas, ensuring consistent audio output for compliance reviews.

Voice ID list

The API supports eight licensed voices derived from public-domain audiobook readings. Users can select from female voices like Aria and Nova, or male options like Felix and Orion, to match their document's tone.

  • 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 ISO codes

The engine supports 23 languages, including English, German, French, Spanish, and Japanese. Any voice can speak any supported language, allowing for multilingual contract synthesis without requiring specific voice models for each region.

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

Auto-detection rules

If the language field is omitted, the system guesses the language from the script. Latin-script text defaults to English, so you must explicitly set the language parameter for non-English Latin text to ensure accurate synthesis.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Founders must carefully review legal documents to ensure their equity distribution aligns with long-term company goals and protects against unforeseen risks.

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

More on this site