fix(openai): include model in gateway websocket urls#2032
Merged
Conversation
🦋 Changeset detectedLatest commit: e8533fa The changes in this PR will be included in the next version bump. This PR includes changesets to release 36 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
toubatbrian
approved these changes
Jul 14, 2026
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
modelon Responses WebSocket upgrade URLs for non-OpenAI gateway hosts only.modelfromapi.openai.comWebSocket URLs./responsesbase URLs without appending/responsestwice.Source diff coverage
Coverage classification
livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/responses/llm.py: adapted toplugins/openai/src/ws/llm.ts. The JS target splits Responses HTTP wrapper (responses/llm.ts) from Responses WebSocket implementation (ws/llm.ts), so the URL construction belongs inws/llm.ts; parity is implemented by omittingmodelfor nativeapi.openai.comand adding it for gateway hosts, while preserving HTTP-to-WS scheme conversion. The target also keeps JSbaseURLroot semantics and now accepts source-style full/responsesURLs without duplication.livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/stt.py: ported toplugins/openai/src/stt.ts. The target already had the equivalentbuildRealtimeSttUrlbehavior:intent=transcriptionalways,modelonly for non-native OpenAI hosts, and HTTP-to-WS scheme conversion, so no code change was needed.tests/test_plugin_openai_websocket_urls.py: adapted toplugins/openai/src/stt.test.tsandplugins/openai/src/ws/llm.test.ts. The target co-locates Vitest tests with each module and exposes URL builder helpers, so the source’s private fake-session URL assertions map to helper-level URL assertions rather than a new cross-plugin test file. Existing STT URL tests already covered the STT source cases; Responses WS tests were updated/extended for native omission, gateway inclusion, scheme conversion, and full/responsesendpoint handling.Verification
pnpm buildpnpm --filter @livekit/agents-plugin-openai lint(passes with pre-existing warnings)env -u OPENAI_API_KEY pnpm test -- plugins/openaicue-cliruntime validation against a temporary uncommitted JS worker usingopenai.responses.LLM({ useWebSocket: true }): assistantconversation_item_addedframework events resolved for greeting and a user turn.Note:
pnpm test -- plugins/openaiwith the ambientOPENAI_API_KEYset entered optional provider integration tests and failed on existing environment/test prerequisites (plugins/silero/dist/silero_vad.onnxparse failure and an existing realtime STT-without-VAD construction intts.test.ts). The suite passes when provider integrations follow their built-in skip path withOPENAI_API_KEYunset.Ported from livekit/agents#6403
Original PR description
Summary
Test plan
uv run pytest tests/test_plugin_openai_websocket_urls.py --unituv run ruff check livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/stt.py livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/responses/llm.py tests/test_plugin_openai_websocket_urls.pyuv run ruff format --check livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/stt.py livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/responses/llm.py tests/test_plugin_openai_websocket_urls.pymake type-check