Text-to-Speech
Convert text to natural speech with various voices and speed options.
Text-to-Speech (TTS)
Convert text to high-quality speech using various voices and speed options.
Basic TTS Generation
curl -X POST https://api.mondialspeech.com/api/v1/media/tts \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"text":"Hello from MondialSpeech!","voiceId":"<VOICE_GUID>","speed":"Fast"}' \
-o output.mp3Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to convert to speech |
voiceId | string | Yes | Voice identifier (GUID) |
speed | string | No | Speech speed: Fast (default), Normal, Slow |
Speed Options
- Fast: Default speed for quick generation
- Normal: Standard speech pace
- Slow: Slower pace for clarity
Cost Estimation
curl -X GET "https://api.mondialspeech.com/api/v1/media/estimate/tts?text=Hello%20world" \
-H "Authorization: Bearer <ACCESS_TOKEN>"Response
The API returns the generated audio file as MP3 format.
Error Handling
402 Payment Required (Insufficient Tokens)
{ "error": "Insufficient tokens", "tokens_needed": 1234 }402 Payment Required (Plan Limit Reached)
{
"error": "Plan limit reached",
"tokens_needed": 5000,
"monthly_limit": 200000,
"used_this_month": 198000
}Best Practices
- Estimate costs before generating long texts
- Use appropriate speed for your use case
- Choose suitable voices for your content
- Monitor token usage regularly
