Text-to-Speech API Documentation and Quickstart

By LMS Voice editorial team · Updated 2026-11-18

This guide helps product teams integrate LMS Voice’s text-to-speech API into online course workflows. You will learn how to generate natural audio from lesson scripts using standard HTTP requests, compatible with the OpenAI SDK, and manage keys securely via the dashboard.

Explore detailed reference material for voices, languages, and response formats. The documentation covers rate limits, error handling, and advanced parameters like speed control, ensuring you can reliably convert educational content into audio without manual recording overhead.

Text-to-Speech API Documentation and Quickstart

Frequently asked questions

How do I get an API key?

Sign up on the /get-api-key/ page using Google or email plus password. The page displays your active API key, balance, and usage statistics. You can issue a new key at any time, which immediately invalidates the previous one. Each account is tied to a single active key for authentication via the Authorization header.

What is the base URL for the API?

The API base URL is https://api.playds11.com/v1. You send POST requests to https://api.playds11.com/v1/audio/speech for speech synthesis. Other endpoints like /v1/voices and /v1/models are also available under this base URL. Ensure your requests use the correct JSON body structure for the speech endpoint.

Can I use the OpenAI Python SDK?

Yes, the official OpenAI SDKs work by changing the base_url to https://api.playds11.com/v1. You simply provide your LMS Voice API key as the API key. The request shape matches the OpenAI speech endpoint, allowing you to use existing OpenAI-compatible code with minimal configuration changes.

How do I handle rate limits?

The limit is 60 requests per minute per key, or 10 per minute before the first top-up. Requests are processed sequentially, so under load, a request may wait in a queue. Implement exponential backoff in your integration to handle temporary delays or throttling effectively during high-volume generation.

What is the maximum text length?

Each request supports up to 4096 characters for the input field. Spaces and punctuation count as characters toward this limit. For longer texts, split the content into parts of 4096 characters or less. Generate audio for each part and join the resulting files to create the final audio output.

How do I specify a language?

Pass the optional 'language' field with an ISO code in the JSON body. If omitted, the system guesses the language from the script, defaulting to English for Latin text. Explicitly setting the language is recommended for non-English Latin-script text to ensure accurate synthesis and voice selection.

Are there SSML tags supported?

No, SSML tags are not supported. The API accepts plain text input only. There is no support for phoneme dictionaries or custom pronunciation lexicons. You must rely on the natural prosody of the eight available voice presets to convey tone and pacing without additional markup.

How do I handle long texts?

Split your text into chunks of up to 4096 characters. Send each chunk as a separate POST request to the speech endpoint. Receive the audio file for each chunk and join them sequentially. This approach ensures you stay within character limits while producing a continuous audio file.

What happens if the server is down?

There is no SLA or uptime guarantee. If synthesis fails, the charge is returned in full. Failed requests do not consume your balance. You should implement retry logic in your application to handle transient errors or queue delays during periods of high demand or server maintenance.

Is there a webhook for completion?

No, there is no webhook for completion. The API returns the audio file directly in the response. You must poll or wait for the response to receive the generated audio. There are no real-time partial audio streams or WebSocket connections available for this service.

Can I change the voice after starting?

No, you cannot change the voice mid-stream; the API does not support streaming. Each request generates a complete audio file based on the specified parameters. To change the voice, you must send a new request with the desired voice preset. The generated audio is returned immediately upon completion of the request.

How do I revoke my API key?

You can issue a new API key at any time from your account page. Issuing a new key immediately invalidates the old one. This effectively revokes the previous key. You do not need to contact support; the change takes effect instantly across all active connections using the old key.

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

Both models use the same engine and price. The 'model' field accepts either 'tts-1' or 'tts-1-hd' with identical cost per character. Both models use the same engine and price. You can choose either based on your preference, as the underlying synthesis engine remains the same.

Do I need to install extra libraries?

No, you can use the official OpenAI SDK or plain HTTP requests. If using the OpenAI SDK, just update the base_url. No proprietary libraries or mobile SDKs are required. Standard HTTP clients like curl or your language's built-in libraries are sufficient for integrating with the API.

First request

curl

curl https://api.playds11.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.playds11.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.playds11.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 and keys

Sound wave illustration for: Authentication and keys

LMS Voice uses a single active API key per account, issued directly from your dashboard. This key authenticates all requests to the API base URL and allows you to manage access without managing multiple credentials.

Generate API key from dashboard

Generate API key from dashboard

Access the /get-api-key/ page to view your current key, balance, and usage statistics. You can generate a new key at any time through this interface, which is the central point for managing your API credentials.

Bearer token format

Include your key in the HTTP header as Authorization: Bearer tts-.... This standard format ensures compatibility with the OpenAI SDKs and other HTTP clients. The key must be sent with every request to the /v1/audio/speech endpoint.

Revoke old keys instantly

When you generate a new key from the dashboard, the previous key stops working immediately. This allows you to rotate credentials without downtime, ensuring that only your current active key can access the API.

First request with curl

Sound wave illustration for: First request with curl

Generate audio from your lesson scripts by sending a POST request to the speech endpoint. This standard HTTP call accepts your text and configuration, returning the synthesized audio file directly in the response body for immediate use in your LMS player.

The request must include a valid Bearer token in the Authorization header. This authenticates your account and ensures the character usage is deducted from your balance correctly, whether you are on a free trial or a paid top-up.

POST to /v1/audio/speech

Send your request to https://api.playds11.com/v1/audio/speech. This endpoint processes your text and returns the audio file. Ensure your script handles the binary audio data returned in the response body.

The endpoint follows the same shape as the OpenAI speech API, allowing you to use familiar tools and libraries. It processes requests sequentially, so under heavy load, a queue may form, but each request is handled independently.

  • Method: POST
  • URL: https://api.playds11.com/v1/audio/speech
  • Header: Authorization: Bearer YOUR_API_KEY

JSON body structure

The request body is a standard JSON object. It contains the text to be converted, the voice preset to use, and the desired audio format. You can also specify the model and speed parameters to tailor the output.

Keep the input text under 4,096 characters per request. For longer lesson scripts, split the text into chunks, generate audio for each, and join the files in your application logic.

  • model: 'tts-1' or 'tts-1-hd'
  • input: string, max 4096 chars
  • voice: preset name (e.g., 'aria')
  • response_format: 'mp3', 'wav', 'opus', 'flac', or 'pcm'
  • speed: 0.25 to 4.0
  • language: optional ISO code

Required fields: model, input, voice

The model field accepts 'tts-1' or 'tts-1-hd', which use the same engine and pricing. The input field holds your lesson text, and voice selects one of the eight presets, such as 'sage' for instructional content or 'nova' for upbeat segments.

All three fields are mandatory. Without a valid voice preset, the API cannot determine the speaker's timbre. The model choice affects only the audio quality, not the price of generation.

  • model: 'tts-1' or 'tts-1-hd'
  • input: your text string
  • voice: e.g., 'sage', 'nova', 'aria'
First request with curl

OpenAI SDK integration

Sound wave illustration for: OpenAI SDK integration

LMS Voice uses the same request structure as OpenAI’s speech endpoint, allowing product teams to swap providers without rewriting core logic. By simply updating the base URL, your existing integration code remains valid, reducing migration friction for online course platforms, provided the voice and model parameters are adjusted to match the available presets.

Change base_url to api.playds11.com

Point your SDK client to https://api.playds11.com/v1 instead of the default OpenAI endpoint. This small configuration change directs all synthesis requests to LMS Voice’s infrastructure while maintaining standard compatibility.

Use official OpenAI SDKs

You can use the official OpenAI SDKs for Python, Node.js, or other languages. The library handles authentication and serialization automatically, so you only need to adjust the base URL and provide your tts-... bearer token.

  • Works with standard OpenAI client libraries
  • No custom SDK download required

Compatible request shape

Send a JSON body containing model, input, voice, and response_format. The API returns the audio file directly in the response, ready for immediate playback or storage in your LMS media library.

  • Standard JSON structure
  • Direct audio file return

Supported voices and languages

Sound wave illustration for: Supported voices and languages

LMS Voice provides eight distinct voice presets designed to suit various educational contexts, from warm narrations to clear instructional tones. Each voice is generated from licensed recordings, ensuring consistent quality across your course materials without the overhead of manual recording sessions.

These voices are versatile and not tied to a single language, allowing you to produce diverse content for global audiences using a single API key and consistent audio standards.

8 preset voices available

Choose from four female and four male voices, each optimized for specific delivery styles. Select 'aria' for warm, clear narration or 'sage' for calm, instructional content. For more energetic promotional videos within your LMS, 'felix' or 'nova' provide bright, upbeat tones. 'atlas' offers a neutral news style, while 'orion' delivers a deep, documentary feel.

  • 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

23 supported languages

The API supports 23 languages, including English, Spanish, German, French, Japanese, Korean, Chinese, Arabic, Hindi, and Portuguese. This range covers the majority of global e-learning markets, allowing you to localize course content efficiently without needing separate voice actors 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

Automatic language detection

If you do not specify a language, the system guesses it from the text script. Latin script text defaults to English. For non-English Latin-script content, explicitly set the language parameter to ensure accurate pronunciation and tone.

Voice and Language Flexibility

Any voice can speak any of the 23 supported languages, giving you freedom to mix styles and languages in a single course module. This flexibility simplifies production workflows for product teams managing multilingual educational content.

Response formats and codecs

Sound wave illustration for: Response formats and codecs

The API returns generated audio directly in the response body, eliminating the need for separate download steps. You can select the output codec via the response_format parameter to match your LMS player requirements. Options include MP3, WAV, OPUS, FLAC, and PCM, allowing flexibility for both web delivery and high-quality archival.

Since the service processes requests sequentially, the entire audio file is assembled before transmission. This ensures consistent file integrity but means you receive the complete asset rather than a continuous stream of data chunks.

MP3, WAV, OPUS, FLAC, PCM

Choose the format that best fits your educational platform’s constraints. MP3 offers efficient compression for web delivery, while WAV and FLAC provide lossless quality for detailed analysis or high-fidelity playback. PCM and OPUS are available for specific technical integrations, though OPUS is not listed as a supported response format in the API specification.

The selected format directly impacts file size and bandwidth usage without altering the synthetic voice characteristics or the underlying engine quality.

  • MP3: Standard for web playback
  • WAV: Lossless, uncompressed audio
  • OPUS: Efficient compression for web
  • FLAC: Lossless compressed audio
  • PCM: Raw uncompressed audio

Audio file return in response

The API delivers the synthesized audio file as the direct response payload. This simplifies integration into automated course generation pipelines, as the audio data is immediately available for storage or embedding without polling for completion.

No temporary URLs or storage buckets are required. The audio is transient, returned once and not stored by the service, aligning with simple data retention policies for educational content.

No streaming or partial audio

Unlike real-time generation services, this API does not support WebSocket streaming or partial audio chunks. The entire segment is processed and returned as a single file.

This approach ensures stable file boundaries and consistent playback behavior in standard HTML5 audio players used in most LMS environments. For long scripts, split the text into segments under 4096 characters to manage queue wait times effectively.

Response formats and codecs

Rate limits and quotas

Sound wave illustration for: Rate limits and quotas

Rate limits protect service stability for your LMS content generation pipelines. Each API key is capped at 60 requests per minute, ensuring consistent performance during bulk audio production.

Before your first top-up, the limit is lower at 10 requests per minute. This prevents accidental quota exhaustion during initial testing of your course integration.

60 requests per minute per key

Once funded, your key supports up to 60 synthesis requests per minute. This throughput is sufficient for most educational content workflows, allowing steady processing of lesson scripts without manual throttling.

The limit is 60 requests per minute per key.

  • Limit applies per API key, not per account.

10 requests before first top-up

New accounts start with a reduced quota of 10 requests per minute. This allows you to validate the integration with the free trial credit without risking rapid depletion of your initial $0.50.

After your first USDT top-up, the limit automatically increases to the standard 60 requests per minute.

Queue handling under load

Requests are processed sequentially. If you exceed the per-minute limit or if the server is under high load, new requests wait in a queue rather than failing immediately.

This ensures no audio synthesis is lost, though generation time may increase during peak usage periods.

  • Failed requests are free; queued requests are charged only if they are successfully processed.

Error handling and codes

Sound wave illustration for: Error handling and codes

The API returns standard HTTP status codes to indicate request outcomes. A 200 OK response confirms successful audio generation, while 4xx errors typically indicate authentication or parameter issues. For instance, a 401 Unauthorized error occurs if the Bearer token is missing or invalid, while a 429 Too Many Requests error signals that you have exceeded the 60 requests per minute limit.

Understanding these codes helps you debug integration issues quickly. The API does not provide custom error codes beyond standard HTTP conventions, so you should monitor response headers for rate limit information and adjust your request volume accordingly.

Common HTTP error codes

A 400 Bad Request indicates invalid JSON or missing required fields like model or voice. A 401 Unauthorized means your API key is incorrect or invalid. A 429 Too Many Requests appears when you exceed the 60 requests per minute limit per key.

  • 400: Invalid request body or missing fields
  • 401: Invalid or missing API key
  • 429: Rate limit exceeded (60 req/min)

Retry logic for failures

Implement exponential backoff for transient errors like 429 or 500 Internal Server Error. Since requests are processed sequentially, under load a request may wait in a queue, causing temporary delays. Retrying after a short pause usually resolves these issues.

Failed synthesis requests are free, so retrying on failure does not incur additional costs. However, ensure your retry logic respects the rate limit to avoid being temporarily blocked.

  • Use exponential backoff for 429 and 500 errors
  • Retry immediately for transient network issues
  • No cost for failed requests

Character limit exceeded errors

Each request supports up to 4096 characters of input text. If your script exceeds this limit, the API returns a 400 Bad Request error. To handle longer texts, split your content into chunks of 4096 characters or fewer and join the resulting audio files.

This limit applies per request, not per voice or language. Ensure your application logic handles text segmentation efficiently to avoid errors and maintain audio continuity.

  • Max 4096 characters per request
  • Split long texts into chunks
  • Join audio files manually for longer content

Advanced parameters

Sound wave illustration for: Advanced parameters

Beyond the standard request fields, LMS Voice offers precise control over audio pacing, language targeting, and model quality. These parameters allow you to fine-tune the output for specific educational contexts, ensuring the audio matches the intended learning pace and clarity requirements.

Speed control (0.25–4.0)

Adjust the playback speed between 0.25x and 4.0x to accommodate different learning styles. Slower speeds aid comprehension for complex material, while faster speeds suit review sessions. The API processes requests sequentially, so extreme speeds do not significantly alter generation time.

Explicit language setting

While the API guesses language from the script (defaulting to English for Latin text), explicitly setting the language ISO code ensures accuracy. This is critical for non-English Latin-script content or mixed-language lessons, preventing mispronunciation of proper nouns or technical terms.

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

Both tts-1 and tts-1-hd use the same engine and pricing structure. Choose tts-1 for standard clarity or tts-1-hd for higher fidelity. There is no performance difference in generation speed or character limits between the two models.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Our platform streamlines learning management so product teams can scale courses efficiently without technical overhead.

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. LibriTTS-R paper (arXiv 2305.18802)
  3. LibriVox public-domain audiobooks
  4. LibriTTS-R corpus (OpenSLR 141)
  5. openai-node on GitHub
  6. MDN: Web Speech API
  7. IETF RFC 7845: Ogg Opus
  8. OpenAI API reference: create speech
  9. ISO 639 language codes
  10. Node.js documentation
  11. Creative Commons Attribution 4.0
  12. Python documentation

More on this site