Repository navigation
fix(gradium): identify the STT plugin to the API with x-api-source: livekit-plugin - #7873
Merged
tinalenguyen merged 1 commit intoOct 16, 2026
Merged
Conversation
The STT websocket sent `x-api-source: livekit`, while the TTS plugin is moving to `livekit-plugin` (livekit#7815), so sessions from the same plugin were recorded under two sources. Send `livekit-plugin` from STT too, through a shared `ws_headers(api_key)` in `api.py` that the TTS change will use as well. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
tinalenguyen
approved these changes
Oct 16, 2026
hhugo-gradium
added a commit
to hhugo-gradium/agents
that referenced
this pull request
Oct 19, 2026
The TTS streams opened their websockets with only the API key, so TTS sessions were recorded by the API with no source, while the STT stream has sent `x-api-source: livekit-plugin` since livekit#7873. The `_connect_ws` helper on the TTS class that did set the header was never called. Send the same value from TTS through the shared `ws_headers(api_key)` in `api.py`. Make `_connect_ws` the single connect path for both TTS streams, keeping both the receive timeout the call sites set and the handshake bound the helper already had, and delete the unused `_close_ws` (supersedes livekit#7220). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
hhugo-gradium
added a commit
to hhugo-gradium/agents
that referenced
this pull request
Oct 19, 2026
The TTS streams opened their websockets with only the API key, so TTS sessions were recorded by the API with no source, while the STT stream has sent `x-api-source: livekit-plugin` since livekit#7873. The `_connect_ws` helper on the TTS class that did set the header was never called. Send the same value from TTS through the shared `ws_headers(api_key)` in `api.py`. Make `_connect_ws` the single connect path for both TTS streams, keeping both the receive timeout the call sites set and the handshake bound the helper already had, and delete the unused `_close_ws` (supersedes livekit#7220). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Summary
The Gradium STT websocket identified itself to the API with
x-api-source: livekit. The TTS side is moving tolivekit-plugin(#7815), so sessions opened by the same plugin were about to be recorded under two different sources. This sendslivekit-pluginfrom STT as well.The value lives in a new
api.pyasAPI_SOURCE, with aws_headers(api_key)helper that builds the websocket headers; #7815 will use the same helper for TTS once this lands, so both sockets send one value from one place.Testing
tests/test_plugin_gradium_api_source.py: one unit test on a fake session that records the headersws_connectreceives; it pins the header value rather than importing it, so a rename in the plugin fails the test. Fails onmain(livekitinstead oflivekit-plugin).ruff,ruff format --checkandmypyclean on the plugin.api.gradium.ai:SpeechStream._connect_wsfrom this branch opens a session and gets thereadyframe back in 150 ms (requestibWdowGaUcU, modeld1b59b55@500), so the header is accepted; the session shows up on the API side under sourcelivekit-plugin.Related
Split out of #7815, which will be reduced to the TTS side and rebased on this once it merges.
🤖 Generated with Claude Code