Speak
Text to speech in one HTTP call: 15 voices, 31 languages, up to 10,000 characters a request. Your Mosaic API key works as is. On Pro and Teams (pricing).
Make speech
curl -X POST "https://speak.mosaic.site/v1/speak?voice=eve" \ -H "X-API-Key: $KEY" \ -d '{"text": "Hello! I can talk now."}' \ -o speech.wav
Speak lives at https://speak.mosaic.site. Send the key as X-API-Key or as Authorization: Bearer.
Parameters
In the query string or the JSON body; the query string wins.
| Param | Default | Values |
|---|---|---|
| text | required | Up to 10,000 characters |
| voice | eve | See Voices below |
| lang | en | 31 ISO codes, or na for unknown or mixed |
| speed | 1.05 | 0.7 (slow) to 2.0 (fast) |
| quality | balanced | fast, balanced, high |
| format | wav | wav, pcm, mulaw |
| sample_rate | by format | 8000, 16000, 44100; 8000 for mulaw, 44100 otherwise |
| stream | false | true sends audio in chunks as each is ready |
Voices
- English —
eve,alba,anna,caro_davy,paul. Fixed speed: anyspeedother than1.05returns400 unsupported_for_voice. - All 31 languages —
F1toF5andM1toM5. Adjustable speed, and expression tags such as<laugh>and<sigh>inline in the text. - Without a
voice, you geteve, orF1when the request asks for another language or speed. A voice you name is never swapped. GET /v1/voiceslists the voices with samples;GET /v1/languageslists the language codes.
Phone audio
For phone greetings and voice agents, ask for 8 kHz μ-law with format=mulaw&sample_rate=8000:
curl -X POST "https://speak.mosaic.site/v1/speak?voice=eve&format=mulaw&sample_rate=8000" \ -H "X-API-Key: $KEY" \ -d '{"text": "Thanks for calling. How can I help?"}' \ -o greeting.ulaw
For a greeting saved to a file, leave stream off: you get a proper error status and the cache. Use stream=true only to play audio as it arrives. A stream can end early without an error, so treat an unexpectedly short one as a failure.
Limits and usage
- 10,000 characters a request and 60 requests a minute per account.
GET /v1/usagereturns{"requests", "characters"}for your account.
Errors
Errors return {"error": {"code": "...", "message": "..."}}.
| Code | What it means |
|---|---|
| missing_key, invalid_key | 401: no key, or the key isn't recognised |
| text_too_long | Over 10,000 characters |
| unsupported_for_voice | 400: an English voice with another language or speed; use an F or M voice |
| rate_limited | 429: over 60 requests a minute; back off |
| model_loading | 503: the service just restarted; retry in about 30 seconds |
| platform_unavailable | 503: Mosaic is briefly unavailable; retry shortly |
Endpoints
On https://speak.mosaic.site:
| Endpoint | Method | Description |
|---|---|---|
| /v1/speak | POST | Text in, audio out |
| /v1/voices | GET | Voices, with sample URLs |
| /v1/languages | GET | Language codes |
| /v1/usage | GET | Requests and characters for your account |