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.
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-10-28 wallet-recovery snapshot records four recoverable buyers for
text-to-speech. Three had bought in more than one active week. The cohort
made 45 calls and spent 2.25 USDC, so this page keeps the next paid pass tied
to the same voice settings rather than asking the agent to rebuild its setup.