fix byok-opencode: route non-OpenAI openai-protocol hosts to @ai-sdk/openai-compatible - #5344
Conversation
β¦openai-compatible The BYOK OpenCode path mapped protocol "openai" straight to @ai-sdk/openai (Responses API /responses) for every host, so providers that only serve /chat/completions (DeepSeek, vLLM, etc.) 404 on /responses. Route non-api.openai.com openai-protocol hosts to @ai-sdk/openai-compatible; real OpenAI stays on @ai-sdk/openai. Adds a DeepSeek regression test and corrects the vLLM test to openai-compatible.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Hey @JackChen-me β thanks for the sharp write-up and the tight repro here. Because this changes a live BYOK runtime path that users hit directly, Iβm marking it for QA once the PR is merge-ready. Nothing needed from you right now; weβll follow up here after validation. |
nettee
left a comment
There was a problem hiding this comment.
@JackChen-me I reviewed the BYOK OpenCode provider routing change and the updated daemon regression coverage. The split keeps api.openai.com on @ai-sdk/openai while moving non-OpenAI openai protocol hosts, including the corrected vLLM case, onto @ai-sdk/openai-compatible, which matches the existing product behavior and directly covers the DeepSeek 404 reported in #5338. Nice focused fix.
|
QA validation passed for PR #5344 at head e674e44.\n\nEvidence checked:\n- Focused daemon regression test passed: |
AmyShang-alt
left a comment
There was a problem hiding this comment.
Approved after QA validation. Automated checks passed, local PR runtime validation succeeded for official OpenAI BYOK, and non-OpenAI OpenAI-compatible BYOK via OpenRouter + deepseek/deepseek-chat succeeded.
π π‘ You just leveled up to Giotto
π Your contributions are sending a clear signal across the network: you care about making Open Design better. Keep transmitting. π Thanks for helping Open Design move forward. Keep building in the open. π π Rank #111 among 400+ contributors |

Fixes #5338
Why
Hit this myself using Open Design with a DeepSeek key: the built-in DeepSeek BYOK preset (Settings β Execution mode β BYOK) 404s on the first run. The daemon's OpenCode BYOK path maps protocol
openaistraight to@ai-sdk/openai, which calls the OpenAI Responses API ({baseURL}/responses). DeepSeek (and other OpenAI-compatible providers) only serve/chat/completions, so the request 404s. The web path already treats these as OpenAI-compatible viaisOpenAICompatible(...); the OpenCode path didn't, so the two disagreed. Full trace in #5338.What users will see
BYOK custom models on the
openaiprotocol pointed at a non-api.openai.comendpoint (the DeepSeek preset, vLLM, and other OpenAI-compatible chat-completions hosts) now work instead of failing withNot Found. Real OpenAI (api.openai.com) is unchanged.Surface area
openaiBYOK protocol, non-api.openai.comhosts now use@ai-sdk/openai-compatible(/chat/completions) instead of@ai-sdk/openai(/responses). This fixes DeepSeek and also switches vLLM / local OpenAI-compatible servers to the chat-completions package (which is what they actually serve).api.openai.comkeeps using@ai-sdk/openai.Screenshots
n/a β no UI.
Bug fix verification
apps/daemon/tests/runtimes/byok-opencode.test.tsβroutes OpenAI-protocol BYOK with a non-OpenAI base URL to the OpenAI-compatible provider packagemainand green on this branch? yes β onmainthe DeepSeek case returns@ai-sdk/openai; after the fix it returns@ai-sdk/openai-compatible. The existing vLLM test is updated to match (it is openai-compatible by nature β the test is even named that).Validation
Ran under Node 24 / pnpm 10.33.2:
pnpm --filter @open-design/daemon exec vitest run -c vitest.config.ts tests/runtimes/byok-opencode.test.tsβ 13/13 pass (new test red before the source change, green after).pnpm --filter @open-design/daemon run typecheckβ pass.pnpm guardβ 78/78 pass.Note:
connection-test.test.ts/chat-route.test.tshave a few pre-existing failures on a cleanmainin my local sandbox β flakywithFakeAgentprocess-spawn flows, unrelated to this change (which only affectsbuildProviderEntry's provider-package selection). Left to CI.Optional follow-ups (kept out of this PR for one-concern): (1) the proxy path normalizes DeepSeek to
/v1/chat/completions; this path resolves to/chat/completions(both are served by DeepSeek) β happy to add a/v1normalization for parity if preferred; (2) surfacing the actual failing request URL instead of a bareNot Found.