Developer documentation
Generate a hosted speech audio asset
Request fields, payment behavior, response details, and errors for /v1/audio/speech.
Page tools
Generate a hosted speech audio asset
POST /v1/audio/speech
Operation ID: createSpeech. The canonical machine-readable schema is OpenAPI.
Request body
The public endpoint uses elevenlabs/flash-v2.5 and returns MP3 audio. Choose a public voice alias from GET /v1/audio/voices; omission uses the model's Darian default. The live catalog and HTTP 402 response remain authoritative.
{
"model": "elevenlabs/flash-v2.5",
"input": "Your text to speak.",
"voice": "darian",
"response_format": "mp3",
"speed": 1
}Payment lifecycle
The first request returns Hypertext Transfer Protocol (HTTP) status 402 without calling the model provider. Check the Base network, United States Dollar Coin (USDC) contract, payment recipient, expiry time, exact scheme, EIP-712 domain, and amount. Sign locally with an official x402 client, then retry the identical effective request with the same idempotency key.
After success, read the PAYMENT-RESPONSE, X-Request-ID, X-Receipt-ID, and X-Catalog-Version headers together with the receipt link. The response is released only after the result, payment, and receipt are safely stored.
Read the response
Read the generated MP3 from data[0].url. The URL is a bearer capability: keep it out of logs and public messages, download it promptly, and treat data[0].expires_at as its exact 24-hour access deadline. The JSON response also reports the validated format, content type, duration, and exact input-character count in usage.input_characters.
Responses
- 200: Durably settled response with X-Receipt-ID and PAYMENT-RESPONSE headers
- 400: Invalid or unsupported request
- 402: Payment required. The PAYMENT-REQUIRED header is authoritative and contains the official x402 challenge. Empty, structurally incomplete, or syntactically malformed unsigned JSON receives an inspection challenge; a complete semantic error returns 400/415. Submit a valid body to receive its fixed request price before signing.
- 409: Idempotency key reused with a different effective request
- 415: Unsupported request content type. This fails before a payment challenge or verification.
- 503: Provider, payment, or safety dependency unavailable
