Text to speech (WAV)
text_to_speech[PAID $0.005 USDC per call via x402 on Base; errors are free] Turn text (up to 2000 chars) into spoken audio with MeloTTS on Cloudflare Workers AI, in English, Spanish, French, Chinese, Japanese or Korean. Returns JSON with audio_base64 + mimeType (audio/wav, 44.1 kHz mono), or the raw audio bytes with format=wav. Good for voice replies, narration, accessibility and language practice. Text with sexual, hateful or violent content is refused (HTTP 400, not charged). All params optional: with none it speaks a short English sample. GET with query params or POST a JSON body.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lang | No | Language of the text / voice (default en). | |
| text | No | Text to speak (max 2000 chars). Optional: defaults to a short English sample. |