Speech Generation
Convert text to speech using ElevenLabs voice AI through Letta. Use when generating audio from text, sending a voice message, reading text aloud, creating voiceovers, speaking in your own voice, or synthesizing speech in 90+ languages.
Get the complete skill folder, including its scripts and reference files.
When to use this skill
Use Speech Generation when an AI agent needs a reusable SKILL.md workflow for this job: Convert text to speech using ElevenLabs voice AI through Letta. Use when generating audio from text, sending a voice message, reading text aloud, creating voiceovers, speaking in your own voice, or synthesizing speech in 90+ languages.
When not to use it
Skip Speech Generation when the task is outside the coding category, or when a more specific skill in this directory already covers the same workflow with clearer triggers.
How to install
Where will you use it?
mkdir -p ~/.claude/skills/speech-generation # Save SKILL.md to ~/.claude/skills/speech-generation/SKILL.md
- Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/speech-generation/SKILL.md. For a shared project, commit the folder at .claude/skills/speech-generation/ instead.
- Current Claude Code detects SKILL.md changes in watched directories during the session. If you just created a top-level skills directory, run /reload-skills. Check that the skill is listed before testing its trigger.
- For Claude chat or Cowork in the Desktop app, manage uploaded skills in Customize > Skills; copying files into a local Claude Code folder is not a Desktop install. Other agents may use different install locations.
Full install guide for Claude, Cursor, and Codex →
Try a starter prompt
After installing the skill, paste this starter prompt into your agent to verify it triggers on a small task.
Use the Speech Generation skill for this task: Use Speech Generation when this documented workflow matches the task. Confirm any required inputs or files before making changes.
What supports this recommendation?
71/100 provisional content score. This measures documentation, practical detail and source signals. It is not a measured task success rate or a security certification.
- Documentation
- 77/100
- Practical detail
- 68/100
- Source evidence
- 63/100
- Source signals
- 72/100
Model compatibility evidence
- claudeuntested
No model-specific signal or recorded compatibility test was found.
- chatgptuntested
No model-specific signal or recorded compatibility test was found.
- geminiuntested
No model-specific signal or recorded compatibility test was found.
- copilotuntested
No model-specific signal or recorded compatibility test was found.
- llamauntested
No model-specific signal or recorded compatibility test was found.
- perplexityuntested
No model-specific signal or recorded compatibility test was found.
- mistraluntested
No model-specific signal or recorded compatibility test was found.
- grokuntested
No model-specific signal or recorded compatibility test was found.
Inferred compatibility is based on content signals. Check the app, its available tools and setup requirements before running a skill.
What this skill does
# ElevenLabs Text-to-Speech (via Letta)
Generate natural speech from text - supports 90+ languages, multiple models for quality vs latency tradeoffs. Examples default to `eleven_v4`, the latest and highest-quality model.
This skill is adapted from ElevenLabs' `text-to-speech` skill ([elevenlabs/skills](https://github.com/elevenlabs/skills), MIT; see `LICENSE`). Instead of calling ElevenLabs with your own key, you call Letta's hosted endpoint `POST /v1/audio/speech`. It forwards the request to ElevenLabs with Letta's key and charges the organization's Letta credits, so you do not need an ElevenLabs API key. The request body uses the same field names as ElevenLabs "Create speech" (the voice ID and `output_format` go in the body), and the response is the audio file itself, as with ElevenLabs.
## Quick Start
```bash base_url="${LETTA_BASE_URL%/}"
curl -sS -X POST "$base_url/v1/audio/speech" \ -H "Authorization: Bearer $LETTA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"text":"Hello, welcome to ElevenLabs!","voice_id":"JBFqnCBsd6RMkjVDRZzb","model_id":"eleven_v4"}' \ --output output.mp3 \ --dump-header speech-headers.txt \ --write-out '%{http_code} %{content_type}\n' ```
Use the runtime-provided `LETTA_BASE_URL` and `LETTA_API_KEY` together. Build URLs relative to `${LETTA_BASE_URL%/}` and do not hardcode `https://api.letta.com`. If either variable is missing, the user needs to authenticate with Letta Cloud; do not ask for an ElevenLabs key.
A `200` with an `audio/...` content type means `output.mp3` is the speech. Any other status means `output.mp3` holds a JSON error with a `message` instead; read it (see "Error Handling") and do not share the file.
Share the saved file the way your current surface supports: attach or upload it to the conversation or channel you are replying in. Keep credit amounts out of replies unless the user asks about cost.
## Word timings
Use `POST /v1/audio/speech/with-timestamps` for captions, cueing visuals to words, or lip-sync checks. It accepts the same body as plain speech (`text`, `voice_id`, `model_id`, `voice_settings`, and other options), with the same Letta authentication and billing; no ElevenLabs key is needed.
The response is JSON `{ audio_base64, alignment, normalized_alignment, words }`. Each word is `{ text, type: "word", start, end }`, with times in seconds. Words retain punctuation and use normalized spoken text when available; missing alignment produces an empty `words` array.
```bash base_url="${LETTA_BASE_URL%/}"
curl -fsS -X POST "$base_url/v1/audio/speech/with-timestamps" \ -H "Authorization: Bearer $LETTA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"text":"Hello world!","voice_id":"JBFqnCBsd6RMkjVDRZzb","model_id":"eleven_v4","output_format":"mp3_44100_128"}' \ --output speech.json && jq -r '.audio_base64' speech.json | base64 --decode > output.mp3 && jq '.words' speech.json > words.json ```
Plain `/v1/audio/speech` still returns raw audio bytes.
## Models
| Model ID | Languages | Latency | Best For | |----------|-----------|---------|----------| | `eleven_v4` | 90+ | Standard | **Default.** Highest quality, emotional range, audio tags, voice cloning accuracy | | `eleven_v4_turbo` | 90+ | ~100ms | Faster v4 for shorter, time-sensitive replies | | `eleven_flash_v2_5` | 32 | ~75ms | Lowest latency, lowest cost | | `eleven_flash_v2` | English | ~75ms | English-only, lowest latency | | `eleven_multilingual_v2` | 29 | Standard | Previous generation; most stable on very long-form generations | | `eleven_v3` | 70+ | Standard | Previous generation expressive model |
`eleven_turbo_v2_5` and `eleven_turbo_v2` are superseded by the Flash models (same output, lower latency) — use `eleven_flash_v2_5` / `eleven_flash_v2` instead.
**Eleven v4 notes:** supports only `stability` and `similarity_boost` voice settings (no `style` or `speed`) and does not support SSML. Direct delivery with audio tags such as `[whispers]`, `[laughs]`, `[sarcastic]` (see "Audio Tags").
## Voice IDs
The Letta endpoint accepts ElevenLabs premade voices and voices Letta provides. If your memory names your own voice ID, use it whenever you speak as yourself. Other voices (cloned or designed voices from someone's own ElevenLabs account) are rejected with 400; to use one, call ElevenLabs directly with the user's own `ELEVENLABS_API_KEY` secret and ElevenLabs' `text-to-speech` skill.
**Premade voices:** - `JBFqnCBsd6RMkjVDRZzb` - George (male, warm storyteller) - `EXAVITQu4vr4xnSDxMaL` - Sarah (female, mature, reassuring) - `cgSgspJ2msm6clMCkdW9` - Jessica (female, playful, conversational) - `onwK4e9ZLuTAKqWW03F9` - Daniel (male, steady broadcaster) - `SAz9YHcvj6GT2YYXdXww` - River (neutral, relaxed)
## Voice Settings
Fine-tune how the voice sounds:
- **Stability**: How consistent the voice stays. Lower values = more emotional range and variation, but can sound unstable. Higher = steady, predictable delivery. - **Similarity boost**: How closely to match the original voice sample. Higher values sound more like the original but may amplify audio artifacts. - **Style**: Exaggerates the voice's unique style characteristics (v2/v3 models; not supported on Eleven v4). - **Speed**: Speech speed multiplier (v2/v3 models; not supported on Eleven v4). - **Speaker boost**: Post-processing that enhances clarity and voice similarity.
```json { "text": "Customize my voice settings.", "voice_id": "JBFqnCBsd6RMkjVDRZzb", "model_id": "eleven_v4", "voice_settings": { "stability": 0.5, "similarity_boost": 0.75 } } ```
`stability`: lower = more expressive, higher = more consistent. `similarity_boost`: higher = closer to the reference voice. See [references/voice-settings.md](references/voice-settings.md) for ranges and use-case presets.
## Audio Tags
Eleven v4 reads bracketed, natural-language cues in `text` as stage directions:
- Place a tag before the words it affects: `[shouts] I can't believe you said that to me.` - A tag's emotion carries forward, so add another tag only where the delivery should shift. - Combine tags inside one set of brackets: `[whispering, playful]`. Plain-language tags work, such as `[nervous, trying to sound confident]` or `[phone buzzing]`. - Use one emotion per clause; contrasting tags on the same words blur the performance. - Pair tags with punctuation: ellipses slow a line, dashes cut a speaker off, and `[pause]` / `[long pause]` add beats. - If a delivery misses, swap the tag (try `[let down]` instead of `[despair]`) and regenerate rather than rewriting the line.
## Language Selection
Use `language_code` with models that support language enforcement to guide pronunciation and text normalization. Unsupported language codes are ignored, and `language_code` is not supported on `eleven_multilingual_v2`.
```json { "text": "Bonjour, comment allez-vous?", "voice_id": "JBFqnCBsd6RMkjVDRZzb", "model_id": "eleven_v4", "language_code": "fr" } ```
## Text Normalization
Controls how numbers, dates, and abbreviations are converted to spoken words. For example, "01/15/2026" becomes "January fifteenth, twenty twenty-six":
- `"auto"` (default): Model decides based on context - `"on"`: Always normalize (use when you want natural speech) - `"off"`: Speak literally (use when you want "zero one slash one five...")
```json { "text": "Call 1-800-555-0123 on 01/15/2026", "voice_id": "JBFqnCBsd6RMkjVDRZzb", "model_id": "eleven_v4", "apply_text_normalization": "on" } ```
## Request Stitching
When generating long audio in multiple requests, the audio can have pops, unnatural pauses, or tone shifts at the boundaries. Request stitching solves this by letting each request know what comes before/after it:
```json {"text": "This is the first part.", "voice_id": "JBFqnCBsd6RMkjVDRZzb", "model_id": "eleven_v4", "next_text": "And this continues the story."} ```
```json {"text": "And this continues the story.", "voice_id": "JBFqnCBsd6RMkjVDRZzb", "model_id": "eleven_v4", "previous_text": "This is the first part."} ```
Each response has a `request-id` header (saved by `--dump-header` above, e.g. `grep -i '^request-id:' speech-headers.txt`). Instead of `previous_text`, you can pass up to three earlier request IDs in `previous_request_ids` (and later ones in `next_request_ids` when regenerating a middle part). Keep the same voice, model, and voice settings for every part, split long text at sentence or paragraph boundaries (each request takes up to 10,000 characters), and concatenate the files in order, for example with `ffmpeg -f concat`.
## Output Formats
Pass `output_format` in the body, and name the file to match the format.
| Format | Description | |--------|-------------| | `mp3_44100_128` | MP3 44.1kHz 128kbps (default) - compressed, good for web/apps | | `mp3_44100_192` | MP3 44.1kHz 192kbps - higher quality compressed | | `mp3_44100_64` | MP3 44.1kHz 64kbps - lower quality, smaller files | | `mp3_22050_32` | MP3 22.05kHz 32kbps - smallest MP3 files | | `pcm_16000` | Raw PCM 16kHz - use for real-time processing | | `pcm_22050` | Raw PCM 22.05kHz | | `pcm_24000` | Raw PCM 24kHz | | `pcm_44100` | Raw PCM 44.1kHz - CD quality | | `pcm_48000` | Raw PCM 48kHz - highest quality | | `ulaw_8000` | μ-law 8kHz - standard for phone systems (Twilio, telephony) | | `alaw_8000` | A-law 8kHz - telephony (alternative to μ-law) | | `opus_48000_64` | Opus 48kHz 64kbps - efficient codec, small files | | `wav_44100` | WAV 44.1kHz - uncompressed with headers |
## Error Handling
Errors return JSON with a `message`: - **400 "Voice … is not available"**: use your own voice or a premade voice (see "Voice IDs"). - **400 with an ElevenLabs message**: invalid parameters (check `model_id`, voice settings the model does not support, or text length). - **402**: the organization is out of Letta credits. Tell the user; do not retry. - **500**: retry once, then report the failure.
## References
- [Voice Settings](references/voice-settings.md)
Intended uses
- Use Speech Generation when this documented workflow matches the task.
Implementation notes
- Review the source instructions and adapt inputs before running the workflow.
Try it, then tell us how it went
A copied prompt does not tell us whether the task worked. Report your result after checking the output. We collect your tool and outcome, never your files or prompt.