Text-to-Speech
Payment wires: every paid endpoint accepts x402 and MPP (Machine Payments Protocol) on the same 402 - see Paying with x402 and Paying with MPP. Agent402 is the applied layer of Agentic Finance: agents that pay and get paid on their own.
Acceptable use. Hosted-instance traffic is governed by the Terms of Service - including a generative-content acceptable-use policy - and by the upstream model providers' usage policies. Wallets used for prohibited content are blocked before settlement. Outputs are generated by third-party models from your inputs; you are responsible for how you use them.
Three tiers of text-to-speech, paywalled via x402. Send text, get back base64-encoded audio. The same request shape and the same 10 voice names on every tier. The operator's OPENAI_API_KEY handles the two OpenAI tiers; the lite tier runs on OPENROUTER_API_KEY.
Tiers
| Endpoint | Price | Model | Quality | Formats | Text cap |
|---|---|---|---|---|---|
POST /api/tts-lite |
$0.005 | hexgrad/kokoro-82m |
Synthetic-sounding, ten times cheaper | mp3, pcm | 2,000 chars |
POST /api/tts |
$0.05 | tts-1 |
Standard (fast) | all six | 2,000 chars |
POST /api/tts-hd |
$0.10 | tts-1-hd |
HD (higher fidelity) | all six | 2,000 chars |
Which to use. The lite tier is for high-volume narration, notifications and agent speech, where the cost per call matters more than the timbre; the voice is audibly synthetic next to the OpenAI tiers, which is the trade. It takes the same ten voice names and maps each to the nearest Kokoro voice, naming the one that spoke in the response. Ask for a format it cannot serve and you get a 400 pointing at /api/tts, never a silent downgrade.
All three tiers are wallet-only - every call burns real upstream TTS credit. See Security Model.
Voices
alloy (default), ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer
Output formats
mp3 (default), opus, aac, flac, wav, pcm
Request / Response
// Request
{ "text": "Hello from Agent402!", "voice": "alloy", "format": "mp3" }
// Response
{ "model": "tts-1", "provider": "openai", "voice": "alloy", "format": "mp3",
"audio": "<base64-encoded audio>", "chars": 20 }
Only text is required. voice defaults to alloy, format defaults to mp3.
See also
- Speech-to-Text - the reverse: audio to text
- LLM Proxy Gateway - text inference
- Paying with x402 - the USDC payment flow