Text-to-speech (HD)

quoted per request from $0.01USDC via x402POST /api/tts-hd

Convert text to speech with the eleven-v4 model, priced per request from the length of the text. Send POST /api/tts-hd with the required field text and pay quoted per request from $0.01 over x402 or MPP (there is no free tier). It returns a JSON object with model, provider, voice, format, audio and 1 more.

It is the most expressive speech tier, and the quote is $0.010 plus $0.115 per 1,000 characters of text, rounded up to the next $0.001 (2,000 characters: $0.240). Inline audio tags such as [whispering] are read as delivery cues. Returns base64-encoded audio. Same interface, voices, formats and backups as /api/tts. No API key needed; pay per call via x402 or MPP. Text capped at 2000 chars. Model-backed.

Category: AI & computeTags: tts text-to-speech audio voice speech eleven-v4 hd

Try in playground →

Parameters

NameTypeRequiredDescription
textstringyesText to convert to speech (max 2000 chars) Also accepted as content, str, string, input, body, data.
voicestringnoVoice: alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer (default: alloy), each mapped to its own voice, or a named voice (george, sarah, adam, alice, bella, bill, brian, callum, charlie, chris, daniel, eric, harry, jessica, laura, liam, lily, matilda, river, roger, will)
formatstringnoAudio format: mp3, opus, aac, flac, wav, pcm (default: mp3)

Example request

curl -i -X POST https://agent402.tools/api/tts-hd \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello from Agent402!","voice":"alloy","format":"mp3"}'

Without payment this returns HTTP 402 Payment Required with the exact price for tts-hd; any x402 v2 or MPP client pays it and retries.

Example response

{
  "model": "elevenlabs/eleven-v4",
  "provider": "openrouter",
  "voice": "river",
  "format": "mp3",
  "audio": "<base64-encoded audio>",
  "chars": 20
}
FieldTypeAlways presentIn the example
modelstringyeselevenlabs/eleven-v4
providerstringyesopenrouter
voicestringyesriver
formatstringyesmp3
audiostringyes<base64-encoded audio>
charsnumberyes20

From an MCP client

catalog.call {
  "slug": "tts-hd",
  "params": {
    "text": "Hello from Agent402!",
    "voice": "alloy",
    "format": "mp3"
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for tts-hd; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y [email protected].

Errors and behavior

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();
client.setSpendControls?.({ maxAmountPerPayment: "$0.24" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/tts-hd", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "text": "Hello from Agent402!",
    "voice": "alloy",
    "format": "mp3"
  }),
});

Related tools

Dub: translate and speak

from $0.14 · POST /api/dub

Translate a text into a target language and speak the translation, in one paid call.

Text-to-speech

from $0.005 · POST /api/tts

Convert text to speech with the eleven-v4-turbo model, priced per request from the length of the text.

Text-to-speech (lite)

$0.005 · POST /api/tts-lite

Convert text to speech with Kokoro-82M, a fraction of the price of /api/tts.

Text-to-speech (OpenAI-compatible)

$0.06 · POST /v1/audio/speech

OpenAI-compatible text-to-speech over x402 - point any OpenAI SDK's audio.speech.create() at base_url.

Image generation (HD)

$0.10 · POST /api/image-gen-hd

Generate a higher-quality image from a text prompt using GPT Image 2 (medium quality, 1024x1024).

Speech-to-text

$0.03 · POST /api/transcribe

Transcribe audio to text with the gpt-transcribe model.