API Documentation for AI Voice Generation

By VoxCourse editorial team · Updated 2026-11-19

This documentation guides LMS product teams through integrating VoxCourse’s text-to-speech API for online course voiceovers. You will learn how to generate clear, licensed narration from text using simple HTTP requests or the familiar OpenAI SDK. The guide covers authentication, request parameters, and response handling, ensuring you can deliver high-quality audio assets at scale without legal risk.

We focus on concrete steps for developers building e-learning platforms. You will find ready-to-use cURL examples, a complete list of supported voices and languages, and clear explanations of rate limits and pricing. Whether you are generating short quizzes or long lecture series, this page provides the technical details you need to start synthesizing audio immediately.

API Documentation for AI Voice Generation

Frequently asked questions

What is the endpoint URL?

Send your POST requests to https://api.u388.info/v1/audio/speech. This endpoint accepts JSON bodies containing your text, voice selection, and format preferences. It follows the same request shape as the OpenAI speech endpoint, ensuring compatibility with standard HTTP clients and SDKs without requiring custom integration code for basic usage.

Can I use the official OpenAI SDK?

Yes, the official OpenAI SDKs work perfectly. You just need to change the base_url to https://api.u388.info/v1 and use your site’s API key. This allows you to leverage familiar client libraries for integration into your LMS or application without learning a new SDK from scratch.

How do I authenticate requests?

Include your API key in the Authorization header as a Bearer token: Authorization: Bearer tts-.... You receive one active key per account via the /get-api-key/ page. If needed, you can issue a new key at any time, which immediately invalidates the previous one for security.

What models are available?

Two models are available: tts-1 and tts-1-hd. Both use the same engine and pricing structure. You can choose between them based on your preference, but since the cost is identical, the choice is primarily for compatibility with existing SDK configurations.

Is tts-1-hd more expensive?

No, tts-1-hd is not more expensive. Both tts-1 and tts-1-hd share the same engine and price point. You are charged $0.01 per 1,000 characters regardless of which model you select.

Can I stream the audio?

No, streaming is not supported. The API returns the complete audio file in the response after synthesis is finished. You cannot receive partial audio chunks via WebSocket or streaming endpoints. For long texts, you must split the input and join the resulting audio files manually.

Does the API support SSML?

No, the API does not support SSML. You provide plain text input, and the system handles pronunciation and pacing automatically. There are no phoneme dictionaries or custom pronunciation lexicons available. You control the output primarily by selecting different voices and adjusting the speed parameter within the allowed range.

How do I specify a language?

You can pass an optional ISO language code in the request body. If omitted, the system guesses the language from the script, defaulting to English for Latin text. For non-English Latin-script text, always set the language explicitly to ensure accurate synthesis across the 23 supported languages.

What happens if the text is too long?

The API limits input to 4,096 characters per request. For longer texts, you must split the content into parts of this size, generate audio for each part, and then join the audio files. This ensures consistent quality and prevents timeouts, as each request is processed individually.

Can I use custom voices?

No, custom voice cloning is not offered. You must choose from eight preset voices: Aria, Nova, Luna, Sage, Felix, Milo, Atlas, or Orion. These are based on licensed recordings from LibriTTS-R, from LibriVox public-domain audiobook readings. You cannot upload your own voice or design custom voice profiles for your courses.

Is there a WebSocket endpoint?

No, there is no WebSocket endpoint. The API operates over standard HTTP POST requests. You send text and receive the full audio file in the response. There is no real-time partial audio streaming, so your application must handle the wait time for synthesis to complete before playing the audio.

How do I handle rate limits?

You are limited to 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. Implement retry logic with exponential backoff in your LMS integration to handle temporary delays gracefully.

What happens on a failed request?

Failed requests are free. If synthesis fails, the charge is returned in full to your balance. This ensures you only pay for successfully generated audio files. You can retry the request or split the text differently without worrying about incurring unnecessary costs for errors.

Do you provide a mobile SDK?

No, we do not provide a dedicated mobile SDK. You can use the official OpenAI SDK or plain HTTP requests by adjusting the base_url. This approach works across all platforms, including iOS and Android, allowing your mobile LMS app to integrate directly using standard web technologies.

First request

curl

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

Get Your API Key

Sound wave illustration for: Get Your API Key

Accessing the voice API begins with creating an account on the VoxCourse platform. Navigate to the /get-api-key/ page to initialize your credentials. This step establishes the foundation for all subsequent API interactions, allowing your LMS product team to start generating audio content immediately.

You can register using either a Google account or a standard email and password combination. Each account is tied to the specific site domain, ensuring secure and isolated access for your team’s projects without cross-site interference.

Sign Up on the Site

Sign Up on the Site

Visit the registration page at /get-api-key/ to begin the process. The interface is designed for quick onboarding, requiring minimal information to get your account ready for API usage. Once registered, you can immediately view your dashboard and start generating audio.

  • Simple registration form
  • Immediate dashboard access
  • No credit card required for initial setup

Google or Email Signup

Google or Email Signup

Choose between Google OAuth for a quick sign-in or traditional email/password registration. Google accounts receive a $0.50 free trial credit valid for 7 days, equivalent to about 50,000 characters. Email-based accounts start with zero balance but offer the same core functionality.

  • Google OAuth for speed
  • Email/password for control
  • Trial credit eligibility

Manage Keys in Dashboard

Your dashboard displays your active API key, current balance, and usage statistics. You can issue a new key at any time, which instantly invalidates the previous one, providing simple key rotation security. The dashboard also provides a ready-to-use cURL example for testing your connection.

  • View active API key
  • Issue new key instantly
  • Monitor character usage

First Request with cURL

Sound wave illustration for: First Request with cURL

To generate your first audio file, send a POST request to the speech endpoint. The API accepts standard JSON bodies, allowing you to specify the model, voice, and text input in a single call.

Basic JSON Payload

Construct a JSON object containing your text and desired voice settings. The payload must include the input field with your text string and the voice preset you wish to use.

  • Ensure input is under 4096 characters.
  • Specify response_format as mp3, wav, opus, flac, or pcm.

Authentication Header

Include your API key in the Authorization header. Use the format Bearer tts-your-api-key-here. This authenticates your account and deducts characters from your balance.

Sending Text Input

Send the request via cURL. Replace your-api-key and your-text with your actual credentials and content. The response will return the audio file directly.

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

Using the OpenAI SDK

Sound wave illustration for: Using the OpenAI SDK

Use the standard OpenAI Python or Node.js SDKs to integrate voice generation into your LMS workflow. You only need to adjust the configuration to point to our infrastructure, ensuring compatibility with the codebase your team already knows.

Set Base URL

Configure the SDK client to route requests to our API endpoint. Set the base URL to https://api.u388.info/v1. This ensures all subsequent calls use our TTS engine while maintaining the standard request shape.

Import Standard Libraries

Import the standard OpenAI library from your preferred language package manager. No custom SDKs are required; the official openai package handles the JSON serialization and HTTP transport for you.

Replace API Key

Insert your unique API key from the dashboard into the environment variable or client configuration. The SDK authenticates each request using this key, granting access to your voice presets and character quota.

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts two model variants, tts-1 and tts-1-hd, which share the same engine and pricing. You can switch between them without changing your integration logic, allowing you to test quality differences without affecting your per-character billing rate.

Model Selection (tts-1, tts-1-hd)

Both models accept the same input format and return audio in your chosen response_format. Since pricing is identical, you might start with tts-1 for standard course narration and switch to tts-1-hd only if your LMS users request higher fidelity for complex educational material. Note that both models use the same engine.

Voice Preset Selection

Select one of eight licensed voices to match your course tone. For instructional content, sage offers a calm, clear delivery, while nova provides a brighter, upbeat rhythm suitable for marketing modules. Each voice supports all 23 languages, so you can maintain consistent character voices across multilingual courses.

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

Speed Control (0.25–4.0)

Adjust the speed parameter between 0.25 and 4.0 to fit your pacing needs. Slower speeds (0.5–0.75) help learners process dense technical definitions, while faster speeds (1.2–1.5) keep interactive modules engaging without sounding rushed. The default is 1.0, which approximates natural speech rhythm.

Response Formats

Sound wave illustration for: Response Formats

The API returns audio files in five supported formats: MP3, WAV, Opus, FLAC, and PCM. Choose MP3 for efficient storage or WAV/FLAC for lossless quality in your LMS. PCM is available for raw, uncompressed audio data. The response_format parameter in your POST request determines the output type.

Generated audio is returned directly in the response body as binary data, allowing immediate playback or storage without intermediate file handling.

MP3, WAV, Opus, FLAC, PCM

Select your preferred audio format using the response_format field. MP3 offers small file sizes suitable for web delivery. WAV and FLAC provide high-fidelity audio for professional e-learning content. Opus balances quality and compression, while PCM delivers raw, uncompressed data for specialized processing pipelines.

  • MP3: Compressed, widely compatible
  • WAV/FLAC: Lossless, high quality
  • Opus: Efficient compression
  • PCM: Raw, uncompressed data

Binary Audio Response

The API returns the audio file as binary data in the HTTP response body. This allows direct saving to your LMS media library or immediate playback in the browser. No temporary file creation is needed on your server, streamlining the integration of voiceovers into course modules.

Content-Type Headers

The response includes a Content-Type header indicating the audio format (e.g., audio/mpeg, audio/wav). Ensure your client handles binary data correctly. This header helps automated systems identify the file type for proper storage or playback in your e-learning platform.

Use the Content-Type value to validate the response format matches your request. This prevents errors when integrating audio into your LMS media library.

  • audio/mpeg for MP3
  • audio/wav for WAV
  • audio/flac for FLAC
  • audio/opus for Opus
  • audio/pcm for PCM
Response Formats

Rate Limits and Quotas

Sound wave illustration for: Rate Limits and Quotas

Rate limits protect API stability during high-volume course production. Each API key allows 60 requests per minute, which is sufficient for most LMS integration workflows. Requests are processed sequentially, so longer texts may queue briefly during peak usage.

If your batch generation exceeds this threshold, the API returns standard HTTP 429 errors. Failed requests do not consume your character quota or balance, ensuring you only pay for successfully generated audio files.

60 Requests Per Minute

The standard limit is 60 requests per minute per active key. This allows you to generate multiple voiceovers for different course modules simultaneously without exceeding capacity.

  • Standard limit: 60 requests per minute
  • Applies per API key
  • Processes sequentially

10 RPM Before Top-Up

New accounts or those with insufficient balance start with a reduced limit of 10 requests per minute. This ensures stable service while you configure your integration before adding funds via USDT.

Once your TRC-20 top-up is credited, your limit automatically increases to the full 60 requests per minute.

Handling Throttling

Implement exponential backoff in your LMS plugin or script when receiving 429 status codes. Retry the request after a short delay, typically 1-2 seconds, to avoid overwhelming the queue.

Monitor your dashboard usage stats to anticipate high-volume periods and schedule bulk generations during off-peak hours if necessary.

Error Handling

Sound wave illustration for: Error Handling

Errors are usually straightforward to resolve. Most issues stem from incorrect payloads or temporary network hiccups. The API returns standard HTTP status codes to indicate the result of your synthesis request, allowing your LMS to handle failures gracefully without interrupting the user experience.

When a request fails, the charge is returned in full. This ensures that your billing remains accurate even during temporary outages or processing delays.

Common HTTP Errors

Use standard HTTP codes to debug. A 400 Bad Request indicates invalid JSON or missing fields. A 401 Unauthorized means your API key is missing or invalid. A 429 Too Many Requests signals you have exceeded the 60 requests per minute limit.

  • 400: Invalid input or format
  • 401: Missing or invalid API key
  • 429: Rate limit exceeded

Failed Request Refunds

If synthesis fails on the server side, the charge is returned in full. You do not lose credit for audio that was not delivered. This applies to unexpected errors during the processing queue.

Debugging Tips

Check your character count is under 4096. Ensure the voice ID exists in the /voices endpoint. Verify your base URL is correct. If errors persist, contact support via email.

Voice and Language Codes

Sound wave illustration for: Voice and Language Codes

Select from eight distinct voice presets or configure the language explicitly for precise e-learning narration. Our API supports 23 languages, ensuring your course content reaches a global audience with consistent quality.

Use standard ISO codes to override automatic language detection, which is crucial for Latin-script texts that might otherwise default to English. This ensures accurate pronunciation for non-English content.

List of 8 Voices

Choose from four female and four male voices optimized for clarity and engagement in educational settings.

  • 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

All voices support every listed language. Unsupported languages include Vietnamese, Indonesian, Thai, Ukrainian, Romanian, Czech, and Bengali.

  • Arabic
  • Chinese
  • Danish
  • Dutch
  • English
  • Finnish
  • French
  • German
  • Greek
  • Hebrew
  • Hindi
  • Italian
  • Japanese
  • Korean
  • Malay
  • Norwegian
  • Polish
  • Portuguese
  • Russian
  • Spanish
  • Swahili
  • Swedish
  • Turkish

ISO Code Usage

If the language parameter is omitted, the system guesses based on the script, defaulting to English for Latin text. Set the language field explicitly for non-English Latin-script content to avoid misinterpretation.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. For Latin-script text that isn't English, always specify the language code to ensure accuracy.

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. Python documentation
  3. LibriTTS-R corpus (OpenSLR 141)
  4. IETF RFC 7845: Ogg Opus
  5. openai-node on GitHub
  6. TRON developer hub: TRC-20
  7. Tether (USDT)
  8. openai-python on GitHub
  9. OpenAI API reference: create speech
  10. curl documentation
  11. LibriVox public-domain audiobooks
  12. LibriTTS-R paper (arXiv 2305.18802)

More on this site