Frequently asked questions
What is a TTS API?
It is a cloud service that converts text into audio files. Send a POST request to the endpoint, and receive an audio file in formats like mp3 or wav. It works like the OpenAI speech endpoint, allowing you to use standard HTTP requests or the OpenAI SDK by adjusting the base URL.
How do I choose a voice for my course?
Select from eight presets based on your course tone. Options include aria (warm narrator), nova (upbeat), luna (storytelling), sage (instructional), felix (energetic), milo (conversational), atlas (neutral news), and orion (deep documentary). Each voice supports all 23 available languages, ensuring consistent narration across your modules.
Can I use TTS for all my course modules?
Yes, you can generate audio for any text up to 4096 characters per request. The API supports 23 languages, including English, Spanish, and German. You can use different voices for different modules to vary the listening experience, as any voice can speak any supported language.
How do I split long text for the API?
Split your script into parts of up to 4096 characters each. Send each part as a separate POST request to the speech endpoint. Once you receive the audio files for all parts, join them sequentially to create the final complete audio file for your course module.
What is the character limit per request?
The input text field accepts up to 4096 characters per request. This includes spaces and punctuation. If your script exceeds this limit, you must split it into multiple requests, generate the audio for each part, and then concatenate the resulting audio files.
Does the API support multiple languages?
Yes, it supports 23 languages including English, Chinese, French, German, Spanish, and Japanese. Any voice can speak any of these languages. If you do not set the language parameter, the system guesses it from the script, defaulting to English for Latin text.
How long does audio generation take?
Generation takes roughly real-time, about 25 characters of text per second of audio. Short phrases take a few seconds. Requests are processed sequentially, so under load, your request may wait in a queue. Failed requests are free and do not consume your balance.
Can I edit the generated audio?
The API returns raw audio files (mp3, wav, opus, flac, or pcm). You can edit these files using any standard audio software. The generated audio contains an inaudible watermark marking it as synthetic speech, but otherwise, it is a standard file you can manipulate freely.
Do I need coding skills to use the API?
Basic coding skills help, but the API is designed for simplicity. It uses a standard JSON request shape compatible with the OpenAI SDK. You can also use simple curl commands or any HTTP client. No custom SDK is required.
What is the base_url for integration?
The API base URL is https://api.mxgana.info/v1. To use the official OpenAI SDK, change the base_url to this address. Use your API key in the Authorization header as a Bearer token. The speech endpoint is POST /v1/audio/speech.
How do I handle API errors?
If synthesis fails, the charge is returned in full. Check your request format, character limits, and voice availability. Ensure your API key is correct and active. Failed requests do not consume your character balance, so you can retry without cost if the issue is resolved.
Is the audio synthetic or human?
The audio is synthetic speech generated from licensed recordings. Every file carries an inaudible watermark identifying it as synthetic. The voices are based on licensed recordings from LibriTTS-R (CC BY 4.0) and LibriVox public-domain audiobook readings. It is not voice cloning.
Can I use the API for quizzes?
Yes, you can generate audio for quiz questions and answers. Send the quiz text via POST to the speech endpoint. The API handles any text up to 4096 characters. You can use different voices for questions and answers to create a distinct auditory experience for learners.
How do I track my API usage?
Log in to your account at /get-api-key/ to view your balance, characters left, and usage history. The dashboard shows your current key and a ready curl example. Request metadata, including time and status, is kept for billing purposes and visible in your account.
Understanding TTS for education
Text-to-speech (TTS) converts written text into audio files via an API. For e-learning, it allows creators to generate narration directly from course scripts without recording studios or voice talent. The API accepts text input and returns synthesized audio, enabling rapid production of module audio.
What is text-to-speech?
TTS is a cloud API that processes text and returns an audio file. You send a POST request with your script, and the system generates the audio using licensed voice presets. This eliminates the need for recording equipment or scheduling voice actors.
Benefits for course creators
Using TTS ensures consistent narration across all modules. You can update scripts and regenerate audio instantly without re-recording. It supports 23 languages, allowing you to localize courses efficiently. The API handles the heavy lifting, letting you focus on content structure.
- Consistent voice tone across all lessons
- Instant updates when scripts change
- Support for 23 languages
- No need for recording equipment
Synthetic vs human voices
Generated audio uses voices based on licensed recordings from LibriVox. Each file includes an inaudible watermark marking it as synthetic. While not human-recorded, the voices sound natural and are optimized for instructional clarity, avoiding the need for professional voice talent.
Choosing the right voice
Selecting the correct voice preset ensures your course audio matches the intended learning tone. Each preset is optimized for specific narration styles, allowing you to maintain consistency across modules without hiring voice talent.
Sage for instructional content
Sage provides a calm, instructional tone ideal for explaining complex concepts or guiding students through step-by-step tutorials. Its clear enunciation reduces cognitive load, making it suitable for dense educational material.
- Best for: Theory modules, definitions, procedural guides
- Voice type: Female, calm
Milo for conversational lessons
Milo offers a friendly, conversational style that mimics a human instructor speaking directly to the student. This preset works well for engaging introductions, Q&A sections, or informal lesson breaks.
- Best for: Introductions, reviews, casual explanations
- Voice type: Male, friendly
Atlas for news-style updates
Atlas delivers a neutral, news-style narration perfect for delivering course updates, announcements, or factual recaps. Its consistent, professional tone ensures clarity without introducing emotional bias into the content.
- Best for: Announcements, factual updates, summaries
- Voice type: Male, neutral
Preparing your course text
Course scripts often contain stage directions, pauses, or informal notes that sound awkward when spoken. Clean your text by removing these markers and ensuring sentences are complete. This reduces processing time and improves the natural flow of the generated narration.
Long paragraphs can cause the TTS engine to produce lengthy, uninterrupted audio segments that may lose listener attention. Break dense text into shorter, digestible chunks. This also helps in managing character limits and allows for easier editing later in your LMS.
Clean up script text
Remove directional cues like [pause] or [smile] unless you plan to handle them manually. Ensure consistent punctuation to help the engine parse sentence boundaries correctly. Plain text works best; avoid complex formatting that might interfere with character counting.
- Remove bracketed stage directions
- Standardize punctuation marks
- Use plain text format
Split long paragraphs
Divide text into logical units, ideally under 1000 characters per segment. This ensures consistent audio quality and makes it easier to insert silence or music between sections. Shorter segments also reduce the risk of hitting the 4096-character limit per request.
Check character limits
The API accepts up to 4096 characters per request. Spaces and punctuation count toward this limit. Verify your script length before sending it to avoid truncation errors. For longer lessons, split the text and join the resulting audio files.
- Limit: 4096 characters per request
- Count spaces and punctuation
- Split if exceeding limit
Making the API request
The TTS API uses a standard JSON POST request to https://api.mxgana.info/v1/audio/speech. You send your course script as text and receive a binary audio file. This direct response ensures low latency for your integration workflow. Generation takes roughly real time (about 25 characters per second of audio); short phrases take a few seconds.
Structure the JSON body
Send a POST request with a JSON body containing model, input, voice, and response_format. The model can be tts-1 or tts-1-hd. The input field holds your text, limited to 4096 characters. For longer scripts, split the text into parts and join the resulting audio files.
- Use
tts-1ortts-1-hdfor the model - Limit
inputto 4096 characters per request - Set
response_formatto mp3, wav, opus, flac, or pcm
Include your API key
Authenticate each request using the Authorization: Bearer header with your unique API key. Retrieve your key from the /get-api-key/ dashboard. If you rotate your key, the old one stops immediately.
Select voice and format
Choose from eight presets like sage for instructional content or milos for conversational lessons. Select your preferred audio format, such as MP3 for web players or WAV for high fidelity. You can also adjust the speed parameter between 0.25 and 4.0 to match your pacing needs.
Handling the response
The API returns the audio file directly in the response body, eliminating the need for polling or secondary downloads. You receive the binary data immediately, allowing your application to write the file to your local storage or cloud bucket in a single step. This direct stream ensures low latency for your integration workflow.
Once the file is saved, you can immediately proceed to verification and storage. The response includes standard HTTP headers that confirm the content type, ensuring your script handles the binary data correctly without corruption or encoding issues during the transfer process.
Download the audio file
The API response contains the audio binary directly. Your script should read the response body and write it to a file using the specified response_format. No additional endpoint calls are required to retrieve the audio; it is delivered in the same request that generated it.
Ensure your code handles the binary data correctly. The file size depends on the text length and format. For example, a 1000-character lesson in MP3 will be significantly smaller than the same text in WAV, affecting your storage requirements and upload times.
- Write the response body directly to a file.
- No secondary download endpoint is needed.
- Binary data is returned immediately upon success.
Verify audio quality
Play the generated file locally to check for clarity and pacing. Since the engine generates audio in real-time, short phrases may take a few seconds to complete, but the output is complete and ready for use. Check that the voice matches your expectations and that no truncation occurred.
The audio file contains an inaudible watermark marking it as synthetic speech. This does not affect playback quality but serves as a marker for content authenticity. If the audio sounds incorrect, check your speed parameter and voice selection in the request.
- Check for truncation or cut-off audio.
- Verify voice tone matches the script.
- Inaudible watermark is present in all files.
Upload to your LMS
Once verified, upload the audio file to your Learning Management System (LMS) or hosting platform. Most LMS platforms accept standard audio formats like MP3 or WAV. Ensure the file name is consistent with your course module structure for easy retrieval by students.
Some LMS platforms may have file size limits. If your audio file is large due to high quality or long duration, consider using MP3 for better compression. The API supports MP3, WAV, OPUS, FLAC, and PCM, so choose the format that best fits your LMS constraints.
- Upload MP3 or WAV files to your LMS.
- Ensure file names match course modules.
- Check LMS file size limits if applicable.
Multi-language courses
CourseVoice supports 23 languages, allowing you to localize content without hiring separate voice talent. Every voice can speak any supported language, ensuring consistent audio quality across your entire curriculum.
Use the language parameter in your API request to explicitly define the target language. This prevents misinterpretation and ensures accurate pronunciation for each module.
Set the language code
Always provide the ISO language code (e.g., es for Spanish, fr for French) in the request body. This guarantees the engine selects the correct phonetic rules.
If omitted, the system guesses the language based on the script. Latin text defaults to English, so non-English Latin-script text requires explicit language setting.
- Use ISO 639-1 codes.
- Explicitly set
languagefor non-English Latin text. - All 8 voices support all 23 languages.
Supported 23 languages
The API supports Arabic, Chinese, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Russian, Spanish, Swahili, Swedish, and Turkish.
Voices like Sage or Milo adapt naturally to these languages, maintaining their specific tonal characteristics regardless of the spoken language.
- Arabic, Chinese, Danish, Dutch, English, Finnish, French, German
- Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian
- Polish, Portuguese, Russian, Spanish, Swahili, Swedish, Turkish
Auto-detection limits
Auto-detection works for script-based guesses but may fail for mixed scripts or less common languages not in the supported list.
Unsupported languages include Vietnamese, Indonesian, Thai, Ukrainian, Romanian, Czech, and Bengali. Explicit language codes are not required for these if the script is clear, but results may vary.
- Latin text defaults to English.
- Non-English Latin text needs explicit language code.
- Vietnamese, Indonesian, Thai, Ukrainian, Romanian, Czech, Bengali not supported.

Optimizing character usage
Characters determine your billing, so optimizing input text directly reduces costs. Since every character—including spaces and punctuation—counts toward the 4,096-character limit per request, trimming excess whitespace and unnecessary symbols ensures you maximize the audio generated per transaction.
Consistent character management prevents mid-sentence cuts during audio synthesis. By refining your script structure before sending it to the API, you maintain narrative flow without exceeding limits or incurring unnecessary charges for redundant data.
Remove unnecessary punctuation
Eliminate redundant commas, exclamation marks, and decorative symbols that do not affect vocal pacing. Standard punctuation is sufficient for natural intonation; extra marks just increase the character count without improving audio quality.
- Replace multiple spaces with single spaces
- Remove decorative symbols like asterisks or tildes
- Keep standard periods and commas for basic pacing
Use concise phrasing
Shorten sentences where possible without losing meaning. Concise phrasing reduces the total character count, allowing more content per API call and lowering the cost per module.
- Avoid verbose introductory phrases
- Use active voice for brevity
- Remove filler words like "very" or "really"
Monitor character count
Track character usage during script preparation to stay within the 4,096-character limit. This prevents request failures and ensures your audio generation remains efficient and cost-effective.
- Count characters including spaces
- Split text into segments if over 4096 characters
- Use the API dashboard to track usage
Common integration errors
Integration issues usually stem from simple misconfigurations. Verify your inputs match the API’s strict requirements before sending requests to avoid wasted credits or silent failures.
Most errors are preventable with careful attention to the documentation. Ensure your script formatting aligns with the technical constraints of the speech engine.
Invalid voice name
The API expects one of the eight specific presets. Using a typo or an unsupported name can cause a 400 error. Always reference the exact string from the /v1/voices endpoint.
- Check spelling against /v1/voices output
- Use exact case sensitivity
Text too long
Each request accepts a maximum of 4096 characters. Sending a longer string will fail immediately. You must split your course script into chunks and join the resulting audio files manually.
- Limit input to 4096 characters
- Split long scripts manually
Missing authentication
The request must include a valid Bearer token. If the key is missing, expired, or incorrect, the API returns a 401 Unauthorized error. Ensure your header is formatted as Authorization: Bearer tts-....
- Include Bearer token in header
- Verify key validity
Testing your workflow
Start by creating an account via /get-api-key/ to receive $0.50 in free trial credit, valid for 7 days. This allows you to generate approximately 50,000 characters without payment. Use this credit to verify your API key works with your LMS integration.
Use the free trial
Sign in with Google to automatically receive the trial balance. No credit card is required, making it low-risk to test the endpoint POST https://api.mxgana.info/v1/audio/speech. The trial covers standard requests, letting you validate your setup before committing to top-ups via USDT.
- Valid for 7 days after sign-in
- Approximately 50,000 characters of credit
- No credit card required for Google sign-in
Generate a short lesson
Send a simple text payload using the OpenAI SDK or a curl request. Choose a voice like Sage for instructional clarity. Ensure your text is under 4,096 characters to avoid splitting logic during this initial test. Check the response status to confirm successful synthesis.
- Use 'tts-1' or 'tts-1-hd' model
- Keep input text under 4,096 characters
- Select a voice preset like Sage
Play audio in player
Download the returned audio file in your chosen format, such as MP3 or WAV. Verify the audio plays correctly in your standard media player. Listen for clarity and check that the synthetic watermark is present but inaudible. This confirms the end-to-end workflow is ready for production.
- Verify audio clarity and playback
- Check for inaudible synthetic watermark
- Confirm format matches API request
Scaling your content
Scaling your content allows you to convert entire course libraries without manual intervention. By batching requests, you process multiple modules efficiently, ensuring consistent narration across all lessons. This approach is essential for no-code creators managing large catalogs of e-learning material.
Automation reduces the time spent on audio generation, letting you focus on course design. You can trigger conversions programmatically, maintaining a steady workflow as your content library grows.
Batch process modules
Group related lessons into single API calls where possible, or process them sequentially. Since requests are handled one after another, batching helps manage the 60 requests per minute limit without exceeding quotas.
Split long scripts into 4096-character chunks to ensure complete audio generation. Join the resulting files to create seamless module audio.
- Process modules in parallel if using multiple keys.
- Split text at logical sentence boundaries for clean audio cuts.
Automate with scripts
Use the OpenAI SDK or plain HTTP to send requests. Change the base_url to https://api.mxgana.info/v1 and inject your API key. Scripts can loop through your course text files and save the resulting audio files automatically.
This method eliminates manual uploads and reduces human error in file naming or format selection.
- Use Python or Node.js scripts for bulk generation.
- Store generated audio in your LMS media library automatically.
Monitor usage stats
Track your balance and character consumption via the dashboard. Since pricing is $0.01 per 1,000 characters, monitoring usage helps you predict costs for new course modules.
Check the GET /v1/voices endpoint to ensure you are using the correct voice presets for each module type.
- Watch for rate limit hits (60 requests/min).
- Review billing logs for any failed, free requests.
image":
Audio quality considerations
Selecting the right output format and speed ensures your course audio matches your learners' devices and retention preferences. The API supports MP3, WAV, OPUS, FLAC, and PCM, allowing you to balance file size against quality needs.
MP3 vs WAV trade-offs
MP3 files are smaller and ideal for web delivery, reducing bandwidth costs for large course libraries. WAV offers uncompressed quality but results in significantly larger files, which may slow down LMS uploads.
Speed adjustments
Adjust the speed parameter between 0.25 and 4.0 to fit your teaching pace. Faster speeds work well for quick updates, while slower rates improve clarity for complex instructional material.
Watermark presence
Every generated audio file contains an inaudible watermark identifying it as synthetic speech. This metadata is embedded directly into the audio stream and does not affect playback quality or listener experience.
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.
23 languages
Any voice speaks any of these languages.
Sources and further reading
- Wikipedia
- openai-node on GitHub
- LibriTTS-R paper (arXiv 2305.18802)
- LibriVox public-domain audiobooks
- W3C WAI: making audio and video accessible
- Node.js documentation
- FFmpeg documentation
- OpenAI API reference: create speech
- Creative Commons Attribution 4.0
- TRON developer hub: TRC-20
- ISO 639 language codes
- Python documentation
