mirror of
https://github.com/coder/coder.git
synced 2026-11-01 21:13:14 +08:00
Updates the AI Gateway client docs under `docs/ai-coder/ai-gateway/clients/` to reference the latest module versions on registry.coder.com and removes mentions of Coder Tasks from those pages. Uses pessimistic (`~>`) version constraints so users automatically pick up compatible non-breaking updates within the same major. ### Version bumps | Module | Old | New | |---|---|---| | [`coder/claude-code`](https://registry.coder.com/modules/coder/claude-code) | `4.7.3` | `~> 5.2` (latest `5.2.0`) | | [`coder-labs/codex`](https://registry.coder.com/modules/coder-labs/codex) | `~> 5.0` | `~> 5.3` (latest `5.3.0`) | | [`coder/mux`](https://registry.coder.com/modules/coder/mux) | `~> 1.0` | `~> 1.5` (latest `1.5.0`) | ### Coder Tasks removal - `claude-code.md`: removed the *Coder Tasks* example block (v5 of the module is a major refactor that dropped the `ai_prompt` input and `task_app_id` output). - Remaining inputs in the example (`agent_id`, `workdir`, `enable_ai_gateway`) still match the latest module. - `codex.md` and `mux.md` did not reference Tasks, so only version bumps were needed there. cc @matifali --------- Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>
2.6 KiB
2.6 KiB
Claude Code
Note
AI Gateway is part of AI Governance, which is included with a Premium license.
Claude Code can be configured using environment variables. All modes require a Coder API token for authentication with AI Gateway.
Centralized API Key
# AI Gateway base URL.
export ANTHROPIC_BASE_URL="<your-deployment-url>/api/v2/ai-gateway/anthropic"
# Your Coder API token, used for authentication with AI Gateway.
export ANTHROPIC_AUTH_TOKEN="<your-coder-api-token>"
BYOK (Personal API Key)
# AI Gateway base URL.
export ANTHROPIC_BASE_URL="<your-deployment-url>/api/v2/ai-gateway/anthropic"
# Your personal Anthropic API key, forwarded to Anthropic.
export ANTHROPIC_API_KEY="<your-anthropic-api-key>"
# Your Coder API token, used for authentication with AI Gateway.
export ANTHROPIC_CUSTOM_HEADERS="X-Coder-AI-Governance-Token: <your-coder-api-token>"
# Ensure no auth token is set so Claude Code uses the API key instead.
unset ANTHROPIC_AUTH_TOKEN
BYOK (Claude Subscription)
# AI Gateway base URL.
export ANTHROPIC_BASE_URL="<your-deployment-url>/api/v2/ai-gateway/anthropic"
# Your Coder API token, used for authentication with AI Gateway.
export ANTHROPIC_CUSTOM_HEADERS="X-Coder-AI-Governance-Token: <your-coder-api-token>"
# Ensure no auth token is set so Claude Code uses subscription login instead.
unset ANTHROPIC_AUTH_TOKEN
When you run Claude Code, it will prompt you to log in with your Anthropic account.
Pre-configuring in Templates
Template admins can pre-configure Claude Code for a seamless experience. Admins can automatically inject the user's Coder session token and the AI Gateway base URL into the workspace environment.
module "claude-code" {
source = "registry.coder.com/coder/claude-code/coder"
version = "~> 5.2"
agent_id = coder_agent.main.id
workdir = "/path/to/project" # Set to your project directory
enable_ai_gateway = true
}
Visit the Claude Code module on the Coder Registry for the full list of inputs and outputs.
VS Code Extension
The Claude Code VS Code extension is also supported.
- If pre-configured in the workspace environment variables (as shown above), it typically respects them.
- You may need to sign in once; afterwards, it respects the workspace environment variables.
References: Claude Code Settings