MondialMondial AI Docs

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.mp3

Request Parameters

ParameterTypeRequiredDescription
textstringYesText to convert to speech
voiceIdstringYesVoice identifier (GUID)
speedstringNoSpeech 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

  1. Estimate costs before generating long texts
  2. Use appropriate speed for your use case
  3. Choose suitable voices for your content
  4. Monitor token usage regularly