Text-to-speech (OpenAI-compatible)
POST /v1/audio/speechOpenAI-compatible text-to-speech over x402 — point any OpenAI SDK's audio.speech.create() at base_url https://agent402.tools/v1 and pay $0.06 per call in USDC, no API key, no signup. Served by Voxtral Mini TTS behind a five-model failover chain (xAI Grok Voice, Kokoro, Zonos, MAI-Voice-2), every link proven by a real paid canary — a provider outage never becomes your failure. Up to 2,000 chars in, raw mp3 (default) or pcm bytes out — the same wire shape as OpenAI's endpoint. OpenAI voice names (alloy, nova, …) map per-model; native voice ids (e.g. en_paul_cheerful) work too. zdr:true routes only to zero-data-retention providers.
Input
| Field | Type | Description |
|---|---|---|
input * | string | Text to speak (up to 2,000 chars) |
voice | string | OpenAI voice name — alloy (default), ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse — or a native voice id from GET /v1/models (e.g. en_paul_cheerful) |
response_format | string | "mp3" (default) or "pcm" |
model | string | Optional — pin a chain model (e.g. mistralai/voxtral-mini-tts-2603); the rest stay as fallbacks |
speed | number | Optional 0.25–4 playback speed (providers that don't support it ignore it) |
zdr | boolean | Optional — true routes only to zero-data-retention providers |
Example output
"(raw mp3 bytes — Content-Type: audio/mpeg)"
Try it — see the 402 challenge (free)
curl -i -X POST https://agent402.tools/v1/audio/speech \
-H "Content-Type: application/json" \
-d '{"input":"Agent402 serves fourteen hundred tools, paid per call.","voice":"alloy"}'
The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/v1/audio/speech", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"input": "Agent402 serves fourteen hundred tools, paid per call.",
"voice": "alloy"
}),
});
Related tools
Chat completions — nano tier
POST /v1/nano/chat/completionsOpenAI-compatible chat completions, nano tier: gpt-4.1-nano, gpt-5-nano, gemini flash-lite, small llama/ministral/qwen, …
Chat completions — auto tier (eval-ranked routing)
POST /v1/auto/chat/completionsOpenAI-compatible chat completions with server-side model choice: omit "model" (or send "auto") and the gateway routes t…
Chat completions (OpenAI-compatible)
POST /v1/chat/completionsOpenAI-compatible chat completions over x402 — point any OpenAI SDK at base_url https://agent402.tools/v1 and pay per ca…