mirror of
https://github.com/coder/coder.git
synced 2026-06-06 06:28:20 +00:00
e9f0385198
## Summary Replace the "Premium" label with "AI Governance Add-On" and add a disclaimer that the AI Governance Add-On is required for AI Gateway and Agent Firewall as of Coder v2.32, across all AI Governance doc pages and their children. ## Changes **Label and requirement updates (7 files):** - `docs/ai-coder/ai-governance.md`: Removed "(Premium)" from title; updated GA section to state add-on required as of v2.32. - `docs/ai-coder/ai-gateway/setup.md`: "Premium license" → "AI Governance Add-On license". - `docs/ai-coder/ai-gateway/ai-gateway-proxy/setup.md`: "Premium license" → "AI Governance Add-On". - `docs/ai-coder/ai-gateway/clients/claude-code.md`: "(Premium feature)" → "(AI Governance Add-On)". - `docs/manifest.json`: `"state": ["premium"]` → `"state": ["ai governance add-on"]` for 4 nav entries. **Disclaimer added to all child pages (26 files):** AI Gateway pages (18): `index.md`, `setup.md`, `audit.md`, `monitoring.md`, `mcp.md`, `reference.md`, `ai-gateway-proxy/index.md`, `ai-gateway-proxy/setup.md`, `clients/index.md`, `clients/claude-code.md`, `clients/codex.md`, `clients/mux.md`, `clients/opencode.md`, `clients/factory.md`, `clients/cline.md`, `clients/kilo-code.md`, `clients/roo-code.md`, `clients/vscode.md`, `clients/jetbrains.md`, `clients/zed.md`, `clients/copilot.md` Agent Firewall pages (8): `index.md`, `version.md`, `landjail.md`, `rules-engine.md`, `nsjail/index.md`, `nsjail/docker.md`, `nsjail/k8s.md`, `nsjail/ecs.md` Other: `security.md` > [!NOTE] > The `"ai governance add-on"` state value in `manifest.json` is new. The docs site renderer may need to be updated to support this state value. > Generated by Coder Agents
91 lines
2.2 KiB
Markdown
91 lines
2.2 KiB
Markdown
# OpenCode
|
|
|
|
> [!NOTE]
|
|
> AI Gateway requires the [AI Governance Add-On](../../ai-governance.md).
|
|
> As of Coder v2.32, deployments without the add-on will not be able to
|
|
> access AI Gateway.
|
|
|
|
OpenCode supports both OpenAI and Anthropic models and can be configured to use AI Gateway by setting custom base URLs for each provider.
|
|
|
|
## Centralized API Key
|
|
|
|
You can configure OpenCode to connect to AI Gateway by setting the following configuration options in your OpenCode configuration file (e.g., `~/.config/opencode/opencode.json`):
|
|
|
|
```json
|
|
{
|
|
"$schema": "https://opencode.ai/config.json",
|
|
"provider": {
|
|
"anthropic": {
|
|
"options": {
|
|
"baseURL": "https://coder.example.com/api/v2/aibridge/anthropic/v1"
|
|
}
|
|
},
|
|
"openai": {
|
|
"options": {
|
|
"baseURL": "https://coder.example.com/api/v2/aibridge/openai/v1"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
To authenticate with AI Gateway, get your **[Coder API token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself)** and replace `<your-coder-api-token>` in `~/.local/share/opencode/auth.json`
|
|
|
|
```json
|
|
{
|
|
"anthropic": {
|
|
"type": "api",
|
|
"key": "<your-coder-api-token>"
|
|
},
|
|
"openai": {
|
|
"type": "api",
|
|
"key": "<your-coder-api-token>"
|
|
}
|
|
}
|
|
```
|
|
|
|
## BYOK (Personal API Key)
|
|
|
|
Set the following in `~/.config/opencode/opencode.json`, including the `X-Coder-AI-Governance-Token` header with your Coder API token:
|
|
|
|
```json
|
|
{
|
|
"$schema": "https://opencode.ai/config.json",
|
|
"provider": {
|
|
"anthropic": {
|
|
"options": {
|
|
"baseURL": "https://coder.example.com/api/v2/aibridge/anthropic/v1",
|
|
"headers": {
|
|
"X-Coder-AI-Governance-Token": "<your-coder-api-token>"
|
|
}
|
|
}
|
|
},
|
|
"openai": {
|
|
"options": {
|
|
"baseURL": "https://coder.example.com/api/v2/aibridge/openai/v1",
|
|
"headers": {
|
|
"X-Coder-AI-Governance-Token": "<your-coder-api-token>"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
Set your personal API keys in `~/.local/share/opencode/auth.json`:
|
|
|
|
```json
|
|
{
|
|
"anthropic": {
|
|
"type": "api",
|
|
"key": "<your-anthropic-api-key>"
|
|
},
|
|
"openai": {
|
|
"type": "api",
|
|
"key": "<your-openai-api-key>"
|
|
}
|
|
}
|
|
```
|
|
|
|
**References:** [OpenCode Documentation](https://opencode.ai/docs/providers/#config)
|