|
| 1 | +#Client Configuration |
| 2 | + |
| 3 | +Once AI Bridge is enabled on the server, your users need to configure their AI coding tools to use it. This section explains how users should configure their clients to connect to AI Bridge. |
| 4 | + |
| 5 | +###Base URLs |
| 6 | + |
| 7 | +The exact configuration method varies by client — some use environment variables, others use configuration files or UI settings: |
| 8 | + |
| 9 | +-**OpenAI-compatible clients**: Set the base URL (commonly via the`OPENAI_BASE_URL` environment variable) to`https://coder.example.com/api/v2/aibridge/openai/v1` |
| 10 | +-**Anthropic-compatible clients**: Set the base URL (commonly via the`ANTHROPIC_BASE_URL` environment variable) to`https://coder.example.com/api/v2/aibridge/anthropic` |
| 11 | + |
| 12 | +Replace`coder.example.com` with your actual Coder deployment URL. |
| 13 | + |
| 14 | +###Authentication |
| 15 | + |
| 16 | +Instead of distributing provider-specific API keys (OpenAI/Anthropic keys) to users, they authenticate to AI Bridge using their**Coder session token** or**API key**: |
| 17 | + |
| 18 | +-**OpenAI clients**: Users set`OPENAI_API_KEY` to their Coder session token or API key |
| 19 | +-**Anthropic clients**: Users set`ANTHROPIC_API_KEY` to their Coder session token or API key |
| 20 | + |
| 21 | +####Coder Templates Pre-configuration |
| 22 | + |
| 23 | +Template admins can pre-configure authentication in templates using[`data.coder_workspace_owner.me.session_token`](https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/workspace_owner#session_token-1) to automatically configure the workspace owner's credentials. |
| 24 | + |
| 25 | +Here is an example of how to pre-configure a Coder template to install Claude Code and configure it for AI Bridge using the session token in a template: |
| 26 | + |
| 27 | +```hcl |
| 28 | +data "coder_workspace_owner" "me" {} |
| 29 | +
|
| 30 | +resource "coder_agent" "dev" { |
| 31 | + arch = "amd64" |
| 32 | + os = "linux" |
| 33 | + dir = local.repo_dir |
| 34 | + env = { |
| 35 | + ANTHROPIC_BASE_URL : "https://dev.coder.com/api/v2/aibridge/anthropic", |
| 36 | + ANTHROPIC_AUTH_TOKEN : data.coder_workspace_owner.me.session_token |
| 37 | + } |
| 38 | + ... # other agent configuration |
| 39 | +} |
| 40 | +
|
| 41 | +# See https://registry.coder.com/modules/coder/claude-code for more information |
| 42 | +module "claude-code" { |
| 43 | + count = local.has_ai_prompt ? data.coder_workspace.me.start_count : 0 |
| 44 | + source = "dev.registry.coder.com/coder/claude-code/coder" |
| 45 | + version = ">= 3.2.0" |
| 46 | + agent_id = coder_agent.dev.id |
| 47 | + workdir = "/home/coder/project" |
| 48 | + order = 999 |
| 49 | + claude_api_key = data.coder_workspace_owner.me.session_token # To Enable AI Bridge integration |
| 50 | + ai_prompt = data.coder_parameter.ai_prompt.value |
| 51 | + ... # other claude-code configuration |
| 52 | +} |
| 53 | +
|
| 54 | +``` |
| 55 | + |
| 56 | +The same approach can be applied to pre-configure additional AI coding assistants by updating the base URL and API key settings. |
| 57 | + |
| 58 | +####Generic API key generation |
| 59 | + |
| 60 | +Users can generate a Coder API key using either the CLI or the web UI. Follow the instructions at[Sessions and API tokens](../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself) to generate a Coder API key. |
| 61 | + |
| 62 | +###Tested clients |
| 63 | + |
| 64 | +The combinations below reflect what we have exercised so far. Use the upstream links for vendor-specific steps to point each client at Bridge. Share additional findings in the[`aibridge`](https://github.com/coder/aibridge) issue tracker so we can keep this table current. |
| 65 | + |
| 66 | +| Client| OpenAI support| Anthropic support| Notes| |
| 67 | +|-------------------------------------------------------------------------------------------------------------------------------------------|----------------|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 68 | +|[Claude Code](https://docs.claude.com/en/docs/claude-code/settings#environment-variables)| N/A| ✅| Works out of the box and can be preconfigured in templates.| |
| 69 | +| Claude Code (VS Code)| N/A| ✅| May require signing in once; afterwards respects workspace environment variables.| |
| 70 | +|[Cursor](https://cursor.com/docs/settings/api-keys)| ⚠️| ❌| Only non reasoning models like`gpt-4.1` are available when using a custom endpoint. Requests still transit Cursor's cloud. There is no central admin setting to configure this.| |
| 71 | +|[Roo Code](https://docs.roocode.com/features/api-configuration-profiles#creating-and-managing-profiles)| ✅| ✅| Use the**OpenAI Compatible** provider with the legacy format to avoid`/v1/responses`.| |
| 72 | +|[Codex CLI](https://github.com/openai/codex/blob/main/docs/config.md#model_providers)| ✅| N/A|`gpt-5-codex` support is[in progress](https://github.com/coder/aibridge/issues/16).| |
| 73 | +|[GitHub Copilot (VS Code)](https://docs.github.com/en/copilot/configuring-github-copilot/configuring-network-settings-for-github-copilot)| ✅| ❌| Requires the pre-release extension. Anthropic endpoints are not supported.| |
| 74 | +| Goose| ❓| ❓|| |
| 75 | +| Goose Desktop| ❓| ✅|| |
| 76 | +| WindSurf| ❌| —| No option to override the base URL.| |
| 77 | +| Sourcegraph Amp| ❌| —| No option to override the base URL.| |
| 78 | +| Kiro| ❌| —| No option to override the base URL.| |
| 79 | +|[Copilot CLI](https://github.com/github/copilot-cli/issues/104)| ❌| ❌| No support for custom base URLs and uses a`GITHUB_TOKEN` for authentication.| |
| 80 | +|[Kilo Code](https://kilocode.ai/docs/features/api-configuration-profiles#creating-and-managing-profiles)| ✅| ✅| Similar to Roo Code.| |
| 81 | +| Gemini CLI| ❌| ❌| Not supported yet (`GOOGLE_GEMINI_BASE_URL`).| |
| 82 | +|[Amazon Q CLI](https://aws.amazon.com/q/)| ❌| ❌| Limited to Amazon Q subscriptions; no custom endpoint support.| |
| 83 | + |
| 84 | +Legend: ✅ works, ⚠️ limited support, ❌ not supported, ❓ not yet verified, — not applicable. |
| 85 | + |
| 86 | +>[!NOTE] |
| 87 | +>Click the respective client title to view the vendor-specific instructions for configuring the client. |
| 88 | +
|
| 89 | +####Compatibility overview |
| 90 | + |
| 91 | +Most AI coding assistants that support custom base URLs can work with AI Bridge. Client-specific requirements vary: |
| 92 | + |
| 93 | +- Some clients require specific URL formats (for example, removing the`/v1` suffix). |
| 94 | +- Some clients proxy requests through their own servers, which limits compatibility. |
| 95 | +- Some clients do not support custom base URLs. |
| 96 | + |
| 97 | +See the[tested clients](#tested-clients) table above for the combinations we have verified and any known issues. |