Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This branch has not been deployed
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.
Issue for this PR
Related to #65647, #66627.
Type of change
What does this PR do?
Today voice sessions only work with direct
openai,xai,google, or hostedopencodeendpoints:Realtime.connectignoresbaseURL/headersoutsideopenai-live, andVoice.Serviceonly offersmodels.devvoice models for those fixed providers. That blocks teams routing traffic through an AI gateway (for example LiteLLM + Vertex AI Gemini Live) and users running local OpenAI-Realtime-compatible servers (such as vLLM/v1/realtimewithout an API key).Changes:
packages/schema,packages/core): Add optionalrealtime(protocol,transports,auth) onModel.InfoandConfig.Model, and copy it inConfigProviderPlugin. Regenerated OpenAPI, client types, Rustapi-types, plugin.d.ts, and API skill docs.Realtime.connect(packages/ai/src/experimental/realtime.ts): HonorbaseURLandheadersacross all four engines (openai-live,openai-realtime,xai-realtime,gemini-live), makeapiKeyoptional for keyless local servers, and support WebSocketauthmodes:"ephemeral"(default): mint short-lived tokens via/realtime/client_secretsor/auth_tokensas before."none": skip token minting and returnws(s)://...with an empty token for keyless local servers."direct": opt-in for gateways or authenticated local servers withoutclient_secrets, passing the configured API key (never OAuth) as the WebSocket token.Voice.Service(packages/core/src/voice.ts): Offer configuredtype: "realtime"models with arealtime.protocolas<provider>/<id>(requiringsettings.baseURLfor non-built-in providers so custom/local models never hit upstream defaults), forward configuredbaseURL/headers/auth, and reject OAuth credentials underauth: "direct".No feature flag: existing built-in behavior is unchanged, and custom/local realtime models are opt-in via
opencode.jsonc.Example config:
{ "providers": { "litellm": { "settings": { "baseURL": "https://litellm.example.com/v1", "apiKey": "{env:LITELLM_API_KEY}" }, "models": { "vertex-gemini-live": { "type": "realtime", "modelID": "vertex_ai/gemini-live-2.5-flash", "realtime": { "protocol": "openai-realtime", "transports": ["websocket"], "auth": "direct" } } } }, "vllm": { "models": { "mistralai/Voxtral-Mini-4B-Realtime-2602": { "type": "realtime", "realtime": { "protocol": "openai-realtime", "transports": ["websocket"], "auth": "none" } } } } } }How did you verify your code works?
bun --cwd packages/ai test test/realtime.test.ts --rerun-each 10(40 pass)bun run --cwd packages/core script/test.ts test/voice.test.ts --rerun-each 10(70 pass)bun run --cwd packages/core script/test.ts test/config/provider.test.ts(43 pass)bun --cwd packages/schema test && bun run --cwd packages/schema typecheck:tsc(99 pass)bun --cwd packages/protocol test && bun run --cwd packages/protocol check:generated(17 pass)bun run --cwd packages/client check:generatedbun run --cwd packages/core typecheck:tscbun --cwd packages/server test test/voice.test.ts(1 pass)bun run lint&oxlinton all touched files (0 errors)bun run --cwd services/site generate && bun run --cwd services/site src/docs/script/build.ts(1944 pages built)Screenshots / recordings
N/A (backend, schema, and docs change only).
Checklist