Skip to content

fix(elevenlabs): use audio_format query param for STT realtime#5574

Merged
longcw merged 1 commit intomainfrom
longc/fix-elevenlabs-audio-format
Apr 30, 2026
Merged

fix(elevenlabs): use audio_format query param for STT realtime#5574
longcw merged 1 commit intomainfrom
longc/fix-elevenlabs-audio-format

Conversation

@longcw
Copy link
Copy Markdown
Contributor

@longcw longcw commented Apr 28, 2026

Fixes #5573

The realtime websocket endpoint expects `audio_format=pcm_<rate>`, not
`encoding=pcm_<rate>`. Because the previous param name was unknown, the
server fell back to its default of `pcm_16000`, ignoring the configured
sample rate and producing wrong VAD timings/word offsets when callers
set anything else (e.g. `sample_rate=8000`).

Fixes #5573
@chenghao-mou chenghao-mou requested a review from a team April 28, 2026 08:21
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Copy link
Copy Markdown

@ameyakhare ameyakhare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also remove the sample_rate field in the message payloads since those are no longer used.

@ameyakhare
Copy link
Copy Markdown

We can also remove the sample_rate field in the message payloads since those are no longer used.

Nevermind, the API reference still documents that field even though it's ignored. I'll update/remove it later.

Copy link
Copy Markdown
Member

@tinalenguyen tinalenguyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@longcw longcw merged commit be207dd into main Apr 30, 2026
38 of 39 checks passed
@longcw longcw deleted the longc/fix-elevenlabs-audio-format branch April 30, 2026 05:33
Copy link
Copy Markdown
Contributor

This is an automated Claude Code Routine created by @toubatbrian (currently in experimentation stage). The automation triages merged PRs in livekit/agents and ports plugin / core-runtime changes into livekit/agents-js.

Triage result for this PR: skipped (no JS counterpart to patch).

This PR fixes a single query-param on the ElevenLabs STT realtime WebSocket (encoding=pcm_<rate>audio_format=pcm_<rate> in livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/stt.py). The @livekit/agents-plugin-elevenlabs package in agents-js currently only ships the TTS module — there is no stt.ts to apply this fix to. Building a full ElevenLabs STT realtime module from scratch is well outside the scope of a 1-line patch port and would need a dedicated, human-reviewed effort.

No JS PR will be opened for this change. If/when an ElevenLabs STT module lands in agents-js, it should use audio_format=pcm_<rate> per this fix.

cc @toubatbrian @livekit/agent-devs


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ElevenLabs STT stream ignores sample rate configuration

4 participants