$npx -y skills add calesthio/OpenMontage --skill speech-to-textTranscribe audio to text using ElevenLabs Scribe v2. Use when converting audio/video to text, generating subtitles, transcribing meetings, or processing spoken content.
| 1 | # ElevenLabs Speech-to-Text |
| 2 | |
| 3 | Transcribe audio to text with Scribe v2 - supports 90+ languages, speaker diarization, and word-level timestamps. |
| 4 | |
| 5 | > **Setup:** See [Installation Guide](references/installation.md). For JavaScript, use `@elevenlabs/*` packages only. |
| 6 | |
| 7 | ## Quick Start |
| 8 | |
| 9 | ### Python |
| 10 | |
| 11 | ```python |
| 12 | from elevenlabs import ElevenLabs |
| 13 | |
| 14 | client = ElevenLabs() |
| 15 | |
| 16 | with open("audio.mp3", "rb") as audio_file: |
| 17 | result = client.speech_to_text.convert(file=audio_file, model_id="scribe_v2") |
| 18 | |
| 19 | print(result.text) |
| 20 | ``` |
| 21 | |
| 22 | ### JavaScript |
| 23 | |
| 24 | ```javascript |
| 25 | import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js"; |
| 26 | import { createReadStream } from "fs"; |
| 27 | |
| 28 | const client = new ElevenLabsClient(); |
| 29 | const result = await client.speechToText.convert({ |
| 30 | file: createReadStream("audio.mp3"), |
| 31 | modelId: "scribe_v2", |
| 32 | }); |
| 33 | console.log(result.text); |
| 34 | ``` |
| 35 | |
| 36 | ### cURL |
| 37 | |
| 38 | ```bash |
| 39 | curl -X POST "https://api.elevenlabs.io/v1/speech-to-text" \ |
| 40 | -H "xi-api-key: $ELEVENLABS_API_KEY" -F "file=@audio.mp3" -F "model_id=scribe_v2" |
| 41 | ``` |
| 42 | |
| 43 | ## Models |
| 44 | |
| 45 | | Model ID | Description | Best For | |
| 46 | |----------|-------------|----------| |
| 47 | | `scribe_v2` | State-of-the-art accuracy, 90+ languages | Batch transcription, subtitles, long-form audio | |
| 48 | | `scribe_v2_realtime` | Low latency (~150ms) | Live transcription, voice agents | |
| 49 | |
| 50 | ## Transcription with Timestamps |
| 51 | |
| 52 | Word-level timestamps include type classification and speaker identification: |
| 53 | |
| 54 | ```python |
| 55 | result = client.speech_to_text.convert( |
| 56 | file=audio_file, model_id="scribe_v2", timestamps_granularity="word" |
| 57 | ) |
| 58 | |
| 59 | for word in result.words: |
| 60 | print(f"{word.text}: {word.start}s - {word.end}s (type: {word.type})") |
| 61 | |
| 62 | ``` |
| 63 | |
| 64 | ## Speaker Diarization |
| 65 | |
| 66 | Identify WHO said WHAT - the model labels each word with a speaker ID, useful for meetings, interviews, or any multi-speaker audio: |
| 67 | |
| 68 | ```python |
| 69 | result = client.speech_to_text.convert( |
| 70 | file=audio_file, |
| 71 | model_id="scribe_v2", |
| 72 | diarize=True |
| 73 | ) |
| 74 | |
| 75 | for word in result.words: |
| 76 | print(f"[{word.speaker_id}] {word.text}") |
| 77 | ``` |
| 78 | |
| 79 | ## Keyterm Prompting |
| 80 | |
| 81 | Help the model recognize specific words it might otherwise mishear - product names, technical jargon, or unusual spellings (up to 100 terms): |
| 82 | |
| 83 | ```python |
| 84 | result = client.speech_to_text.convert( |
| 85 | file=audio_file, |
| 86 | model_id="scribe_v2", |
| 87 | keyterms=["ElevenLabs", "Scribe", "API"] |
| 88 | ) |
| 89 | ``` |
| 90 | |
| 91 | ## Language Detection |
| 92 | |
| 93 | Automatic detection with optional language hint: |
| 94 | |
| 95 | ```python |
| 96 | result = client.speech_to_text.convert( |
| 97 | file=audio_file, |
| 98 | model_id="scribe_v2", |
| 99 | language_code="eng" # ISO 639-1 or ISO 639-3 code |
| 100 | ) |
| 101 | |
| 102 | print(f"Detected: {result.language_code} ({result.language_probability:.0%})") |
| 103 | ``` |
| 104 | |
| 105 | ## Supported Formats |
| 106 | |
| 107 | **Audio:** MP3, WAV, M4A, FLAC, OGG, WebM, AAC, AIFF, Opus |
| 108 | **Video:** MP4, AVI, MKV, MOV, WMV, FLV, WebM, MPEG, 3GPP |
| 109 | |
| 110 | **Limits:** Up to 3GB file size, 10 hours duration |
| 111 | |
| 112 | ## Response Format |
| 113 | |
| 114 | ```json |
| 115 | { |
| 116 | "text": "The full transcription text", |
| 117 | "language_code": "eng", |
| 118 | "language_probability": 0.98, |
| 119 | "words": [ |
| 120 | {"text": "The", "start": 0.0, "end": 0.15, "type": "word", "speaker_id": "speaker_0"}, |
| 121 | {"text": " ", "start": 0.15, "end": 0.16, "type": "spacing", "speaker_id": "speaker_0"} |
| 122 | ] |
| 123 | } |
| 124 | ``` |
| 125 | |
| 126 | **Word types:** |
| 127 | - `word` - An actual spoken word |
| 128 | - `spacing` - Whitespace between words (useful for precise timing) |
| 129 | - `audio_event` - Non-speech sounds the model detected (laughter, applause, music, etc.) |
| 130 | |
| 131 | ## Error Handling |
| 132 | |
| 133 | ```python |
| 134 | try: |
| 135 | result = client.speech_to_text.convert(file=audio_file, model_id="scribe_v2") |
| 136 | except Exception as e: |
| 137 | print(f"Transcription failed: {e}") |
| 138 | ``` |
| 139 | |
| 140 | Common errors: |
| 141 | - **401**: Invalid API key |
| 142 | - **422**: Invalid parameters |
| 143 | - **429**: Rate limit exceeded |
| 144 | |
| 145 | ## Tracking Costs |
| 146 | |
| 147 | Monitor usage via `request-id` response header: |
| 148 | |
| 149 | ```python |
| 150 | response = client.speech_to_text.convert.with_raw_response(file=audio_file, model_id="scribe_v2") |
| 151 | result = response.parse() |
| 152 | print(f"Request ID: {response.headers.get('request-id')}") |
| 153 | ``` |
| 154 | |
| 155 | ## Real-Time Streaming |
| 156 | |
| 157 | For live transcription with ultra-low latency (~150ms), use the real-time API. The real-time API produces two types of transcripts: |
| 158 | |
| 159 | - **Partial transcripts**: Interim results that update frequently as audio is processed - use these for live feedback (e.g., showing text as the user speaks) |
| 160 | - **Committed transcripts**: Final, stable results after you "commit" - use these as the source of truth for your application |
| 161 | |
| 162 | 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. |
| 163 | |
| 164 | ### Python (Server-Side) |
| 165 | |
| 166 | ```python |
| 167 | import asyncio |
| 168 | from elevenlabs impo |