Text-to-speech (lite)

$0.005 per call · USDC via x402 · POST /api/tts-lite

Convert text to speech with Kokoro-82M, a fraction of the price of /api/tts. Send POST /api/tts-lite with the required field text and pay $0.005 per call over x402 or MPP (there is no free tier). It returns a JSON object with model, provider, voice, format, audio and 1 more.

Returns base64-encoded mp3 or pcm. The same request shape and the same ten voice names as /api/tts, mapped to Kokoro's own voices; the voice is synthetic-sounding where the ElevenLabs tiers are not, which is the whole trade. Use this for high-volume narration, notifications and agent speech where the cost per call matters more than the timbre; use /api/tts or /api/tts-hd when it does not. No API key needed; pay per call via x402. Text capped at 800 chars.

Category: AI & compute · Tags: tts text-to-speech audio voice speech kokoro cheap lite · Also found as: cheap-tts tts-cheap speech-lite

TRY IN PLAYGROUND →

Parameters

NameTypeRequiredDescription
textstringyesText to convert to speech (max 800 chars) Also accepted as content, str, string, input, body, data.
voicestringnoVoice: alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer (default: alloy) - mapped to the nearest Kokoro voice, which is named back in the response
formatstringnoAudio format: mp3 or pcm (default: mp3). The other formats are on /api/tts

Example request

curl -i -X POST https://agent402.tools/api/tts-lite \
  -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-lite; any x402 v2 or MPP client pays it and retries.

Example response

{
  "model": "hexgrad/kokoro-82m",
  "provider": "openrouter",
  "voice": "af_alloy",
  "format": "mp3",
  "audio": "<base64-encoded audio>",
  "chars": 20
}
FieldTypeAlways presentIn the example
modelstringyeshexgrad/kokoro-82m
providerstringyesopenrouter
voicestringyesaf_alloy
formatstringyesmp3
audiostringyes<base64-encoded audio>
charsnumberyes20

From an MCP client

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

The hosted connector at https://agent402.tools/mcp needs a payment for tts-lite; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.

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?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

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

Related tools

Text-to-speech

$0.120 · POST /api/tts

Convert text to speech with ElevenLabs Eleven v4 Turbo: returns audio (the base64-encoded file in the format asked for: …

Text-to-speech (HD)

$0.240 · POST /api/tts-hd

Convert text to speech with ElevenLabs Eleven v4, its most expressive model (inline audio tags such as [whispering] are …

Text-to-speech (OpenAI-compatible)

$0.060 · POST /v1/audio/speech

OpenAI-compatible text-to-speech over x402 - point any OpenAI SDK's audio.speech.create() at base_url https://agent402.t…

Speech-to-text

$0.030 · POST /api/transcribe

Transcribe audio to text using OpenAI (gpt-transcribe). Provide a URL to an audio file (mp3, wav, m4a, etc.) and get bac…

Speech-to-text (Pro)

$0.100 · POST /api/transcribe-pro

Transcribe audio to text using OpenAI (gpt-transcribe) - the same model as /api/transcribe with a longer cap. Provide a …

Speech-to-text (OpenAI transcription wire)

$0.030 · POST /v1/audio/transcriptions

OpenAI's own transcription wire: POST multipart/form-data with a `file` part and get the transcript back. Point any Whis…