Quickstart: Text-to-Speech API for Legal Teams

By Legal TTS Logic editorial team · Updated 2026-11-19

This guide demonstrates how to integrate Legal TTS Logic’s text-to-speech API into your legal document workflows. You will learn to authenticate, send synthesis requests, and manage audio output for compliance and accessibility. The examples use standard tools like cURL and the OpenAI SDK, ensuring compatibility with your existing engineering stack without requiring custom client libraries.

The API is designed for legal teams processing high volumes of text. You will see how to handle character limits, select appropriate voices for narration, and manage rate limits during peak usage. By the end, you will understand how to generate auditable audio files from contracts and briefs, with transparent pricing and clear error handling for reliable automation.

Quickstart: Text-to-Speech API for Legal Teams

Frequently asked questions

What is the API endpoint?

Send POST requests to https://api.11ybet.info/v1/audio/speech. The endpoint accepts JSON bodies containing the text, voice selection, and desired output format. This single endpoint handles all synthesis requests for your legal documents, ensuring consistent behavior across all integration types.

How do I authenticate?

Include an Authorization header with your API key: Authorization: Bearer tts-.... Each account holds one active key at a time. You can issue a new key at any time, which immediately invalidates the previous one, ensuring secure access control.

Can I use the OpenAI SDK?

Yes. The request shape matches the OpenAI speech endpoint. Update your SDK’s base_url to https://api.11ybet.info/v1 and use your site’s key. This allows you to leverage existing OpenAI SDKs without writing custom HTTP clients for your legal workflows.

What is the maximum text length?

Each request supports up to 4096 characters. Spaces and punctuation count toward this limit. For longer legal documents, split the text into chunks of 4096 characters or fewer and join the resulting audio files to create a complete narration.

How do I set the language?

Pass an optional ISO language code in the 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 accurate synthesis across the 23 supported languages.

What audio formats are supported?

You can request audio in mp3, wav, opus, flac, or pcm formats. Choose the format that best fits your compliance and storage requirements. All formats are generated via the same endpoint with identical pricing for both tts-1 and tts-1-hd models.

What are the rate limits?

Limits are 60 requests per minute per key. New accounts start with 10 requests per minute until the first top-up. Requests process sequentially, so high volume may cause queuing. Monitor your usage to ensure timely delivery of legal document narrations.

How do I handle errors?

Failed requests incur no charge; the fee is returned in full. Check your response status codes for issues like rate limits or invalid inputs. Since requests are processed sequentially, errors may indicate temporary load. Retry failed requests after addressing the specific error condition.

Can I adjust the speech speed?

Yes, set the speed parameter between 0.25 and 4.0. This allows you to optimize listening times for lengthy legal briefs or compliance reports. The default speed provides natural pacing, but you can accelerate or decelerate the output as needed.

Is SSML supported?

No, SSML is not supported. The API accepts plain text input only. You cannot use phoneme dictionaries or custom pronunciation lexicons. For precise control, ensure your source text is correctly formatted before sending it to the synthesis endpoint.

How do I split long texts?

Split your document into parts of up to 4096 characters. Send each part as a separate request and join the resulting audio files. This approach ensures consistent quality and allows you to manage large legal documents without exceeding character limits per request.

What happens if I exceed limits?

Requests are processed sequentially. If you exceed the 60 requests per minute limit, additional requests may wait in a queue. This may increase latency for long texts. Monitor your usage to maintain steady throughput for your legal team’s automation workflows.

Can I rotate my API key?

Yes, you can issue a new key at any time. The old key stops working immediately upon issuing the new one. This allows you to rotate credentials securely without downtime. Access key management via your account dashboard at /get-api-key/.

Do I need to install a library?

No. You can use the official OpenAI SDKs by changing the base URL, or use plain HTTP requests. No custom library is required. This flexibility allows you to integrate the TTS API into any existing infrastructure using standard tools.

First request

curl

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

Sound wave illustration for: Authentication and Setup

Legal teams require auditable access to speech synthesis APIs. This guide covers the essential steps to authenticate your requests and manage your API key securely within your document narration workflow.

API Key Generation

API Key Generation

Sign up on the /get-api-key/ page using Google or email. Your account receives a unique Bearer token immediately. Each account holds one active key at a time.

  • Supported sign-in: Google or Email/Password
  • Output: Single active Bearer token
  • Usage: Visible in dashboard

Authorization Header

Authorization Header

Include your key in every request header. Use the format: Authorization: Bearer tts-.... This token authenticates your 60 requests-per-minute limit.

Key Rotation

Generate a new key via the dashboard at any time. The old key becomes invalid instantly. This ensures continuous compliance without downtime.

First Request with cURL

Sound wave illustration for: First Request with cURL

Send a POST request to https://api.11ybet.info/v1/audio/speech with your API key in the Authorization header. The body must contain the model, input text, voice, and response format.

Basic JSON Body

The request body is standard JSON. Include the model (e.g., tts-1), the input text up to 4096 characters, a voice preset, and response_format.

  • Model: tts-1 or tts-1-hd
  • Input: Plain text string
  • Voice: One of 8 presets
  • Format: mp3, wav, opus, flac, or pcm

Required Fields

You must provide model, input, voice, and response_format. The language field is optional; if omitted, the system guesses from the script, defaulting to English for Latin text.

Response Handling

On success, receive the audio file directly in the response body. Failed requests return an error JSON and incur no charge, with the balance restored automatically.

Using the OpenAI SDK

Sound wave illustration for: Using the OpenAI SDK

Leverage the official OpenAI SDKs for seamless integration. Since our API mirrors the OpenAI speech endpoint structure, you can reuse existing client code with minimal adjustments. This approach ensures compatibility with standard Python and JavaScript libraries without requiring a custom wrapper.

Configure the SDK to point to our infrastructure by overriding the base URL. This allows your legal team to maintain familiar development patterns while accessing our auditable speech synthesis engine for high-volume document narration.

Base URL Configuration

Set the base_url parameter to https://api.11ybet.info/v1. This directs requests to our TTS endpoint while preserving the standard JSON request shape. All other SDK logic remains unchanged.

Client Initialization

Initialize the client using your API key via the Authorization: Bearer header. Ensure the key is stored securely in your environment variables. The client uses the standard OpenAI authentication flow, simplifying credential management for large teams.

Standard Methods

Use the standard audio.speech.create method to generate audio files. Pass the model, input, voice, and response_format parameters as defined in our docs. The SDK handles the JSON serialization and HTTP POST request automatically.

Input Parameters

Sound wave illustration for: Input Parameters

The API accepts plain text input with a hard limit of 4096 characters per request. Spaces and punctuation count toward this total. For documents exceeding this length, split the text into chunks and concatenate the resulting audio files.

You may adjust the playback speed between 0.25x and 4.0x to fit specific review workflows. The system processes requests sequentially, so under high load, synthesis may queue behind other requests.

Text Input Limits

Each API call supports up to 4096 characters. This limit applies to the combined length of letters, spaces, and punctuation marks. If your legal brief or contract exceeds this size, you must segment the input and merge the outputs manually.

  • Maximum length: 4096 characters per request
  • Includes spaces and punctuation
  • Split long texts into manageable chunks

Voice Selection

Choose from eight preset voices tailored for different narration styles. Select "atlas" for neutral, news-style readings or "sage" for calm, instructional tones. All voices support the full range of 23 languages.

  • aria: warm, clear narrator
  • nova: bright, upbeat
  • luna: soft, storytelling
  • sage: calm, instructional
  • felix: energetic, promo
  • milo: friendly, conversational

Language Specification

Specify the ISO language code to ensure accurate pronunciation. If omitted, the system guesses the language, defaulting to English for Latin script. Explicitly set the language for non-English Latin texts to avoid misinterpretation.

  • Supports 23 languages including English, German, French, Spanish, and Chinese
  • Default language is English for Latin script
  • Explicitly set language for non-English Latin text

Output Formats

Sound wave illustration for: Output Formats

The API returns audio in five standard formats, allowing legal teams to balance file size, compatibility, and archival quality. The response_format field in your POST request determines the output container, directly affecting storage costs and playback behavior for compliance documents.

MP3 Compression

MP3 is the default and most efficient format for general playback and web integration. It offers significant compression, reducing storage requirements for high-volume legal narration while maintaining clear speech intelligibility for standard hearing.

WAV Quality

WAV provides uncompressed audio (PCM is also available as a separate format), ideal for archival purposes or systems requiring lossless fidelity. It is larger than MP3 but ensures no data loss during transmission, suitable for strict evidence preservation workflows.

OPUS and FLAC Options

OPUS offers high-quality compression at low bitrates, suitable for efficient playback or bandwidth-constrained environments. FLAC provides lossless compression, preserving full audio quality while reducing file size compared to WAV, ideal for local storage archives.

Output Formats

Rate Limits and Quotas

Sound wave illustration for: Rate Limits and Quotas

Rate limits ensure stable synthesis under high-volume legal document processing. Our API enforces strict quotas to maintain consistent audio generation quality for large teams.

Requests Per Minute

Each API key is limited to 60 requests per minute. This limit applies uniformly regardless of text length, ensuring predictable throughput for batch processing of compliance documents.

Pre-Payment Limits

New accounts without a top-up are capped at 10 requests per minute. This constraint applies until you add credit. Once funded, the limit increases to the standard 60 requests per minute.

Queue Behavior

Requests are processed sequentially. Under load, additional requests may wait in a queue before synthesis begins. This ensures audio integrity but may introduce latency during peak usage periods.

Error Handling

Sound wave illustration for: Error Handling

Synthesis failures are handled explicitly to ensure billing accuracy and predictable integration behavior. Our API returns standard HTTP status codes to indicate success or failure, allowing legal compliance systems to log events precisely without guessing error states.

Common HTTP Codes

A 200 OK response confirms successful audio generation. Use 400 Bad Request for invalid parameters, 401 Unauthorized for expired or invalid API keys, and 429 Too Many Requests when exceeding the 60 requests per minute limit.

Retry Logic

Implement exponential backoff for transient 5xx errors. Do not retry 4xx errors unless the issue is corrected, such as updating the input text or key. Requests processed in queue may delay but will eventually complete if not rate-limited.

Refund Triggers

If synthesis fails before audio generation completes, the charge is returned in full. Check the response status to confirm whether characters were deducted. Failed requests do not consume your character balance.

Advanced Usage

Sound wave illustration for: Advanced Usage

Legal documents often require specific pacing for compliance reviews or accessibility audits. Adjusting the speed parameter allows legal teams to optimize audio consumption without altering the underlying voice model, ensuring that dense contractual language remains intelligible at varying speeds.

Speed Adjustment

The API accepts a speed value between 0.25 and 4.0. For lengthy terms and conditions, increasing the speed to 1.5x or 2.0x can significantly reduce listening time while maintaining clarity. Conversely, setting a lower speed may aid in precise transcription verification of complex clauses.

  • Default speed is 1.0.
  • Minimum value: 0.25.
  • Maximum value: 4.0.

Text Chunking

Each API request accepts a maximum of 4,096 characters, including spaces and punctuation. For lengthy legal briefs or multi-page contracts, split the input text into chunks of this size. Process each chunk sequentially to generate individual audio files.

  • Max input: 4,096 characters.
  • Count includes spaces and punctuation.

Audio Concatenation

After generating audio files for each chunk, concatenate them to form a complete document narration. This approach ensures that no single request exceeds the character limit, allowing for seamless processing of large volumes of text while maintaining the natural flow of the narrative.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. This eliminates the need for custom wrappers or learning proprietary request shapes.

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. openai-python on GitHub
  3. W3C WAI: making audio and video accessible
  4. Node.js documentation
  5. IETF RFC 7845: Ogg Opus
  6. Python documentation
  7. Creative Commons Attribution 4.0
  8. curl documentation
  9. LibriTTS-R corpus (OpenSLR 141)
  10. openai-node on GitHub
  11. FFmpeg documentation
  12. Tether (USDT)

More on this site