Add Synthetic Voice Audio to Your LMS with Our REST API

By Narrata editorial team · Updated 2026-11-19

This guide provides LMS developers with the technical details needed to integrate synthetic voice audio into your learning management system. You will learn how to authenticate requests, generate audio files using standard REST endpoints, and manage voice settings for consistent educational content. The API follows the OpenAI speech endpoint structure, allowing you to use familiar tools and SDKs with minimal configuration.

Designed for teams building large-scale course libraries, this documentation covers key integration steps including rate limits, error handling, and long-text processing. You will find concrete examples for generating audio in multiple formats and languages, ensuring your L&D projects remain compliant and scalable without requiring custom infrastructure or specialized plugins.

Add Synthetic Voice Audio to Your LMS with Our REST API

Frequently asked questions

How do I get an API key?

Navigate to /get-api-key/ and sign in using Google or an email and password combination. The dashboard displays your active API key, current balance, and usage statistics. If you use Google sign-in, you receive a $0.50 trial credit valid for seven days. Email-based accounts start without trial credit.

Can I use the OpenAI Python SDK with this API?

Yes. The API endpoint matches the OpenAI speech endpoint request shape. You can use the official OpenAI SDKs by changing the base_url to https://api.c168s.info/v1 and providing your Narrata API key. This allows seamless integration with existing Python codebases designed for OpenAI-compatible services.

What is the maximum text length per request?

Each request supports up to 4096 characters of input text. Spaces and punctuation count toward this limit. For longer content, split the text into chunks of 4096 characters or less, generate audio for each part, and join the resulting audio files together.

How do I specify the language for text in Latin script?

If the language parameter is omitted, the system guesses the language from the script, defaulting to English for Latin text. To ensure correct pronunciation for non-English Latin-script text, explicitly set the language parameter to the appropriate ISO code in your request body.

Are there any SSML tags supported?

No. The API does not support SSML (Speech Synthesis Markup Language). It accepts plain text input only. Features like phoneme dictionaries, custom pronunciation lexicons, emotion tags, and SSML are not available in this service.

What audio formats are available?

You can request audio in mp3, wav, opus, flac, or pcm formats. Specify the desired format using the response_format field in your JSON request body. The API returns the generated audio file directly in the response.

How fast is the synthesis process?

Typical speed is roughly real-time, generating about 25 characters of text per second of audio. Short phrases may take a few seconds. Requests are processed sequentially, so under load, a request may wait in a queue before synthesis begins.

What happens if I hit the rate limit?

The limit is 60 requests per minute per key (or 10 per minute before the first top-up). Exceeding this limit will result in errors. Failed requests are free, and charges are returned in full if synthesis fails.

Can I generate audio for long videos in one go?

No, because each request is limited to 4096 characters. You must split long scripts into smaller parts, generate audio for each part individually, and then join the resulting audio files. This ensures compliance with the character limit per request.

How do I handle errors in my LMS integration?

Monitor the HTTP status codes and response bodies from the API. If synthesis fails, the charge is returned in full. Implement retry logic for transient errors, keeping in mind the rate limits of 60 requests per minute per key.

Is the API key reusable?

Yes, each account has one active API key that can be used across multiple requests and integrations. You can continue using the same key for all your TTS operations until you decide to rotate it or if it is revoked.

Can I rotate my API key?

Yes, you can issue a new API key at any time from your dashboard. When a new key is issued, the old one stops working immediately. This allows you to maintain security. Note that the old key stops working immediately.

Do I need to install any specific libraries?

No specific proprietary libraries are required. You can use the official OpenAI SDKs or plain HTTP requests. Since the endpoint shape matches OpenAI, standard HTTP clients or the OpenAI Python package are sufficient for integration with your LMS.

Is the API RESTful or gRPC?

The API is RESTful. It uses standard HTTP methods, specifically POST for speech generation and GET for retrieving voices and models. Requests are sent as JSON bodies, and responses are returned in standard HTTP formats.

First request

curl

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

To generate audio, you must authenticate every request using a Bearer token. Your unique API key is issued when you sign in via /get-api-key/. Use the header Authorization: Bearer tts-<your_key> in all POST requests to https://api.c168s.info/v1.

Getting Your API Key

Getting Your API Key

Access your key from the dashboard after signing in with Google or email. The interface displays your active key, current balance, and a ready-to-use cURL example. Keys are tied to your account on this specific site.

  • Keys are generated upon sign-up or via the dashboard refresh.
  • One active key per account; issuing a new key invalidates the old one immediately.

Managing Key Security

Managing Key Security

Keep your key secure in your LMS environment variables. Since only one key is active at a time, revoking access is simple: generate a new key from the dashboard to instantly deactivate the previous one.

Monitor usage directly in the dashboard to track character consumption and ensure billing accuracy.

Quickstart with cURL

Sound wave illustration for: Quickstart with cURL

Generate audio files directly from your LMS using a simple HTTP POST request. This section covers the basic cURL command to send text and receive an audio file.

The API returns the audio file in the response body. You can save this file to your server. Note that the API does not support streaming; the full audio file is returned in the response body.

Basic Synthesis Request

Send a POST request to https://api.c168s.info/v1/audio/speech with your API key in the Authorization header. Include the text input, voice selection, and desired output format in the JSON body.

Example: curl -X POST https://api.c168s.info/v1/audio/speech -H "Authorization: Bearer tts-..." -H "Content-Type: application/json" -d '{"model": "tts-1", "input": "Hello world", "voice": "nova", "response_format": "mp3"}'

  • Endpoint: POST https://api.c168s.info/v1/audio/speech
  • Auth: Bearer token in header
  • Body: JSON with model, input, voice, format

Response Handling

On success, the API returns the audio file directly in the response body. The content type matches your requested format (e.g., audio/mpeg).

If the request fails, check the status code and error message in the response body for details like rate limits or invalid input.

  • Success: Audio file in body
  • Error: JSON with status and message
  • Format: Matches response_format parameter

Integration with OpenAI SDK

Sound wave illustration for: Integration with OpenAI SDK

The API mirrors the OpenAI speech endpoint structure, allowing you to reuse existing OpenAI SDK clients with minimal configuration. By pointing the client to our base URL, you leverage familiar methods while accessing Narrata’s specific voice models and pricing.

This approach simplifies integration for LMS developers already familiar with the OpenAI ecosystem, reducing the learning curve for adding synthetic audio to course modules or training videos.

Configuring base_url

Set the base_url to https://api.c168s.info/v1 in your OpenAI SDK client. This directs all requests to our infrastructure while maintaining the standard request shape for audio synthesis.

Ensure your API key is passed via the Authorization: Bearer header. The SDK will handle the routing automatically once the base URL is updated.

  • Base URL: https://api.c168s.info/v1
  • Auth Header: Authorization: Bearer <your-key>
  • Request Shape: Identical to OpenAI /v1/audio/speech

Using Official SDKs

Use the official OpenAI SDK for your preferred language (Python, Node.js, etc.). Pass your Narrata API key and the configured base URL.

Send text via the input field and select a model (tts-1 or tts-1-hd). The SDK returns the audio file directly, ready for storage in your LMS.

Note that while the SDK works, it is not our proprietary SDK. We recommend plain HTTP for maximum flexibility with custom retry logic.

Supported Voices and Languages

Sound wave illustration for: Supported Voices and Languages

Narrata provides eight distinct voice presets designed for consistent educational content. Each voice is built from licensed recordings, ensuring legal clarity for course producers who need reliable, synthetic audio for large-scale LMS libraries without copyright ambiguity.

8 Preset Voice Options

Female voices include Aria (warm, clear narrator), Nova (bright, upbeat), Luna (soft, storytelling), and Sage (calm, instructional). Male options feature Felix (energetic, promo), Milo (friendly, conversational), Atlas (neutral, news), and Orion (deep, documentary).

These presets cover common e-learning tones, from instructional guides to engaging course intros. All voices support the same language range, allowing you to maintain audio consistency across diverse course modules.

23 Supported Languages

The API supports 23 languages, including English, Spanish, German, French, Japanese, Korean, Mandarin Chinese, Arabic, Hindi, Portuguese, Russian, Italian, Turkish, Dutch, Swedish, Polish, Finnish, Greek, Hebrew, Danish, Norwegian, Malay, and Swahili. Any voice can speak any supported language.

If the language field is omitted, the system guesses the language from the script. For non-English Latin-script text, explicitly set the language parameter to ensure accuracy. Unsupported languages include Vietnamese, Thai, and Ukrainian.

Audio Formats and Settings

Sound wave illustration for: Audio Formats and Settings

The API returns audio in five standard formats: MP3, WAV, Opus, FLAC, and PCM. MP3 is optimal for web players due to small file sizes, while WAV and FLAC provide uncompressed quality for high-fidelity LMS libraries. PCM offers raw data for custom processing, and Opus balances efficiency with quality.

Each format is delivered as a direct binary response, allowing immediate saving or upload to your content management system without intermediate conversion steps. This flexibility ensures compatibility across various Learning Management System audio players and downstream editing pipelines used by course production teams.

Speed Control (0.25–4.0)

Adjust narration pace using the speed parameter, accepting values between 0.25 and 4.0. The default speed is 1.0, which approximates natural speech rate. Slower speeds (e.g., 0.75) aid comprehension for complex technical material, while faster settings (1.5+) suit review content or quick updates.

Speed adjustments alter the audio duration without changing the voice characteristics. This allows L&D teams to standardize pacing across large course libraries or accelerate repetitive instructional content to reduce total generation time and costs.

  • Minimum speed: 0.25x
  • Maximum speed: 4.0x
  • Default speed: 1.0x
  • Applies to all voices
  • No SSML speed tags
  • Affects audio duration directly
Audio Formats and Settings

Rate Limits and Performance

Sound wave illustration for: Rate Limits and Performance

Rate limits protect service stability during high-volume LMS content generation. Each API key supports 60 requests per minute. New accounts start with a lower limit of 10 requests per minute until the first top-up is processed. This ensures fair usage while maintaining consistent audio synthesis quality for your educational content pipeline.

Under heavy load, requests are processed sequentially. If your system sends multiple synthesis jobs simultaneously, they may wait in a queue before processing begins. For long texts, the typical speed is roughly real-time, generating approximately 25 characters of text per second of audio. Short phrases may take a few seconds to complete.

60 Requests Per Minute

Each active API key is limited to 60 requests per minute. New accounts begin with a 10 requests per minute limit. This threshold increases to 60 automatically after the first top-up is credited to your account. Exceeding this limit results in a 429 Too Many Requests error, indicating that you should pause and retry later.

  • Standard limit: 60 requests per minute per key
  • New account limit: 10 requests per minute
  • Limit increases automatically after first top-up
  • Exceeding limit returns HTTP 429 error

Processing Queues

Requests are processed one after another. If multiple synthesis jobs are submitted simultaneously, they enter a processing queue. Under high load, a request may wait in this queue before synthesis begins. This sequential processing ensures that each audio file is generated with consistent quality, though it may affect real-time streaming expectations for large batch operations.

Handling Long Texts

Sound wave illustration for: Handling Long Texts

Generating audio for entire course modules often exceeds the 4096-character limit per request. To handle long texts, you must split the input text into smaller parts and join the resulting audio files.

This approach ensures consistent voice quality and avoids truncation. Splitting logic should preserve natural pauses between sentences to maintain listener comprehension.

Splitting into 4096 Character Chunks

Divide your script into segments of up to 4096 characters. Each segment becomes a separate API call. Ensure breaks occur at sentence boundaries to avoid abrupt audio cuts.

Count spaces and punctuation as characters. For example, a 10,000-character lecture requires three separate requests. This method keeps each payload within system limits.

  • Maximum input length: 4096 characters per request
  • Split at sentence or paragraph boundaries
  • Count spaces and punctuation toward the limit

Joining Audio Files

After receiving audio files for each segment, concatenate them in the original order. Use a media library or simple file merging tool to create the final track.

This workflow supports large educational content libraries. The resulting audio maintains the narrative flow of the original text.

  • Concatenate files in original sequence
  • Use standard media tools for merging
  • Maintain original segment order

Error Handling and Status Codes

Sound wave illustration for: Error Handling and Status Codes

Synthetic audio generation may occasionally fail due to transient network issues or service overload. When a request fails, the API returns a standard HTTP error code and refunds the character count, ensuring you are not charged for failed synthesis attempts.

Understanding these responses helps you maintain stable integrations with your LMS without unnecessary overhead.

Common Error Responses

The API uses standard HTTP status codes to indicate the outcome of your request. A 4xx error typically indicates an issue with your request, such as an invalid API key or exceeding the 4096 character limit per chunk. A 5xx error suggests a temporary server-side issue, such as high load causing processing delays or failures.

  • 400 Bad Request: Invalid parameters or text exceeding limits.
  • 401 Unauthorized: Invalid or expired API key.
  • 429 Too Many Requests: Rate limit exceeded (60 req/min).
  • 500 Internal Server Error: Temporary synthesis failure.

Retry Logic

Implement exponential backoff for 5xx errors to handle transient failures gracefully. For 429 rate limit errors, wait briefly before retrying, as you are limited to 60 requests per minute per key. Since failed requests are refunded, retrying does not incur additional cost unless the retry itself succeeds.

  • Use exponential backoff for 5xx errors.
  • Wait and retry on 429 rate limits.
  • No cost for failed retries.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. This preset is particularly effective for keeping learners engaged in short modules or promotional training content.

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

More on this site