Add ElevenLabs Scribe transcription adapter - #161
Open
RichJackson wants to merge 13 commits into
Open
RichJackson wants to merge 13 commits into
RichJackson wants to merge 13 commits into
Conversation
Synchronous adapter for the ElevenLabs Scribe speech-to-text API, registered with the transcription manager, with settings for its API key, model and request timeout. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GSrMumb6qEQrBJdZ37NbfB
Adapters build their tenacity retry from transcription_retry and the TRANSCRIPTION_RETRY_* settings, and the async adapters poll using the TRANSCRIPTION_POLL_* settings instead of per-call arguments. Shared HTTP status codes move to common/http_status.py. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GSrMumb6qEQrBJdZ37NbfB
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GSrMumb6qEQrBJdZ37NbfB
The manager only passes a Recording to async adapters, so raise a TypeError before calling the API. This also lets Pyright narrow the argument to a Path. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GSrMumb6qEQrBJdZ37NbfB
The synchronous Azure adapter rejects anything but a local file and the async AWS and Azure batch adapters anything but a Recording, before any client is created. This also lets Pyright narrow the Path | Recording argument in each start(). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GSrMumb6qEQrBJdZ37NbfB
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XZQAgYmkw28HnNLZHgcwxS
…iption test A data residency API key is rejected with a 401 by every stack but its own, including the global API the SDK calls by default. ELEVENLABS_BASE_URL now defaults to the EU stack and can be pointed elsewhere for a key issued on another one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XZQAgYmkw28HnNLZHgcwxS
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JdgoAiwmGAx5qksBNtBVsw
GChrysostomou
approved these changes
Sep 14, 2026
| LANGUAGE_CODE = "eng" | ||
|
|
||
|
|
||
| def _is_retryable(exception: BaseException) -> bool: |
There was a problem hiding this comment.
This looks very re-usable so maybe move to retry.py?
Contributor
Author
There was a problem hiding this comment.
ah no afraid not - it depends on ApiError from the elevenlabs SDK
| @@ -0,0 +1,49 @@ | |||
| """Transcribe real audio with the live ElevenLabs Scribe API. | |||
There was a problem hiding this comment.
maybe we can skip this if env is local development? If basically our ENVIRONMENT=local we don't have to check this to even further minimise costs if we are building tests lets say for a new feature and we do make test?
Contributor
Author
There was a problem hiding this comment.
yeah great call out - I'll add a skip
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
| "ray[default]>=2.53.0,<3", | ||
| "azure-storage-blob>=12.26.0,<13", | ||
| "azure-identity>=1.23.1,<2", | ||
| "elevenlabs", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds ElevenLabs Scribe as a transcription service and switches preprod over to it.
ElevenLabs adapter
elevenlabs_stt(common/services/transcription_services/elevenlabs.py), registered with the transcription manager.https://api.eu.residency.elevenlabs.io) by default. A residency key only works against the stack it was issued for, soELEVENLABS_BASE_URLmust match the key.speaker_0rather than being dropped.ELEVENLABS_API_KEY,ELEVENLABS_BASE_URL,ELEVENLABS_STT_MODEL(defaultscribe_v2),ELEVENLABS_STT_TIMEOUT_SECONDS(default 1 hour). Because the adapter is synchronous, the timeout, not the service's 10-hour limit, caps how long a recording it can handle.Shared retry and polling settings
retry_count/retry_delayarguments. These now go throughtranscription_retryinretry.pyand newTRANSCRIPTION_RETRY_*/TRANSCRIPTION_POLL_*settings. The defaults match the old hardcoded values.check()no longer takesretry_count/retry_delay.noqa: PLR2004s) are replaced with constants incommon/http_status.py.Adapter input checks
TypeErrorif they're given aRecording, and async adapters if they're given aPath, instead of failing later with a less obvious error.Infrastructure
ELEVENLABS_API_KEYadded to the SSM env secrets (placeholder value).TRANSCRIPTION_SERVICESis["elevenlabs_stt"]in the preprod workspace only; every other workspace keepsazure_stt_synchronous+azure_stt_batch. Preprod has no Azure fallback.Other
elevenlabsdependency. Most of thepyproject.tomldiff is formatting (lists collapsed/expanded), not functional changes.Tests
tests/test_elevenlabs_adapter.py: adapter unit tests (response mapping, retry behaviour, base URL, manager registration).tests/test_transcription_retry.py,tests/test_transcription_adapter_inputs.py: shared retry and input-type checks.tests/test_elevenlabs_adapter_live.py: transcribes a 60-second clip against the real API. Markedcosts_moneyandrequires_audio_data; needs an EU residencyELEVENLABS_API_KEYin.env.Note - this is currently deployed to preprod
🤖 Generated with Claude Code
https://claude.ai/code/session_01JdgoAiwmGAx5qksBNtBVsw