The recurring job
An agent updates a script, keeps the same speaker, and needs a new hosted audio file. Save the voice, model, speed, and format with the script. Then each run changes only the text that needs a new narration.
text-to-speech returns a hosted audio_url along with the selected voice,
model, speed, content type, and file size. That gives the next run a stable
record of how the earlier audio was made.
curl -X POST https://x402.agentutility.ai/text-to-speech \
-H "Content-Type: application/json" \
-d '{"text":"This week, the release has one change.","voice":"af_sky","model":"tts-kokoro","speed":1,"format":"mp3"}'
The first response requests x402 payment. After payment, save the request and the returned JSON beside the source script.
Run the next narration from the CLI
Keep the voice settings in voice.json. Replace only the text value before
the next scheduled run. The CLI checks the listed price before it pays.
cat > voice.json <<'JSON'
{"text":"This week, the release has one change.","voice":"af_sky","model":"tts-kokoro","speed":1,"format":"mp3"}
JSON
agentutility price text-to-speech
agentutility call text-to-speech --data "$(cat voice.json)" --max-price 0.05 > narration.tmp && mv narration.tmp narration.json
narration.json records the exact voice settings and the hosted audio URL.
Keep it with the script revision so a later agent can produce the same style
of audio without guessing.
Treat the saved request as the retry key
Write the request body before paying, then keep the returned audio_url with
that exact body. If a later workflow step fails after synthesis, reuse the
saved URL. If the script changed, send the saved body with only text
changed. This keeps a retry from silently changing the speaker, speed, or
file format.
{
"script_revision": "2026-10-30",
"request": {
"text": "This week, the release has one change.",
"voice": "af_sky",
"model": "tts-kokoro",
"speed": 1,
"format": "mp3"
},
"audio_url": "https://..."
}
Choose the output by the next step
Use mp3 for a common player upload. Pick wav when the next stage needs an uncompressed file, or flac for lossless audio in a smaller file. The endpoint also accepts opus and aac when your delivery system already expects them.
The MCP version
The same route is available from the synthforge MCP server as text-to-speech.
Its inputs are text, voice, model, speed, and format; its response
contains the hosted audio URL and the settings used to create it.
{
"mcpServers": {
"agentutility-synthforge": {
"command": "npx",
"args": ["-y", "@agentutility/mcp-synthforge"],
"env": { "X402_PRIVATE_KEY": "0xYOUR_PRIVATE_KEY_HEX" }
}
}
}
Current recovery proof
The 2026-11-02 wallet-recovery snapshot records five recoverable buyers for
text-to-speech. Four bought in more than one active week. The cohort made 46
calls and spent 2.30 USDC. Keep the request body with the returned audio URL
so the next narration starts from the same voice settings.