# Elevenlabs Voice

> ElevenLabs Voice AI - Ultra-low latency TTS with Flash v2.5 (~75ms) and AI Sound Effects generation. Use for voice synthesis, audio generation, conversational AI backends, and sound design.

- Skill: `shakudo-io/elevenlabs-voice` (Agent Skill)
- Install (CLI): `npx skillmds@latest add shakudo-io/elevenlabs-voice`
- Raw SKILL.md: https://api.skillmd.com/api/skills/shakudo-io/elevenlabs-voice/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: Shakudo-io (https://skillmd.com/u/shakudo-io)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/shakudo-io/elevenlabs-voice

---


# ElevenLabs Voice AI Skill

Ultra-low latency text-to-speech and AI sound effects generation via ElevenLabs API.

## Capabilities

| Feature | Model | Latency | Use Case |
|---------|-------|---------|----------|
| **Flash v2.5 TTS** | `eleven_flash_v2_5` | ~75ms | Real-time conversations, Twilio integration |
| **Multilingual v2 TTS** | `eleven_multilingual_v2` | ~150ms | High-quality narration, 29 languages |
| **Sound Effects** | `eleven_text_to_sound_v2` | Variable | Sound design, game audio, notifications |

## Authentication

All requests require the `xi-api-key` header:

```bash
export ELEVENLABS_API_KEY="your-api-key"
```

## Flash v2.5 Text-to-Speech (Streaming)

**Endpoint**: `POST https://api.elevenlabs.io/v1/text-to-speech/{voice_id}/stream`

Best for real-time applications with ~75ms latency.

### Basic Usage

```bash
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM/stream" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello! How can I help you today?",
    "model_id": "eleven_flash_v2_5",
    "voice_settings": {
      "stability": 0.5,
      "similarity_boost": 0.75
    }
  }' \
  --output speech.mp3
```

### With Output Format Options

```bash
# MP3 (default, best compatibility)
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM/stream?output_format=mp3_44100_128" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "This is high quality MP3 audio.",
    "model_id": "eleven_flash_v2_5"
  }' \
  --output speech.mp3

# PCM (raw audio for real-time processing)
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM/stream?output_format=pcm_24000" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Raw PCM for Twilio streaming.",
    "model_id": "eleven_flash_v2_5"
  }' \
  --output speech.pcm

# μ-law (for telephony/Twilio)
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM/stream?output_format=ulaw_8000" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Optimized for phone calls.",
    "model_id": "eleven_flash_v2_5"
  }' \
  --output speech.ulaw
```

### Request Body Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `text` | string | Yes | Text to convert (max 5000 chars) |
| `model_id` | string | Yes | `eleven_flash_v2_5` for low latency |
| `voice_settings.stability` | float | No | 0.0-1.0, higher = more consistent |
| `voice_settings.similarity_boost` | float | No | 0.0-1.0, higher = closer to original voice |
| `voice_settings.style` | float | No | 0.0-1.0, style exaggeration |
| `voice_settings.use_speaker_boost` | bool | No | Enhance speaker similarity |

### Output Formats

| Format | Query Param | Sample Rate | Use Case |
|--------|-------------|-------------|----------|
| MP3 High | `mp3_44100_128` | 44.1kHz | General purpose |
| MP3 Medium | `mp3_22050_32` | 22.05kHz | Smaller files |
| PCM | `pcm_24000` | 24kHz | Real-time streaming |
| PCM 16-bit | `pcm_16000` | 16kHz | Voice assistants |
| μ-law | `ulaw_8000` | 8kHz | Telephony/Twilio |

## Popular Voice IDs

| Voice | ID | Style |
|-------|-----|-------|
| Rachel | `21m00Tcm4TlvDq8ikWAM` | Calm, young female |
| Domi | `AZnzlk1XvdvUeBnXmlld` | Strong, young female |
| Bella | `EXAVITQu4vr4xnSDxMaL` | Soft, young female |
| Antoni | `ErXwobaYiN019PkySvjV` | Well-rounded male |
| Elli | `MF3mGyEYCl7XYWbV9V6O` | Emotional young female |
| Josh | `TxGEqnHWrfWFTfGW9XjX` | Deep, young male |
| Arnold | `VR6AewLTigWG4xSOukaG` | Crisp, middle-aged male |
| Adam | `pNInz6obpgDQGcFmaJgB` | Deep, middle-aged male |
| Sam | `yoZ06aMxZJJ28mfd3POQ` | Raspy, young male |

## List All Voices

```bash
curl -X GET "https://api.elevenlabs.io/v1/voices" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" | jq '.voices[] | {name, voice_id}'
```

## AI Sound Effects Generation

**Endpoint**: `POST https://api.elevenlabs.io/v1/sound-generation`

Generate sound effects from text descriptions.

### Basic Usage

```bash
curl -X POST "https://api.elevenlabs.io/v1/sound-generation" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "A thunderstorm with heavy rain and distant thunder",
    "duration_seconds": 10
  }' \
  --output thunder.mp3
```

### With All Options

```bash
curl -X POST "https://api.elevenlabs.io/v1/sound-generation" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Futuristic sci-fi door opening with hydraulic hiss",
    "duration_seconds": 5,
    "prompt_influence": 0.5
  }' \
  --output scifi_door.mp3
```

### Request Body Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `text` | string | Yes | Description of sound effect |
| `duration_seconds` | float | No | 0.5-22 seconds (default varies) |
| `prompt_influence` | float | No | 0.0-1.0, how closely to follow prompt |

### Sound Effect Prompt Examples

```bash
# Notification sounds
"A pleasant notification chime, bright and short"
"Soft bubble pop notification sound"
"Futuristic UI confirmation beep"

# Environmental
"Forest ambience with birds chirping and wind in leaves"
"Busy coffee shop background noise with chatter"
"Ocean waves gently crashing on a sandy beach"

# Actions
"Footsteps on wooden floor, slow walking pace"
"Car engine starting and idling"
"Glass shattering on concrete floor"

# Game/UI
"8-bit retro game jump sound"
"Level up fanfare, triumphant and short"
"Health pickup sound, magical sparkle"
```

## Twilio Integration Pattern

For phone conversations with ElevenLabs + Twilio:

```python
import httpx
import base64

async def generate_speech_for_twilio(text: str, voice_id: str = "21m00Tcm4TlvDq8ikWAM") -> bytes:
    """Generate μ-law audio for Twilio streaming."""
    async with httpx.AsyncClient() as client:
        response = await client.post(
            f"https://api.elevenlabs.io/v1/text-to-speech/{voice_id}/stream",
            params={"output_format": "ulaw_8000"},
            headers={
                "xi-api-key": os.environ["ELEVENLABS_API_KEY"],
                "Content-Type": "application/json"
            },
            json={
                "text": text,
                "model_id": "eleven_flash_v2_5",
                "voice_settings": {
                    "stability": 0.5,
                    "similarity_boost": 0.75
                }
            }
        )
        return response.content

# For Twilio Media Streams, base64 encode the audio
audio_bytes = await generate_speech_for_twilio("Hello, how can I help?")
audio_base64 = base64.b64encode(audio_bytes).decode()
```

## Error Handling

| Status | Meaning | Action |
|--------|---------|--------|
| 401 | Invalid API key | Check `xi-api-key` header |
| 422 | Invalid request | Check text length, voice_id |
| 429 | Rate limited | Implement exponential backoff |
| 500 | Server error | Retry with backoff |

## Cost Optimization

- **Flash v2.5**: Cheaper per character than Multilingual v2
- **Caching**: Cache generated audio for repeated phrases
- **Text chunking**: For long text, chunk at natural sentence breaks
- **Voice settings**: Default settings are optimized for most use cases

## Quick Test

```bash
# Test TTS (saves to /tmp/elevenlabs_test.mp3)
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM/stream" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "ElevenLabs Flash is working!", "model_id": "eleven_flash_v2_5"}' \
  --output /tmp/elevenlabs_test.mp3 && echo "Success! Audio saved to /tmp/elevenlabs_test.mp3"

# Test Sound Effects (saves to /tmp/elevenlabs_sfx.mp3)
curl -X POST "https://api.elevenlabs.io/v1/sound-generation" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "A happy notification chime", "duration_seconds": 2}' \
  --output /tmp/elevenlabs_sfx.mp3 && echo "Success! Sound effect saved to /tmp/elevenlabs_sfx.mp3"
```

