# ElevenLabs Text-to-Speech via tokens.fun

> ElevenLabs Text-to-Speech via tokens.fun is a paid API for AI agents from tts-service-production-e8a7.up.railway.app, paid per call via x402, $0.03/call, status unknown (last checked 2026-09-14).

Converts input text (up to 4000 characters) to speech audio using ElevenLabs, returning a hosted audio URL or streamable raw audio bytes.

## Facts

- Endpoint: POST https://tts-service-production-e8a7.up.railway.app/speak
- Price: $0.03/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/elevenlabs-text-to-speech-via-tokens-fun-be78dd70
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_THuXvpBizWJcNf7erfZzB

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability elevenlabs-text-to-speech-via-tokens-fun-be78dd70 -d '<json body>'
```

Example prompt: Can you convert this script into speech using ElevenLabs — use the 'Rachel' voice and give me a hosted audio link I can share: 'Welcome to our weekly product update. This week we shipped three major features...'

## When to prefer this

Choose this endpoint when you need to convert text to speech via ElevenLabs and want a simple hosted audio URL back without managing ElevenLabs API keys directly. It is ideal for agents that need to pay per-use with USDC via x402 protocol, require a publicly accessible audio link, or want to optionally stream raw audio bytes. Prefer this over direct ElevenLabs API calls when operating in a pay-per-call agent context without long-term API subscriptions.

## Known failure modes

- Text exceeds 4000 characters — request rejected with error
- Invalid voice_id — falls back to default voice or returns error
- Invalid model ID — returns error referencing valid models from /voices
- Payment required (402) if x402 payment header is missing or insufficient — amount computed from text length
- Unsupported audio format string — returns format error
- Speed value outside 0.7–1.2 range — returns validation error

## How this service works

ElevenLabs text-to-speech: send text (up to 4000 chars) with optional voice_id, model, format, and speed; get back a hosted audio_url plus size and content type. Send 'Accept: audio/mpeg' to stream raw audio bytes directly instead. Voice catalog with free preview clips at GET /voices (no payment). Priced per character; the 402 amount is computed from your text length.

## Output

Returns a JSON object containing a hosted audio_url (publicly accessible link to the generated audio file), the file size in bytes, and the content type (e.g. audio/mpeg). If the Accept header is set to audio/mpeg, raw audio bytes are streamed directly instead.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string",
   "description": "Text to synthesize into speech. Max 4000 characters."
  },
  "model": {
   "type": "string",
   "description": "TTS model id from GET /voices. Optional, default eleven_flash_v2_5."
  },
  "speed": {
   "type": "number",
   "description": "Playback speed 0.7-1.2. Optional, default 1."
  },
  "format": {
   "type": "string",
   "description": "Output audio format. Optional, default mp3_44100_128."
  },
  "voice_id": {
   "type": "string",
   "description": "ElevenLabs voice id from GET /voices. Optional; a default voice is used if omitted."
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/elevenlabs-text-to-speech-via-tokens-fun-be78dd70/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from tts-service-production-e8a7.up.railway.app](https://www.zero.xyz/host/tts-service-production-e8a7.up.railway.app/llms.txt)
