Get Started with CourseVoice Text-to-Speech API Integration

By CourseVoice editorial team · Updated 2026-11-19

This guide helps no-code creators integrate CourseVoice’s text-to-speech API into their e-learning workflows. You will learn how to authenticate, send course scripts, and receive audio files suitable for LMS modules. The documentation covers essential endpoints, rate limits, and error handling to generate narration without hiring voice talent.

Follow the cURL examples or use the OpenAI SDK to generate human-sounding audio directly from your course materials. We detail authentication, request structures, and supported formats like MP3 and WAV. By the end, you will be able to test your setup using the $0.50 trial credit and understand how to manage character limits and speed settings for your educational content.

Get Started with CourseVoice Text-to-Speech API Integration

Frequently asked questions

How do I get an API key?

Sign up on the /get-api-key/ page using Google or email and password. Your account key appears immediately on the dashboard alongside your balance and usage statistics. Each account is tied to the specific site domain.

What is the base_url for the OpenAI SDK?

Use https://api.mxgana.info/v1 as your base_url. The request shape matches the OpenAI speech endpoint, allowing you to use official OpenAI SDKs by simply pointing them to this base URL with your CourseVoice key.

Which voices are available via the API?

Eight presets are available: aria, nova, luna, sage, felix, milo, atlas, and orion. These voices cover various tones from warm narration to deep documentary styles. Any voice can speak any of the 23 supported languages.

Can I use SSML tags with this API?

No, this API does not support SSML tags. You send plain text in the input field. For precise control, adjust the speed parameter between 0.25 and 4.0, or split text into smaller chunks for better pacing.

How do I handle long course scripts?

Split your script into parts of up to 4096 characters. Generate audio for each part separately, then join the resulting audio files. This ensures each request stays within the character limit and processes efficiently.

What is the maximum text length?

The maximum input length is 4096 characters per request. Spaces and punctuation count toward this limit. For longer course modules, you must split the text into multiple requests and concatenate the resulting audio files.

Is there a rate limit for requests?

Yes, the limit is 60 requests per minute per key. Before your first top-up, the limit is 10 requests per minute. Requests are processed sequentially, so high volume may cause queuing delays during peak times.

Do I need an SDK to use the API?

No, an SDK is not required. You can use plain HTTP requests or the official OpenAI SDK by changing the base URL. Any standard HTTP client capable of sending JSON POST requests will work effectively.

What formats can I receive audio in?

You can receive audio in mp3, wav, opus, flac, or pcm formats. Specify the desired format using the response_format field in your JSON request body. All generated files include an inaudible synthetic speech watermark.

How do I authenticate my requests?

Include your API key in the request header as Authorization: Bearer tts-.... You receive one active key per account. If you issue a new key, the previous one stops working immediately.

What happens if the API is down?

There is no SLA or uptime guarantee. If synthesis fails, the charge is returned in full. Request metadata is kept for billing, but input text is not stored. Support is available via email only.

Can I use the same key on multiple sites?

Accounts are per site. Each site in the network is an independent storefront. You have a separate account and key for this domain.

How do I revoke my API key?

Issue a new key from your dashboard. The new key becomes active immediately, and the old one stops working at once. You do not need to wait for a delay; the old key is invalid instantly.

Is the API documentation public?

Yes, this documentation is public. You can access the full endpoint details at /docs/. The endpoints include POST /v1/audio/speech, GET /v1/voices, and GET /v1/models for listing available voices and models.

First request

curl

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

Sound wave illustration for: Authentication

Start by signing in via Google or email at /get-api-key/ to retrieve your unique API key. This key authenticates all requests to the TTS engine. You can issue a new key at any time, which immediately invalidates the previous one, ensuring tight control over access for your course development workflow.

The API requires a standard Bearer token in the HTTP header. Include Authorization: Bearer tts-... with every request. This simple header structure allows you to use the official OpenAI SDKs by just pointing them to our base URL, keeping your integration lightweight and compatible with existing tools.

Generate your API key

Generate your API key

Access the /get-api-key/ page to sign up or log in. Upon authentication, your active key is displayed alongside your current balance and usage statistics. You can generate a fresh key at any time; the old one stops working immediately, providing a secure method to rotate credentials without downtime in your LMS pipeline.

  • Sign up with Google or email + password.
  • View key, balance, and character usage on the dashboard.
  • Issue a new key anytime to invalidate the old one instantly.

Use Bearer token header

Use Bearer token header

Include the Authorization header with every API call. The format is strictly Authorization: Bearer YOUR_KEY_HERE. This standard approach ensures compatibility with the OpenAI SDKs and any HTTP client that supports bearer authentication, simplifying integration into your no-code or code-based course authoring tools.

  • Header format: Authorization: Bearer tts-...
  • Works with OpenAI SDKs and standard HTTP clients.
  • Securely transmit your key in every request.

One key per account

Each account maintains one active API key. If you generate a new key, the previous one is immediately revoked. This design simplifies security management for individual creators or small teams, as you do not need to track multiple active credentials simultaneously. Keep your key secure in your environment variables.

  • Only one active key per account.
  • New keys instantly invalidate old ones.
  • Ideal for simple security management in course projects.

First request with cURL

Sound wave illustration for: First request with cURL

Sending a POST request to the speech endpoint converts your text into audio. The API accepts a JSON body containing the source text and voice selection. You receive the synthesized audio file directly in the response, ready for playback or storage.

Specify the model, input text, and voice preset. The system handles encoding based on your chosen format. Keep input under 4096 characters per request to ensure immediate processing.

Basic JSON structure

The request body is a standard JSON object. It includes the model identifier, the raw text string, and the target voice preset. Optional parameters like speed or language can be included to refine the output.

Required fields: model, input, voice

Use 'tts-1' or 'tts-1-hd' for the model. The input field accepts up to 4096 characters of text. Select one of the eight available voices, such as 'aria' or 'nova', to define the narration style.

Example command snippet

Use cURL to send your first synthesis request. Replace the placeholder with your API key and desired text.

```bash curl -X POST https://api.mxgana.info/v1/audio/speech \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{"model": "tts-1", "input": "Welcome to this module.", "voice": "nova"}' ```

OpenAI SDK integration

Sound wave illustration for: OpenAI SDK integration

CourseVoice implements the same request shape as the OpenAI Speech endpoint, allowing you to leverage existing client libraries without rewriting your audio generation logic. This compatibility ensures a smooth transition for developers already familiar with the standard TTS workflow.

Set base_url to our domain

Point your SDK client to the CourseVoice API base URL: https://api.mxgana.info/v1. This directs all speech synthesis requests to the correct endpoint while maintaining the standard JSON body structure.

Use official OpenAI SDKs

Import the official OpenAI SDK for your preferred language. The library handles the HTTP communication and JSON serialization automatically. You only need to ensure the client targets the CourseVoice base URL instead of OpenAI's servers.

  • Supported languages: Python, Node.js, C#, Java, Go, and Ruby.
  • No custom SDK required; use the standard client.

Change key to your API key

Replace the default API key with your CourseVoice key (format: tts-...). The SDK uses this key for authentication via the Authorization: Bearer header. One key per account ensures consistent rate limiting and billing tracking.

  • Key format: tts-...
  • One active key per account.

Response formats

Sound wave illustration for: Response formats

The API returns audio files in the format you specify via the response_format parameter. This decision affects file size, compatibility, and final quality. Choose the format that best fits your LMS or web player requirements.

All formats are generated using the same underlying engine. The quality remains consistent regardless of whether you select MP3 or FLAC. The primary difference lies in compression and bitrate, which influences bandwidth usage and playback speed.

MP3 for web playback

MP3 is the recommended format for most web-based courses. It offers a good balance between file size and audio quality. Most modern browsers and LMS platforms support MP3 playback natively without additional plugins.

  • Small file sizes reduce bandwidth costs
  • Universal compatibility with HTML5 audio players
  • Ideal for mobile learners on limited connections

WAV for high quality

WAV provides uncompressed, lossless audio. Use this format if your course requires pristine audio fidelity for educational purposes. It is suitable for archival storage or high-end audio players that support large files.

  • Lossless quality
  • Larger file sizes
  • Supports higher bitrates

OPUS and FLAC support

OPUS offers efficient compression, while FLAC provides lossless compression with smaller files than WAV. These formats are useful for specific technical requirements or when storage efficiency is critical without losing audio integrity.

  • OPUS: efficient compression
  • FLAC: lossless compression
  • Smaller files than WAV

Rate limits

Sound wave illustration for: Rate limits

CourseVoice enforces a strict rate limit of 60 requests per minute per API key. This limit applies to all POST /v1/audio/speech calls, ensuring fair usage across your e-learning module generation pipeline. Exceeding this threshold triggers HTTP 429 errors, requiring you to implement exponential backoff in your no-code automation scripts.

60 requests per minute

The standard rate limit allows 60 requests per minute for accounts with a funded balance. This throughput allows generating course scripts, as each request handles up to 4,096 characters. Monitor your usage dashboard to avoid hitting this ceiling during peak production hours.

10 requests before first top-up

New accounts without a USDT top-up are restricted to 10 requests per minute. This lower limit ensures the $0.50 trial credit lasts for initial testing. Once you add funds via TRC-20, the limit automatically increases to the full 60 requests per minute.

Queue behavior under load

Requests are processed sequentially. Under heavy load, your synthesis job may wait in a queue before processing begins. Typical speed is roughly real-time (25 characters per second), but queueing adds latency. Design your LMS integration to handle these delays gracefully without timing out.

Rate limits

Error handling

Sound wave illustration for: Error handling

Errors are returned as standard HTTP codes with a JSON body. Failed synthesis requests are free, so any charge is reversed immediately. This ensures you only pay for successfully generated audio files.

The API validates inputs before processing. Common issues include using an unsupported voice, sending text that exceeds the character limit, or network timeouts during high load.

Common HTTP error codes

400 Bad Request indicates invalid JSON or missing fields. 401 Unauthorized means the API key is incorrect or expired. 429 Too Many Requests triggers when you exceed 60 requests per minute or the 10-request limit before your first top-up.

503 Service Unavailable suggests the queue is full. Since requests are processed sequentially, long texts may wait in line, but failed attempts incur no cost.

  • 400: Invalid request body
  • 401: Invalid API key
  • 429: Rate limit exceeded
  • 503: Service temporarily unavailable

Invalid voice names

The API rejects voices not in the preset list. Use GET /v1/voices to retrieve the exact eight valid voice IDs (e.g., aria, nova, luna). Sending an unknown voice name returns a 400 error.

Ensure the voice matches the language if specified. While any voice can speak any of the 23 supported languages, incorrect language codes may affect quality.

Text length exceeding 4096 chars

Each request supports a maximum of 4096 characters, including spaces and punctuation. Sending longer text results in a 400 error.

Split your course script into chunks of 4096 characters or less. Generate audio for each part separately and join the files using your preferred audio tool.

Endpoints reference

Sound wave illustration for: Endpoints reference

The CourseVoice API exposes three primary endpoints for integration. The main synthesis endpoint accepts text and parameters to generate audio, while the metadata endpoints provide configuration details for voices and available models.

POST /v1/audio/speech

Accepts JSON payloads containing the text to convert. Required fields include model ("tts-1" or "tts-1-hd"), input (up to 4096 characters), and voice. Supports optional parameters like speed (0.25–4.0) and language.

  • Returns audio file in specified response_format (mp3, wav, opus, flac, pcm).

GET /v1/voices

Returns the list of 8 available voice presets and supported languages. Useful for verifying voice IDs before synthesis. Supports 23 languages including English, Spanish, and German.

  • Useful for dynamic voice selection in LMS plugins.

GET /v1/models

Lists available models. Currently supports "tts-1" and "tts-1-hd" with the same engine but different quality tiers. Both incur the same $0.01 per 1,000 characters rate.

Testing your setup

Sound wave illustration for: Testing your setup

Use your $0.50 trial credit (approx. 50,000 characters) to verify API connectivity immediately after signing in. This credit is valid for 7 days and requires no payment method, allowing you to test core synthesis without financial commitment or top-up.

Run a basic cURL request to generate a short audio clip. Confirm the API returns a valid audio file in your chosen format, ensuring your integration pipeline correctly handles the response stream or file download.

Verify audio playback

Play the generated file locally or in a web player. Check for clarity, correct language pronunciation, and appropriate speed settings. Note that synthetic speech carries an inaudible watermark, which does not affect playback quality but confirms the audio is AI-generated.

  • Test with short phrases to ensure low latency response.
  • Verify language detection matches your input script.
  • Check volume levels and audio format fidelity (MP3/WAV/OPUS/FLAC).

Check response headers

Inspect the HTTP response headers to confirm successful processing. Verify the status code is 200 OK and check the Content-Type header matches your requested format. This confirms the server received and processed your request correctly without errors.

  • Status: 200 OK
  • Content-Type: audio/mpeg (or wav/opus/flac)
  • X-Request-Id: Unique identifier for debugging

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. It maintains a professional yet approachable demeanor throughout long modules.

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. Tether (USDT)
  3. OpenAI API reference: create speech
  4. Creative Commons Attribution 4.0
  5. W3C WAI: making audio and video accessible
  6. TRON developer hub: TRC-20
  7. MDN: Web Speech API
  8. LibriVox public-domain audiobooks
  9. openai-python on GitHub
  10. FFmpeg documentation
  11. Python documentation
  12. LibriTTS-R paper (arXiv 2305.18802)

More on this site