Skip to content

fix(gradium): identify the STT plugin to the API with x-api-source: livekit-plugin - #7873

Merged
tinalenguyen merged 1 commit into
livekit:mainfrom
hhugo-gradium:fix/gradium-stt-api-source
Oct 16, 2026
Merged

tinalenguyen merged 1 commit into
livekit:mainfrom
hhugo-gradium:fix/gradium-stt-api-source

Conversation

@hhugo-gradium

Copy link
Copy Markdown
Contributor

Summary

The Gradium STT websocket identified itself to the API with x-api-source: livekit. The TTS side is moving to livekit-plugin (#7815), so sessions opened by the same plugin were about to be recorded under two different sources. This sends livekit-plugin from STT as well.

The value lives in a new api.py as API_SOURCE, with a ws_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 headers ws_connect receives; it pins the header value rather than importing it, so a rename in the plugin fails the test. Fails on main (livekit instead of livekit-plugin).
  • ruff, ruff format --check and mypy clean on the plugin.
  • Live against api.gradium.ai: SpeechStream._connect_ws from this branch opens a session and gets the ready frame back in 150 ms (request ibWdowGaUcU, model d1b59b55@500), so the header is accepted; the session shows up on the API side under source livekit-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

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>
@hhugo-gradium
hhugo-gradium requested a review from a team as a code owner October 16, 2026 07:52

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

Copy link
Copy Markdown
Contributor

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 bugs or issues to report.

Devin Review

@tinalenguyen
tinalenguyen merged commit ddbb351 into livekit:main Oct 16, 2026
17 checks passed
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>
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.

2 participants