speech-to-text — Claude Code skill: what it does, how to install
Wraps ElevenLabs Scribe v2 so your coding agent can turn audio or video into text, with speaker labels and word-level timings.
npx skills add elevenlabs/skills --skill speech-to-text -a claude-codeWhat speech-to-text does
The skill gives the agent a working path to ElevenLabs Scribe v2: hand it a file, get back transcript text, a language code and word timings. It covers 90+ languages, so a recording in a language you don't speak is still fair game. Handy when the transcript has to land next to the code instead of in a browser tab.
Three ways in: the Python elevenlabs client, @elevenlabs/elevenlabs-js for JavaScript, or the elevenlabs speech-to-text convert CLI. The main scribe_v2 model takes files up to 5.0GB and 10 hours; scribe_v2_medical handles clinical audio, and realtime variants stream live with partial and committed transcripts. Diarization tags who spoke, while keyterms nudges the model toward up to 100 product names or odd spellings.
Set ELEVENLABS_API_KEY and have internet access before the first call; npx -y @elevenlabs/cli@latest onboard init stores a key for the project so nobody pastes one by hand. One limit bites on call recordings: detect_speaker_roles=true does not combine with use_multi_channel=true, so audio split per speaker can't get agent and customer roles. Worth picking one before you wire up a pipeline.
What it helps with
- turn a meeting recording into a transcript with speaker labels
- generate subtitles with word-level timings
- transcribe dictation in one of 90+ languages
- pass
keytermsso product names survive recognition - stream live audio and read the committed segments
Example prompts for the agent
- Transcribe
meeting.mp3withscribe_v2and print word-level timestamps. - Run
call.mp3through diarization withagentandcustomerroles. - Build subtitles from
video.mp4; I need a start and end for every word.
How to install speech-to-text
1Skills CLI (Vercel)
npx skills add elevenlabs/skills --skill speech-to-text -a claude-code2Manually: put the files in place
~/.claude/skills/speech-to-text/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/speech-to-text/
1Skills CLI (Vercel)
npx skills add elevenlabs/skills --skill speech-to-text -a codex2Manually: put the files in place
.agents/skills/speech-to-text/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add elevenlabs/skills --skill speech-to-text -a cursor2Manually: put the files in place
.cursor/skills/speech-to-text/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install elevenlabs/skills speech-to-text2Manually: put the files in place
.github/skills/speech-to-text/SKILL.md1Skills CLI (Vercel)
npx skills add elevenlabs/skills --skill speech-to-text -a gemini-cli2Platform CLI
gemini skills install https://github.com/elevenlabs/skills --path speech-to-textManually: put the files in place
.devin/skills/speech-to-text/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add elevenlabs/skills --skill speech-to-text -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about speech-to-text
How do I install speech-to-text in Claude Code?
Run npx skills add elevenlabs/skills --skill speech-to-text -a claude-code. The skill loads from ~/.claude/skills/speech-to-text/SKILL.md.
What does speech-to-text do?
It sends audio or video to ElevenLabs Scribe v2 and returns the text, the detected language code and word timings. Speaker diarization and up to 100 keyterm hints are part of it.
What has to be ready before it runs?
An ELEVENLABS_API_KEY and internet access. With no key set for the project, the skill runs npx -y @elevenlabs/cli@latest onboard init to sign in and store one.
Source text
SKILL.md · MIT
---
name: speech-to-text
description: Transcribe audio to text using ElevenLabs Scribe v2. Use when converting audio/video to text, generating subtitles, transcribing meetings, or processing spoken content.
license: MIT
compatibility: Requires internet access and an ElevenLabs API key (ELEVENLABS_API_KEY).
metadata: {"openclaw": {"requires": {"env": ["ELEVENLABS_API_KEY"]}, "primaryEnv": "ELEVENLABS_API_KEY"}}
---
# ElevenLabs Speech-to-Text
Transcribe audio to text with Scribe v2 - supports 90+ languages, speaker diarization, and word-level timestamps.
> **Setup, before writing any code:** if `ELEVENLABS_API_KEY` isn't set for this project, run `npx -y @elevenlabs/cli@latest onboard init` from the app's folder first and follow what it prints: it signs the user in and stores a key for the project, so nobody copies one by hand. Otherwise see the [Installation Guide](references/installation.md). For JavaScript, use `@elevenlabs/*` packages only.
## Quick Start
### Python
```python
from elevenlabs import ElevenLabs
client = ElevenLabs()
with open("audio.mp3", "rb") as audio_file:
result = client.speech_to_text.convert(file=audio_file, model_id="scribe_v2")
print(result.text)
```
### JavaScript
```javascript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
import { createReadStream } from "fs";
const client = new ElevenLabsClient();
const result = await client.speechToText.convert({
file: createReadStream("audio.mp3"),
modelId: "scribe_v2",
});
console.log(result.text);
```
### CLI
```bash
elevenlabs speech-to-text convert --file audio.mp3 --model-id scribe_v2
```
## Models
| Model ID | Description | Best For |
|----------|-------------|----------|
| `scribe_v2` | State-of-the-art accuracy, 90+ languages | Batch transcription, subtitles, long-form audio |
| `scribe_v2_medical` | Specialized recognition for medical and clinical audio, 90+ languages | Clinical documentation, medical dictation, patient calls |
| `scribe_v2_realtime` | Low latency (~150ms) | Live transcription, voice agents |
| `scribe_v2_realtime_turbo` | Realtime transcription variant | Live transcription |
| `scribe_v2_realtime_lite` | Realtime transcription variant | Live transcription |
## Transcription with Timestamps
Word-level timestamps include type classification and speaker identification:
```python
result = client.speech_to_text.convert(
file=audio_file, model_id="scribe_v2", timestamps_granularity="word"
)
for word in result.words:
print(f"{word.text}: {word.start}s - {word.end}s (type: {word.type})")
```
## Speaker Diarization
Identify WHO said WHAT - the model labels each word with a speaker ID, useful for meetings, interviews, or any multi-speaker audio:
```python
result = client.speech_to_text.convert(
file=audio_file,
model_id="scribe_v2",
diarize=True
)
for word in result.words:
print(f"[{word.speaker_id}] {word.text}")
```
For call recordings, the batch API can label diarized speakers as `agent` and `customer` by setting `detect_speaker_roles=true` alongside `diarize=true`. This option is not compatible with `use_multi_channel=true`.
If your workspace has registered speaker profiles, set `use_speaker_library=true` with `diarize=true` to match detected speakers against the speaker library.
```bash
elevenlabs speech-to-text convert \
--file call.mp3 \
--model-id scribe_v2 \
--diarize true \
--detect-speaker-roles true \
--use-speaker-library true
```
## Multichannel Audio
Use `use_multi_channel=true` when each speaker is isolated on a separate audio channel. By default, the API returns one transcript per channel under `transcripts`; set `multichannel_output_style="combined"` to receive one transcript merged by timestamp, with `channel_index` on each word.
```python
result = client.speech_to_text.convert(
file=audio_file,
model_id="scribe_v2",
use_multi_channel=True,
multichannel_output_style="combined",
)
```
## Keyterm Prompting
Help the model recognize specific words it might otherwise mishear - product names, technical jargon, or unusual spellings (up to 100 terms):
```python
result = client.speech_to_text.convert(
file=audio_file,
model_id="scribe_v2",
keyterms=["ElevenLabs", "Scribe", "API"]
)
```
## Language Detection
Automatic detection with optional language hint:
```python
result = client.speech_to_text.convert(
file=audio_file,
model_id="scribe_v2",
language_code="eng" # ISO 639-1 or ISO 639-3 code
)
print(f"Detected: {result.language_code} ({result.language_probability:.0%})")
```
## Supported Formats
**Audio:** MP3, WAV, M4A, FLAC, OGG, WebM, AAC, AIFF, Opus
**Video:** MP4, AVI, MKV, MOV, WMV, FLV, WebM, MPEG, 3GPP
**Limits:** Up to 5.0GB file size, 10 hours duration
## Response Format
```json
{
"text": "The full transcription text",
"language_code": "eng",
"language_probability": 0.98,
"words": [
{"text": "The", "start": 0.0, "end": 0.15, "type": "word", "speaker_id": "speaker_0"},
{"text": " ", "start": 0.15, "end": 0.16, "type": "spacing", "speaker_id": "speaker_0"}
]
}
```
**Word types:**
- `word` - An actual spoken word
- `spacing` - Whitespace between words (useful for precise timing)
- `audio_event` - Non-speech sounds the model detected (laughter, applause, music, etc.)
## Error Handling
```python
try:
result = client.speech_to_text.convert(file=audio_file, model_id="scribe_v2")
except Exception as e:
print(f"Transcription failed: {e}")
```
Common errors:
- **401**: Invalid API key
- **422**: Invalid parameters
- **429**: Rate limit exceeded
## Tracking Costs
Monitor usage via `request-id` response header:
```python
response = client.speech_to_text.with_raw_response.convert(file=audio_file, model_id="scribe_v2")
result = response.data
print(f"Request ID: {response.headers.get('request-id')}")
```
## Real-Time Streaming
For live transcription with ultra-low latency (~150ms), use the real-time API. The real-time API produces two types of transcripts:
- **Partial transcripts**: Interim results that update frequently as audio is processed - use these for live feedback (e.g., showing text as the user speaks)
- **Committed transcripts**: Final, stable results after you "commit" - use these as the source of truth for your application
A "commit" tells the model to finalize the current segment. You can commit manually (e.g., when the user pauses) or use Voice Activity Detection (VAD) to auto-commit on silence.
### Python (Server-Side)
```python
import asyncio
from elevenlabs import CommitStrategy, ElevenLabs, RealtimeEvents, RealtimeUrlOptions
client = ElevenLabs()
async def transcribe_realtime():
done = asyncio.Event()
connection = await client.speech_to_text.realtime.connect(RealtimeUrlOptions(
model_id="scribe_v2_realtime",
url="https://npr-ice.streamguys1.com/live.mp3",
commit_strategy=CommitStrategy.VAD, # URL streams never commit on their own
include_timestamps=True,
keyterms=["ElevenLabs", "Scribe"],
no_verbatim=True,
))
def on_error(error):
print(f"Error: {error}")
done.set()
connection.on(RealtimeEvents.PARTIAL_TRANSCRIPT, lambda data: print(f"Partial: {data.get('text', '')}"))
connection.on(RealtimeEvents.COMMITTED_TRANSCRIPT, lambda data: print(f"Final: {data.get('text', '')}"))
connection.on(RealtimeEvents.ERROR, on_error)
connection.on(RealtimeEvents.CLOSE, done.set)
try:
await done.wait()
finally:
await connection.close()
asyncio.run(transcribe_realtime())
```
### JavaScript (Client-Side with React)
```typescript
import { useScribe, CommitStrategy } from "@elevenlabs/react";
function TranscriptionComponent() {
const [transcript, setTranscript] = useState("");
const scribe = useScribe({
modelId: "scribe_v2_realtime",
commitStrategy: CommitStrategy.VAD, // Auto-commit on silence for mic input
keyterms: ["ElevenLabs", "Scribe"],
noVerbatim: true,
includeLanguageDetection: true,
onPartialTranscript: (data) => console.log("Partial:", data.text),
onCommittedTranscript: (data) => setTranscript((prev) => prev + data.text),
});
const start = async () => {
// Get token from your backend (never expose API key to client)
const { token } = await fetch("/scribe-token").then((r) => r.json());
await scribe.connect({
token,
microphone: { echoCancellation: true, noiseSuppression: true },
});
};
return <button onClick={start}>Start Recording</button>;
}
```
### Commit Strategies
| Strategy | Description |
|----------|-------------|
| **Manual** | You call `commit()` when ready - use for file processing or when you control the audio segments |
| **VAD** | Voice Activity Detection auto-commits when silence is detected - use for live microphone input |
Set `includeLanguageDetection: true` to receive the detected language code in delayed final
transcript events.
```typescript
// React: set commitStrategy on the hook (recommended for mic input)
import { useScribe, CommitStrategy } from "@elevenlabs/react";
const scribe = useScribe({
modelId: "scribe_v2_realtime",
commitStrategy: CommitStrategy.VAD,
keyterms: ["ElevenLabs", "Scribe"],
noVerbatim: true,
// Optional VAD tuning:
vadSilenceThresholdSecs: 1.5,
vadThreshold: 0.4,
});
```
```javascript
// JavaScript client: pass vad config on connect
const connection = await client.speechToText.realtime.connect({
modelId: "scribe_v2_realtime",
keyterms: ["ElevenLabs", "Scribe"],
noVerbatim: true,
vad: {
silenceThresholdSecs: 1.5,
threshold: 0.4,
},
});
```
### Event Types
| Event | Description |
|-------|-------------|
| `partial_transcript` | Live interim results |
| `final_transcript` | Stable segment result sent before the segment is committed |
| `final_transcript_with_timestamps` | Delayed final result with timestamps and/or detected language |
| `committed_transcript` | Final results after commit |
| `committed_transcript_with_timestamps` | Final with word timing |
| `committed_transcript_entities` | Entities detected in a committed segment |
| `edited_transcript` | Original and edited text for a committed segment when transcript editing is enabled |
| `invalid_request` | Connection parameters were rejected and the session closes |
| `error` | Error occurred |
See real-time references for complete documentation.
## References
- [Installation Guide](references/installation.md)
- [Transcription Options](references/transcription-options.md)
- [Real-Time Client-Side Streaming](references/realtime-client-side.md)
- [Real-Time Server-Side Streaming](references/realtime-server-side.md)
- [Commit Strategies](references/realtime-commit-strategies.md)
- [Real-Time Event Reference](references/realtime-events.md)
© elevenlabs · MIT · elevenlabs/skills