Text to speech

Returns JSON with your text read aloud as WAV audio (base64, 44.1 kHz mono) by MeloTTS on Workers AI, in English, Spanish, French, Chinese, Japanese or Korean.

Use this when you need text to speech, a voice audio file or narration of a short text.

Do not use for voice cloning, a chosen voice, SSML or audio longer than about two minutes.

Price: 0.023 USDC per call (x402, eip155:8453). Typical response time: 8000 ms (p95).

Call it over HTTP (x402)

POST https://x402-gateway.blackwoodstate8.workers.dev/v1/text-to-speech. A request without payment gets 402 Payment Required with the PAYMENT-REQUIRED header; any x402 client signs an EIP-3009 authorization and retries with PAYMENT-SIGNATURE (or X-PAYMENT). Invalid input is answered with 400 and not charged.

curl -i -X POST https://x402-gateway.blackwoodstate8.workers.dev/v1/text-to-speech -H 'content-type: application/json' -d '{"text":"Hello from Blackwood State. This audio was generated on demand.","lang":"en"}'
Pay to0xe46a85E0cb068A80Dd2E4553046ddCFe3FAc9650
Asset0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (USDC)
Amount23000 atomic units (0.023 USDC)
Authorization window60 s

Call it over MCP

Streamable HTTP at https://x402-gateway.blackwoodstate8.workers.dev/mcp, tool blackwood_speech_synthesize. Payment goes in _meta["x402/payment"]; without it the tool returns the payment requirements.

Input

FieldTypeMeaning
textstringText to read aloud, e.g. Welcome to our store (up to 1000 characters)
lang (optional)stringSpeech language: en (default), es, fr, zh, ja or ko

Example:

{
  "text": "Hello from Blackwood State. This audio was generated on demand.",
  "lang": "en"
}

Output

Real example:

{
  "mimeType": "audio/wav",
  "audioBase64": "UklGRl5RBQBXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YTpRBQAAAAAA...(464692 characters)",
  "bytes": 348518,
  "lang": "en",
  "chars": 63,
  "model": "@cf/myshell-ai/melotts"
}
JSON Schema
{
  "type": "object",
  "properties": {
    "mimeType": {
      "type": "string",
      "enum": [
        "audio/wav",
        "audio/mpeg"
      ]
    },
    "audioBase64": {
      "type": "string"
    },
    "bytes": {
      "type": "number"
    },
    "lang": {
      "type": "string"
    },
    "chars": {
      "type": "number"
    },
    "model": {
      "type": "string"
    }
  },
  "required": [
    "mimeType",
    "audioBase64",
    "bytes",
    "lang",
    "chars",
    "model"
  ],
  "additionalProperties": false
}

More

Free schema and example: GET https://x402-gateway.blackwoodstate8.workers.dev/v1/text-to-speech. OpenAPI 3.1 · llms.txt · All services