Documentation for Text-to-Speech API Integration

By EasyRead editorial team · Updated 2026-11-19

This documentation provides the technical specifications for integrating EasyRead’s text-to-speech API into accessibility and educational platforms. You will find concrete code examples, including cURL commands and OpenAI SDK configurations, to generate audio from text efficiently. The guide covers authentication, parameter selection, and error handling to help large teams implement narration at scale.

The content is tailored for developers managing digital content for users with dyslexia. It details how to split long texts, select from eight licensed voices, and manage rate limits. By following these steps, you can add synthetic speech to your applications without requiring custom infrastructure or third-party plugins.

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.x999bet.cc/v1. You use this endpoint for all requests, including the speech generation endpoint at /v1/audio/speech. This URL is used for both standard HTTP calls and when configuring SDKs to point to our service instead of the default provider.

Can I use the official OpenAI JavaScript SDK?

Yes. The request shape matches the OpenAI speech endpoint. You can use the official OpenAI JavaScript SDK by changing the base_url to https://api.x999bet.cc/v1 and using your site-specific API key. This allows you to leverage familiar SDK methods for integration.

How do I set the speed of the audio?

Include the speed field in your JSON request body. The value must be a number between 0.25 and 4.0. This parameter adjusts the playback rate of the generated audio file. It is an optional field, so omitting it uses the default speed for the selected voice.

What is the maximum character limit per request?

Each request supports up to 4096 characters in the input field. For longer texts, you must split the content into parts of this size and join the resulting audio files. Spaces and punctuation count toward this character limit. This ensures consistent processing performance for each API call.

Does the API support SSML tags?

No, the API does not support SSML tags. You send plain text in the input field. The system processes the text directly without interpreting markup for pauses, emphasis, or pronunciation changes. If you need specific timing or emphasis, you must manage this logic in your application code.

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 in your JavaScript code to retry requests. For new accounts, the limit is 10 requests per minute until the first top-up is processed.

Can I stream audio as it generates?

No, the API does not support streaming or WebSocket connections. You receive the complete audio file in the response body after generation finishes. For long texts, you must split them into chunks, generate each part, and then join the audio files in your application logic.

What happens if the synthesis fails?

If synthesis fails, the charge is returned in full. You do not lose any credit for failed requests. The API returns an error status with details about the failure. You can retry the request or adjust parameters like text length or voice selection based on the error message.

Is the API key reusable across devices?

Yes, your API key works across any device or environment where you can make HTTP requests. You can use the same key in your browser, server, or mobile app. If needed, you can issue a new key at any time, which immediately invalidates the previous one.

Do I need to install a specific library?

No specific library is required. You can use the official OpenAI JavaScript SDK or plain HTTP requests. If using the SDK, install the standard openai package and configure the base URL. For plain HTTP, any standard fetch library or HTTP client works with the JSON request format.

Can I use the API in a browser environment?

Yes, you can use the API from a browser. Ensure your API key is secure, as it is visible in client-side code. Make sure your server or CORS configuration allows requests from your domain. The API returns standard audio formats that browsers can play natively.

How do I specify a language for mixed text?

Include the language field with an ISO code in your request body. If omitted, the system guesses the language, defaulting to English for Latin script. For non-English Latin text, always set the language explicitly to ensure accurate synthesis. Supported languages include English, Spanish, French, and others listed in the docs.

Are there any headers required besides Auth?

You must include the Authorization: Bearer tts-... header with your API key. The request body must be JSON. No other specific headers are required for standard requests. Ensure your content type is set to application/json if your HTTP library does not do this automatically.

Can I request multiple formats in one call?

No, each request generates one audio file in a single format. Specify the desired format using the response_format field (mp3, wav, opus, flac, or pcm). To get multiple formats, you must make separate requests for each format. This ensures efficient processing and accurate billing per file generated.

First request

curl

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

Access the /get-api-key/ page to create your account using Google or email. The dashboard displays your active API key, current balance, and usage statistics alongside a ready-to-use cURL example for immediate testing.

Include your key in the request header as Authorization: Bearer tts-.... This single credential authenticates all your synthesis requests against the API endpoint.

Generate Your API Key

Generate Your API Key

Navigate to the /get-api-key/ section of the site to register your account. You can sign up using Google for an instant trial credit of $0.50 (approx. 50,000 characters), valid for 7 days. Email/password accounts start with a zero balance.

  • Supports Google OAuth and standard email registration.
  • Trial credit provides ~50,000 characters for 7 days.
  • Email accounts begin without trial credit.

Authorize Requests with Bearer Token

Authorize Requests with Bearer Token

Every API call must include the Authorization header with your unique key. The format is Bearer tts-<your_key>. This ensures your usage is correctly billed against your account balance.

  • Format: Authorization: Bearer tts-...
  • Key is displayed on your dashboard.

One Key Per Account Policy

Each account maintains one active API key at any time. Issuing a new key immediately invalidates the previous one, ensuring secure access control for your team.

First Request with cURL

Sound wave illustration for: First Request with cURL

To generate audio, send a POST request to https://api.x999bet.cc/v1/audio/speech. The payload must be valid JSON containing the text to be converted and the selected voice parameters.

The API returns the audio file directly in the response body. Ensure your integration handles binary data correctly if downloading the resulting file.

Basic POST Request Structure

Use cURL or any HTTP client to send your request. The endpoint is POST https://api.x999bet.cc/v1/audio/speech.

Include your API key in the Authorization header as a Bearer token. The request body must contain the model, input, and voice fields.

  • Endpoint: POST /v1/audio/speech
  • Header: Authorization: Bearer tts-...
  • Body: JSON object with required fields

Required Fields: Model, Input, Voice

Specify model as either tts-1 or tts-1-hd. Both use the same engine and pricing.

The input field accepts your text, up to 4096 characters per request. Choose a voice from the 8 available presets, such as aria or nova.

  • model: "tts-1" or "tts-1-hd"
  • input: string (max 4096 chars)
  • voice: one of 8 presets

Response Format Options

You can specify the response_format in your request. Supported formats include mp3, wav, opus, flac, and pcm.

Selecting other formats may affect file size and compatibility with your accessibility player.

  • mp3, wav, opus, flac, pcm

Using the OpenAI SDK

Sound wave illustration for: Using the OpenAI SDK

You can integrate EasyRead into your accessibility workflows using the official OpenAI SDKs without needing a custom client. Simply configure the SDK’s base_url to point to https://api.x999bet.cc/v1 and provide your API key. This leverages the exact same request shape as the OpenAI Speech endpoint, ensuring compatibility with existing codebases.

This approach allows teams to maintain standard library dependencies while accessing our specific voice presets and pricing model. It is particularly useful for educational platforms that already utilize OpenAI tools for other content generation tasks.

Set base_url to api.x999bet.cc

Update your SDK configuration to use https://api.x999bet.cc/v1 as the base URL. This directs all requests to our TTS infrastructure while maintaining the standard JSON body structure expected by the library.

Use Official OpenAI SDKs Directly

Import the standard OpenAI package as you normally would. Pass your EasyRead API key (starting with tts-...) in the Authorization header. The SDK handles serialization and retries automatically.

  • Use tts-1 or tts-1-hd models
  • Send input, voice, and response_format in the body
  • Authentication uses Bearer tts-... token

No Custom SDK Required

We do not maintain a separate proprietary SDK. By relying on the official OpenAI SDK, you benefit from its stability and regular updates. This reduces integration overhead for large teams managing multiple services.

Request Parameters Explained

Sound wave illustration for: Request Parameters Explained

The API accepts tts-1 and tts-1-hd models, which use the same engine and pricing. Select based on your audio quality preference without affecting cost.

Model: tts-1 vs tts-1-hd

Both tts-1 and tts-1-hd utilize identical synthesis engines and incur the same rate of $10 per 1 million characters. The distinction lies solely in audio fidelity, allowing you to choose between standard and high-definition output without impacting your budget.

Input: Text Up to 4096 Characters

Each request accepts a maximum of 4096 characters, including spaces and punctuation. For longer content, split your text into chunks of this size and concatenate the resulting audio files sequentially to maintain narrative flow.

Voice: Select from 8 Presets

Choose from eight licensed presets: Aria, Nova, Luna, and Sage for female tones; Felix, Milo, Atlas, and Orion for male tones. Each voice supports all 23 languages, though you should specify the language parameter for non-English Latin script text to ensure accurate pronunciation.

  • Aria: Warm, clear narrator
  • Nova: Bright, upbeat
  • Luna: Soft, storytelling
  • Sage: Calm, instructional
  • Felix: Energetic, promo
  • Milo: Friendly, conversational

Response Formats and Speed

Sound wave illustration for: Response Formats and Speed

Configure the response_format field to receive audio as MP3, WAV, Opus, FLAC, or PCM. MP3 is standard for web playback, while WAV and FLAC provide uncompressed quality for archival. PCM offers raw data for custom pipelines. All formats are generated upon request completion.

Supported Formats: MP3, WAV, Opus, FLAC, PCM

Select the format that best fits your delivery infrastructure. Opus is efficient for bandwidth-constrained environments. FLAC ensures lossless preservation. PCM is suitable for direct audio processing.

  • MP3: Universal compatibility
  • WAV: Standard uncompressed audio
  • Opus: High compression efficiency
  • FLAC: Lossless quality
  • PCM: Raw binary data

Speed Range: 0.25x to 4.0x

Adjust the speed parameter between 0.25 and 4.0 to control narration pace. Faster speeds may impact clarity. Slower speeds aid comprehension for listeners with processing difficulties. Default speed is 1.0.

Language Parameter for Non-English Text

Explicitly set the language parameter using ISO codes for non-English Latin-script text to ensure accurate pronunciation. If omitted, the system guesses the language, defaulting to English for Latin scripts. This prevents mispronunciation in mixed-language content.

Response Formats and Speed

Error Handling and Limits

Sound wave illustration for: Error Handling and Limits

Our API enforces a standard rate limit of 60 requests per minute for each active key. This capacity supports steady integration workflows, though under heavy load, requests may queue behind one another, potentially increasing generation time for long texts.

Rate Limit: 60 Requests Per Minute

After your initial trial or first top-up, you can send up to 60 requests per minute. If your integration spikes beyond this threshold, subsequent requests will wait in a queue until capacity frees up.

Initial Limit: 10 Requests Per Minute

New accounts without a top-up start with a lower limit of 10 requests per minute. This ensures fair usage during testing before you commit to the full capacity.

Handling Failed Requests

If synthesis fails due to transient errors, the charge is returned in full. You can retry the request without worrying about double-charging your balance.

  • Failed requests are free.
  • Balance refunds are automatic.

Handling Long Texts

Sound wave illustration for: Handling Long Texts

When input text exceeds the 4096-character limit, your application must split the content into smaller chunks. Each chunk is sent as a separate POST request to the API endpoint. This ensures that every segment receives a valid audio response without truncation.

After receiving the individual audio files, your system should join them sequentially to form a complete narration file. This approach maintains audio continuity while respecting the per-request character constraint defined in the API specification.

Split Text into 4096 Character Chunks

Divide your input text at natural word boundaries to avoid cutting mid-word. Each segment must be strictly under 4096 characters, including spaces and punctuation. Send each segment as an independent request to ensure reliable processing.

  • Count characters precisely, including spaces.
  • Split at word boundaries to preserve readability.
  • Ensure each segment is < 4096 chars.

Join Audio Files Sequentially

The API returns separate audio files for each chunk. Your client-side logic or backend service must concatenate these files in the correct order. This creates a seamless listening experience for users without manual intervention.

No additional metadata is required for joining; the audio formats (MP3, WAV, Opus, FLAC, PCM) support standard concatenation.

Managing Queue Wait Times

Requests are processed sequentially. Under heavy load, a request may wait in a queue before synthesis begins. Typical generation speed is roughly 25 characters of text per second of generation for long texts.

For very long documents, expect additional latency due to queueing. Plan your integration to handle asynchronous processing or batch requests efficiently to minimize user wait times.

Voice Selection Guide

Sound wave illustration for: Voice Selection Guide

Selecting the right voice is critical for accessibility, particularly for users with dyslexia who benefit from consistent, clear pacing. Our eight presets are designed to reduce cognitive load while maintaining natural intonation.

Female Voices: Aria, Nova, Luna, Sage

Aria offers a warm, clear narrator style ideal for general reading. Nova provides a bright, upbeat tone for engaging content. Luna is soft and suited for storytelling, while Sage delivers calm, instructional clarity.

Male Voices: Felix, Milo, Atlas, Orion

Felix brings energetic clarity to promotional or fast-paced text. Milo offers a friendly, conversational tone for user guides. Atlas provides neutral news-style delivery, and Orion’s deep voice suits documentary or long-form narration.

Voice Characteristics for Reading

All voices support 23 languages and can speak any of them regardless of preset. For non-English Latin-script text, set the language parameter explicitly to avoid default English detection. Each voice is based on licensed recordings, ensuring consistent quality for assistive reading tools.

  • Aria: Warm, clear narrator
  • Nova: Bright, upbeat
  • Luna: Soft, storytelling
  • Sage: Calm, instructional
  • Felix: Energetic, promo
  • Milo: Friendly, conversational

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. This control is crucial for educational platforms where precise pronunciation directly impacts comprehension for users with dyslexia.

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

More on this site