mirror of
https://github.com/coder/coder.git
synced 2026-11-08 22:12:43 +08:00
## Summary Adds BYOK (Personal API Key) documentation for OpenCode. ## BYOK support | Client | Personal API Key | ChatGPT Subscription | Claude Subscription | |--------------|------------------|----------------------|---------------------| | Codex CLI | ✅ | ✅ | - | | Claude Code | ✅ | - | ✅ | | Mux | ? | ? | ? | | OpenCode | ✅ | ❌ | ❌ | | Factory | ✅ | ❌ | ❌ | | Cline | ✅ Only OpenAI API | ❌ | ❌ | | KiloCode | ❌ (client-side bug) | ❌ | ❌ | | RooCode | ✅ Only OpenAI API | ❌ | ❌ | | VSCode | ❌ | ❌ | ❌ | | JetBrains | ❌ | ❌ | ❌ | | Zed | ❌ | ❌ | ❌ | | Copilot CLI | ? | ? | ? | <details> <summary>Why OpenCode doesn't support subscriptions through AI Bridge</summary> **ChatGPT subscription**: OpenCode's codex plugin [hardcodes the upstream URL](https://github.com/anomalyco/opencode/blob/3a0e00dd7f9192730f6d0eeee37ae0a5fb023927/packages/opencode/src/plugin/codex.ts#L458-L460) to `https://chatgpt.com/backend-api/codex/responses` inside a custom `fetch`, bypassing any configured `baseURL`. **Claude subscription**: Anthropic [no longer supports](https://www.reddit.com/r/ClaudeAI/comments/1r9hqdk/claude_subscriptions_will_no_longer_be_usable_in/) using subscriptions in third-party clients. </details> ## Notes - Anthropic forbids Claude subscription in all 3rd-party clients - OpenCode supports ChatGPT subscription, but there is no way to customize BaseURL - Does it make sense to investigate Mux? - Factory doesn't support ChatGPT subscription - Cline supports ChatGPT subscription, but there is no way to customize BaseURL - KiloCode supports CustomHeaders, but I wasn't able to make it work neither for centralized key nor for BYOK. Seems support for custom providers has bugs. I got different errors for different models, this one is common: `Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.` Seems should be fixed on KiloCode side. - RooCode and Cline support only OpenAI. They have special OpenAI-Compatible provider which allows adding custom headers. - VSCode (NativeChat) uses github copilot under the hood. I wasn't able to make it work, neither in VSCode nor in VSCode-Insiders on my MacOS. I used VSCode-Insiders Version: 1.116.0-insider (Universal). I got different errors. When I used Github Copilot Chat (stable release - it ignored my AI Gateway configuration), when I tried to install Github Copilot Chat pre-release it failed with `~/.vscode-insiders/extensions/github.copilot-chat-0.43.2026040705` - JetBrains (embedded AI assistant). OpenAI Compatible provider doesn't support custom headers. Also I got some errors even for centralized key setup. - Zed doesn't support custom headers - Copilot CLI is special, because it's only supported via gateway proxy. But it also means that we don't need support of custom headers, because `X-AI-Gov-Token` is set by proxy itself. So if BYOK is supported in CopilotCLI - it should be supported for CopilotCLI via Bridge and BridgeProxy. ## Questions - Do we want to explicitly state that Claude Max/Pro or ChatGPT Plus/Pro subscriptions aren’t supported by OpenCode via AIBridge? I initially avoided mentioning it since this could change over time, and keeping that information up to date across clients might be difficult.
2.1 KiB
2.1 KiB
Roo Code
Roo Code allows you to configure providers via the UI and can be set up to use AI Gateway.
Configuration
Roo Code allows you to configure providers via the UI.
Centralized API Key
OpenAI Compatible
- Open Roo Code in VS Code.
- Go to Settings.
- Provider: Select OpenAI.
- Base URL: Enter
https://coder.example.com/api/v2/aibridge/openai/v1. - API Key: Enter your Coder Session Token.
- Model ID: Enter the model you wish to use (e.g.,
gpt-5.2-codex).
Anthropic
- Open Roo Code in VS Code.
- Go to Settings.
- Provider: Select Anthropic.
- Base URL: Enter
https://coder.example.com/api/v2/aibridge/anthropic. - API Key: Enter your Coder Session Token.
- Model ID: Select your desired Claude model.
Notes
- If you encounter issues with the OpenAI provider type, use OpenAI Compatible to ensure correct endpoint routing.
- Ensure your Coder deployment URL is reachable from your VS Code environment.
BYOK (Personal API Key)
OpenAI Compatible
- Open Roo Code in VS Code.
- Go to Settings.
- Provider: Select OpenAI Compatible.
- Base URL: Enter
https://coder.example.com/api/v2/aibridge/openai/v1. - API Key: Enter your personal OpenAI API key.
- Model ID: Enter the model you wish to use (e.g.,
gpt-4o). - Custom Headers: Add
X-Coder-AI-Governance-Tokenwith your Coder Session Token.
References: Roo Code Configuration Profiles

