Integration Guide for Text-to-Speech in LMS

By EchoLesson editorial team · Updated 2026-11-19

This documentation provides LMS administrators and course creators with the technical details needed to integrate EchoLesson’s text-to-speech API into their educational platforms. You will find clear specifications for authentication, request parameters, and response handling, enabling you to generate audio files directly from your course content. The guide focuses on practical integration steps, ensuring you can evaluate voice quality and licensing clarity before committing to a solution.

We designed this reference for developers working with Python and standard HTTP clients, using the OpenAI SDK structure for familiarity. You will learn how to manage API keys, handle rate limits, and process audio responses efficiently. The examples below demonstrate real-world usage, helping you assess volume pricing and technical fit for your e-learning applications without unnecessary complexity.

Integration Guide for Text-to-Speech in LMS

Frequently asked questions

How do I generate an API key?

Navigate to /get-api-key/ and sign up using Google or an email and password. The dashboard displays your active API key immediately. You can issue a new key at any time, which stops the old one instantly. Each account holds one active key for authentication via the Authorization header.

What is the base URL for the API?

The API base URL is https://api.o89.info/v1. All requests are sent to this endpoint. For example, the speech endpoint is https://api.o89.info/v1/audio/speech. Use this base URL when configuring your HTTP client or SDK to ensure requests reach the correct EchoLesson service.

Can I use the OpenAI SDK with this API?

Yes, the request shape matches the OpenAI speech endpoint. Simply change the SDK’s base_url to https://api.o89.info/v1 and use your EchoLesson API key. The official OpenAI SDKs work seamlessly without modification, allowing you to generate audio using familiar code structures and libraries.

How do I specify the voice in the request?

Include the voice parameter in your JSON body with one of eight presets: aria, nova, luna, sage, felix, milo, atlas, or orion. You can retrieve the full list of available voices and their details by sending a GET request to /v1/voices.

What happens if I exceed the rate limit?

The limit is 60 requests per minute per key (10 per minute before the first top-up). Requests are processed sequentially, so under load a request may wait in a queue. If synthesis fails, the charge is returned in full.

Are responses returned as JSON or binary?

The response contains the audio file directly, not JSON. You specify the format using the response_format parameter (mp3, wav, opus, flac, or pcm). The API returns the binary audio data corresponding to your chosen format, which you can save or stream in your application.

How do I handle audio format conversion?

Specify your desired format in the response_format field: mp3, wav, opus, flac, or pcm. The API generates the audio in that exact format. No additional conversion is needed on your end. You receive the binary file directly, ready for playback or storage in your LMS.

Is the API compatible with Node.js?

Yes, since the API uses standard HTTP POST requests with JSON bodies, it works with any language that can make HTTP requests. Node.js applications can use the official OpenAI SDK by adjusting the base URL, or any standard HTTP library like axios or node-fetch.

Can I send text longer than 4096 characters?

Each request supports up to 4096 characters. For longer texts, split the content into chunks of 4096 characters or fewer. Generate audio for each chunk separately, then join the resulting audio files to create a continuous track for your course content.

How do I specify the language in the request?

Include the language parameter with an ISO code. If omitted, the system guesses the language from the script, defaulting to English for Latin text. For non-English Latin-script text, explicitly set the language to ensure accurate synthesis from the supported 23 languages.

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

Both models use the same engine and have the same price. There is no difference in engine or price. You can choose either tts-1 or tts-1-hd without any cost or quality variation based on the product facts provided.

How do I rotate my API key?

Issue a new key from your account dashboard at any time. The new key becomes active immediately, and the old key stops working at once. This allows seamless rotation without downtime. You can manage your keys directly through the account interface.

Is the API available via WebSocket?

No, the API does not support WebSocket or streaming. It is a standard HTTP REST API where you send a text request and receive the completed audio file. There is no real-time partial audio generation or WebSocket connection available for this service.

Do I need to install a specific SDK?

No, you do not need a proprietary SDK. You can use the official OpenAI SDK by changing the base URL, or use any standard HTTP client. Plain HTTP requests with JSON bodies are fully supported, making integration flexible across various programming environments.

First request

curl

curl https://api.o89.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.o89.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.o89.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 /get-api-key/ dashboard to generate your API key using Google or email registration. The interface displays your active key, current balance, and usage statistics alongside a ready-to-use cURL example for immediate testing.

Include the header Authorization: Bearer tts-... in every request. Each account holds one active key; issuing a new one instantly invalidates the previous key, ensuring secure access control for your LMS integration.

Generating your API key

Generating your API key

Navigate to the /get-api-key/ page to create your account via Google or email. Upon sign-in, your unique API key appears immediately. Google-authenticated accounts receive a $0.50 trial credit valid for seven days, while email-based accounts start with a zero balance.

  • Sign up via Google or email on /get-api-key/
  • Receive immediate access to your API key and balance
  • Trial credit ($0.50) applies only to Google sign-ins

Authorization header format

Authorization header format

Every API request requires the Authorization: Bearer tts-... header. Replace tts-... with your specific key string. This single active key authenticates all requests sent to the https://api.o89.info/v1 base URL.

Key rotation policy

You can issue a new API key at any time from your dashboard. When a new key is generated, the old key becomes invalid immediately. This ensures that if a key is exposed, you can revoke access instantly without waiting for a manual review.

Endpoint Overview

Sound wave illustration for: Endpoint Overview

EchoLesson’s TTS API enables LMS administrators to convert course text into audio files via a single endpoint. This integration supports the generation of educational content by sending JSON payloads and receiving binary audio streams.

Speech generation endpoint

Use POST https://api.o89.info/v1/audio/speech to generate audio. This endpoint accepts your input text and returns the synthesized audio file directly in the response body, simplifying integration with existing LMS audio players.

Voices and models listing

Retrieve available voices, languages, and formats via GET /v1/voices. Use GET /v1/models to confirm support for tts-1 and tts-1-hd. All eight voice presets support all 23 listed languages.

  • GET /v1/voices: Lists all voice options and supported formats.
  • GET /v1/models: Confirms available model versions.

Request method and body

Send a JSON body containing model, input, voice, and optional parameters like response_format or speed. The request shape matches the OpenAI speech endpoint, allowing direct use of standard HTTP clients or the OpenAI SDK.

  • Method: POST
  • Content-Type: application/json
  • Body: JSON object with text and voice parameters

Request Parameters

Sound wave illustration for: Request Parameters

Configure the core parameters to define how your educational content is converted into audio. The model determines the synthesis engine, while input limits and voice settings control the output quality and format suitable for your LMS.

Model selection: tts-1 vs. tts-1-hd

Both "tts-1" and "tts-1-hd" use the same underlying engine and incur identical pricing. Choose based on your preference; both models use the same engine and incur identical pricing.

Input text length limits

Each request accepts up to 4096 characters for the input field. Spaces and punctuation count toward this limit. For longer course scripts, split the text into parts, generate audio for each, and join the files.

Voice and language settings

Select one of eight voice presets, such as "sage" for instructional content or "aria" for clear narration. Set the language parameter using an ISO code. If omitted, the system guesses the language, defaulting to English for Latin script.

  • Female: aria, nova, luna, sage
  • Male: felix, milo, atlas, orion
  • Supported: English, Spanish, French, German, etc.

Response Formats

Sound wave illustration for: Response Formats

The API returns generated audio as binary data, allowing flexible integration with your LMS media library. You can choose from MP3, WAV, OPUS, FLAC, or PCM formats based on your storage and playback requirements. Each format balances file size and quality differently, ensuring efficient bandwidth usage for course materials.

Binary responses must be handled carefully to preserve audio integrity. Ensure your integration correctly processes the raw bytes without corruption, especially when storing files for long-term access by students.

Supported audio formats

Choose MP3 for broad compatibility, WAV for high quality, OPUS for efficiency, FLAC for lossless storage, or PCM for raw data processing.

  • MP3: Compressed, widely supported
  • WAV: Uncompressed, high fidelity
  • OPUS: Efficient compression
  • FLAC: Lossless quality
  • PCM: Raw audio data

Handling binary responses

Write binary data directly to a file or stream it to your media server. Avoid text-based encoding unless explicitly required by your LMS infrastructure.

Content-type headers

The response includes a Content-Type header indicating the audio format (e.g., audio/mpeg for MP3). Use this header to correctly identify and save the file.

Rate Limits and Quotas

Sound wave illustration for: Rate Limits and Quotas

EchoLesson’s TTS API enforces a standard rate limit of 60 requests per minute per API key. Since requests are processed sequentially, longer texts may experience queuing during high load, though typical generation speed remains close to real-time (approximately 25 characters per second).

Requests per minute limit

The limit applies to your active API key. You can monitor your usage via the dashboard at /get-api-key/ to ensure you stay within the 60 requests/minute threshold. Exceeding this limit will result in standard rate-limit errors.

Pre-top-up limits

New accounts without a top-up start with a reduced limit of 10 requests per minute. This allows you to test the integration with your LMS before committing to a USDT top-up. Once you top up via TRC-20, the limit increases to 60 requests/minute.

Handling throttling

If you receive a 429 Too Many Requests error, implement exponential backoff in your LMS plugin. Retry the request after a short delay. Since speech synthesis is sequential, queuing may occur even within the limit during peak usage.

Rate Limits and Quotas

Error Handling

Sound wave illustration for: Error Handling

When integrating EchoLesson’s TTS API into your LMS, understanding error responses ensures your audio generation pipeline remains robust. Most failures return standard HTTP status codes, allowing your application to react programmatically rather than failing silently. This guide covers the specific error behaviors relevant to educational content generation workflows.

Proper error handling prevents wasted credits and ensures a smooth user experience for students listening to course materials. By following the recommended retry logic and understanding the refund policy, you can maintain accurate billing records and minimize manual support inquiries.

Common HTTP error codes

The API returns standard HTTP status codes to indicate the result of your request. A 400 Bad Request typically indicates invalid JSON, missing required fields like input, or exceeding the 4096 character limit. A 401 Unauthorized error occurs if your API key is missing, invalid, or expired. A 429 Too Many Requests signal appears when you exceed the 60 requests per minute limit (or 10 per minute before your first top-up).

A 500 Internal Server Error indicates a temporary issue on our side. Failed requests are free, so the charge is returned in full.

  • 400: Invalid parameters or input length exceeded.
  • 401: Invalid or missing API key.
  • 429: Rate limit exceeded.
  • 500: Temporary server error (no charge).

Retry logic for failures

For 429 errors, implement exponential backoff. Start with a 1-second delay and double the wait time for subsequent retries, up to a reasonable maximum. This prevents overwhelming the queue when synthesis is slow or under load.

For 500 errors, a simple immediate retry is often sufficient, as the issue is usually transient.

  • Wait 1 second before retrying on 429.
  • Double the wait time for subsequent retries.
  • Retry immediately once for 500 errors.

Refund for failed requests

If a synthesis fails due to a server error (e.g., 500) or an invalid request that results in no audio generation, the character count is not deducted from your balance. The charge is returned in full automatically. You do not need to submit a support ticket to claim this refund.

Failed requests are free, ensuring you only pay for successfully generated audio files. This applies even if the failure occurs after the API has accepted the request but before the audio is fully encoded.

  • No charge for failed requests.
  • Refunds are automatic.
  • No support ticket required for refunds.

SDK Integration

Sound wave illustration for: SDK Integration

The API mirrors the OpenAI speech endpoint structure, allowing you to leverage existing SDKs without rewriting core logic. This compatibility simplifies integration for LMS administrators who already use Python or JavaScript libraries for other services.

By pointing the SDK’s base URL to our endpoint, you can generate audio files using standard parameters. This approach requires no custom client implementation and works seamlessly with popular development environments.

Using the OpenAI SDK

Install the official openai package. It handles JSON serialization and multipart encoding for audio responses.

Changing the base URL

Configure the client to target https://api.o89.info/v1 instead of OpenAI’s servers. This directs all speech generation requests to our infrastructure while maintaining the same request schema.

  • Set base_url="https://api.o89.info/v1" in your client initialization.
  • Use your tts-... key in the Authorization header.

Code examples in Python

```python from openai import OpenAI client = OpenAI( base_url="https://api.o89.info/v1", api_key="tts-your-api-key" ) response = client.audio.speech.create( model="tts-1", voice="nova", input="Welcome to this lesson.", response_format="mp3" ) response.write_to_file("lesson.mp3") ```

bullets

Curl Examples

Sound wave illustration for: Curl Examples

The following curl commands demonstrate direct API interaction, useful for quick validation before implementing the full integration in your LMS. They cover the standard speech generation workflow using the OpenAI-compatible endpoint.

These examples assume you have already generated an API key via the /get-api-key/ dashboard and have sufficient balance or trial credit.

Basic speech generation request

This command generates audio using the default model and voice. Replace YOUR_API_KEY with your actual key from the dashboard.

The response returns the audio file directly, which can be saved to your local drive for testing.

  • Model defaults to tts-1
  • Voice defaults to nova
  • Format defaults to mp3

Specifying voice and format

Use this example to generate high-quality audio with a specific voice and format. The tts-1-hd model uses the same engine as tts-1.

The language field ensures correct pronunciation for non-English text, such as Spanish or Japanese, which might otherwise default to English.

Testing with short text

Send a short phrase to verify connectivity and key validity before processing large course scripts.

Check the response time; short phrases typically take a few seconds to generate.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Soft skills like leadership or communication benefit from warmer, more engaging tones.

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. MDN: Web Speech API
  3. OpenAI API reference: create speech
  4. Creative Commons Attribution 4.0
  5. Python documentation
  6. TRON developer hub: TRC-20
  7. curl documentation
  8. FFmpeg documentation
  9. LibriVox public-domain audiobooks
  10. LibriTTS-R paper (arXiv 2305.18802)
  11. LibriTTS-R corpus (OpenSLR 141)
  12. openai-node on GitHub

More on this site