diff --git a/docs/ai-coder/ai-bridge/client-config.md b/docs/ai-coder/ai-bridge/client-config.md deleted file mode 100644 index b09ee89707..0000000000 --- a/docs/ai-coder/ai-bridge/client-config.md +++ /dev/null @@ -1,147 +0,0 @@ -# Client Configuration - -Once AI Bridge is setup on your deployment, the AI coding tools used by your users will need to be configured to route requests via AI Bridge. - -## Base URLs - -Most AI coding tools allow the "base URL" to be customized. In other words, when a request is made to OpenAI's API from your coding tool, the API endpoint such as [`/v1/chat/completions`](https://platform.openai.com/docs/api-reference/chat) will be appended to the configured base. Therefore, instead of the default base URL of `https://api.openai.com/v1`, you'll need to set it to `https://coder.example.com/api/v2/aibridge/openai/v1`. - -The exact configuration method varies by client — some use environment variables, others use configuration files or UI settings: - -- **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` -- **Anthropic-compatible clients**: Set the base URL (commonly via the `ANTHROPIC_BASE_URL` environment variable) to `https://coder.example.com/api/v2/aibridge/anthropic` - -Replace `coder.example.com` with your actual Coder deployment URL. - -## Authentication - -Instead of distributing provider-specific API keys (OpenAI/Anthropic keys) to users, they authenticate to AI Bridge using their **Coder session token** or **Coder API key**: - -- **OpenAI clients**: Users set `OPENAI_API_KEY` to their Coder session token or Coder API key -- **Anthropic clients**: Users set `ANTHROPIC_API_KEY` to their Coder session token or Coder API key - -> [!NOTE] -> Only Coder-issued tokens are accepted at this time. -> Provider-specific API keys (such as OpenAI or Anthropic keys) will not work with AI Bridge. - -Again, the exact environment variable or setting naming may differ from tool to tool; consult your tool's documentation. - -### Retrieving your session token - -If you're logged in with the Coder CLI, you can retrieve your current session -token using [`coder login token`](../../reference/cli/login_token.md): - -```sh -export ANTHROPIC_API_KEY=$(coder login token) -export ANTHROPIC_BASE_URL="https://coder.example.com/api/v2/aibridge/anthropic" -``` - -## Configuring In-Workspace Tools - -AI coding tools running inside a Coder workspace, such as IDE extensions, can be configured to use AI Bridge. - -While users can manually configure these tools with a long-lived API key, template admins can provide a more seamless experience by pre-configuring them. Admins can automatically inject the user's session token with `data.coder_workspace_owner.me.session_token` and the AI Bridge base URL into the workspace environment. - -In this example, Claude code respects these environment variables and will route all requests via AI Bridge. - -This is the fastest way to bring existing agents like Roo Code, Cursor, or Claude Code into compliance without adopting Coder Tasks. - -```hcl -data "coder_workspace_owner" "me" {} - -data "coder_workspace" "me" {} - -resource "coder_agent" "dev" { - arch = "amd64" - os = "linux" - dir = local.repo_dir - env = { - ANTHROPIC_BASE_URL : "${data.coder_workspace.me.access_url}/api/v2/aibridge/anthropic", - ANTHROPIC_AUTH_TOKEN : data.coder_workspace_owner.me.session_token - } - ... # other agent configuration -} -``` - -### Using Coder Tasks - -Agents like Claude Code can be configured to route through AI Bridge in any template by pre-configuring the agent with the session token. [Coder Tasks](../tasks.md) is particularly useful for this pattern, providing a framework for agents to complete background development operations autonomously. To route agents through AI Bridge in a Coder Tasks template, pre-configure it to install Claude Code and configure it with the session token: - -```hcl -data "coder_workspace_owner" "me" {} - -data "coder_workspace" "me" {} - -data "coder_task" "me" {} - -resource "coder_agent" "dev" { - arch = "amd64" - os = "linux" - dir = local.repo_dir - env = { - ANTHROPIC_BASE_URL : "${data.coder_workspace.me.access_url}/api/v2/aibridge/anthropic", - ANTHROPIC_AUTH_TOKEN : data.coder_workspace_owner.me.session_token - } - ... # other agent configuration -} - -# See https://registry.coder.com/modules/coder/claude-code for more information -module "claude-code" { - count = data.coder_task.me.enabled ? data.coder_workspace.me.start_count : 0 - source = "dev.registry.coder.com/coder/claude-code/coder" - version = ">= 4.0.0" - agent_id = coder_agent.dev.id - workdir = "/home/coder/project" - claude_api_key = data.coder_workspace_owner.me.session_token # Use the Coder session token to authenticate with AI Bridge - ai_prompt = data.coder_task.me.prompt - ... # other claude-code configuration -} - -# The coder_ai_task resource associates the task to the app. -resource "coder_ai_task" "task" { - count = data.coder_task.me.enabled ? data.coder_workspace.me.start_count : 0 - app_id = module.claude-code[0].task_app_id -} -``` - -## External and Desktop Clients - -You can also configure AI tools running outside of a Coder workspace, such as local IDE extensions or desktop applications, to connect to AI Bridge. - -The configuration is the same: point the tool to the AI Bridge [base URL](#base-urls) and use a Coder API key for authentication. - -Users can generate a long-lived API key from the Coder UI or CLI. Follow the instructions at [Sessions and API tokens](../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself) to create one. - -## Compatibility - -The table below shows tested AI clients and their compatibility with AI Bridge. Click each client name for vendor-specific configuration instructions. Report issues or share compatibility updates in the [aibridge](https://github.com/coder/aibridge) issue tracker. - -| Client | OpenAI support | Anthropic support | Notes | -|-------------------------------------------------------------------------------------------------------------------------------------|----------------|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [Claude Code](https://docs.claude.com/en/docs/claude-code/settings#environment-variables) | - | ✅ | Works out of the box and can be preconfigured in templates. | -| Claude Code (VS Code) | - | ✅ | May require signing in once; afterwards respects workspace environment variables. | -| Cursor | ❌ | ❌ | Support dropped for `v1/chat/completions` endpoints; `v1/responses` support is in progress [#16](https://github.com/coder/aibridge/issues/16) | -| [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`. | -| [Codex CLI](https://github.com/openai/codex/blob/main/docs/config.md#model_providers) | ⚠️ | N/A | • Use v0.58.0 (`npm install -g @openai/codex@0.58.0`). Newer versions have a [bug](https://github.com/openai/codex/issues/8107) breaking the request payload.
• `gpt-5-codex` support is [in progress](https://github.com/coder/aibridge/issues/16). | -| [GitHub Copilot (VS Code)](https://code.visualstudio.com/docs/copilot/customization/language-models#_add-an-openaicompatible-model) | ✅ | ❌ | Requires the pre-release extension. Anthropic endpoints are not supported. | -| [Goose](https://block.github.io/goose/docs/getting-started/providers/#available-providers) | ❓ | ❓ | | -| [Goose Desktop](https://block.github.io/goose/docs/getting-started/providers/#available-providers) | ❓ | ✅ | | -| WindSurf | ❌ | ❌ | No option to override the base URL. | -| Sourcegraph Amp | ❌ | ❌ | No option to override the base URL. | -| Kiro | ❌ | ❌ | No option to override the base URL. | -| [Copilot CLI](https://github.com/github/copilot-cli/issues/104) | ❌ | ❌ | No support for custom base URLs and uses a `GITHUB_TOKEN` for authentication. | -| [Kilo Code](https://kilocode.ai/docs/ai-providers/openai-compatible) | ✅ | ✅ | Similar to Roo Code. | -| Gemini CLI | ❌ | ❌ | Not supported yet. | -| [Amazon Q CLI](https://aws.amazon.com/q/) | ❌ | ❌ | Limited to Amazon Q subscriptions; no custom endpoint support. | - -Legend: ✅ works, ⚠️ limited support, ❌ not supported, ❓ not yet verified, — not applicable. - -### Compatibility Overview - -Most AI coding assistants can use AI Bridge, provided they support custom base URLs. Client-specific requirements vary: - -- Some clients require specific URL formats (for example, removing the `/v1` suffix). -- Some clients proxy requests through their own servers, which limits compatibility. -- Some clients do not support custom base URLs. - -See the table in the [compatibility](#compatibility) section above for the combinations we have verified and any known issues. diff --git a/docs/ai-coder/ai-bridge/clients/claude-code.md b/docs/ai-coder/ai-bridge/clients/claude-code.md new file mode 100644 index 0000000000..fb2dde9be4 --- /dev/null +++ b/docs/ai-coder/ai-bridge/clients/claude-code.md @@ -0,0 +1,55 @@ +# Claude Code + +## Configuration + +Claude Code can be configured using environment variables. + +* **Base URL**: `ANTHROPIC_BASE_URL` should point to `https://coder.example.com/api/v2/aibridge/anthropic` +* **API Key**: `ANTHROPIC_API_KEY` should be your [Coder session token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself). + +### 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 Bridge base URL into the workspace environment. + +```hcl +module "claude-code" { + source = "registry.coder.com/coder/claude-code/coder" + version = "4.7.3" + agent_id = coder_agent.main.id + workdir = "/path/to/project" # Set to your project directory + enable_aibridge = true +} +``` + +### Coder Tasks + +[Coder Tasks](../../tasks.md) provides a framework for agents to complete background development operations autonomously. Claude Code can be configured in your Tasks automatically: + +```hcl +resource "coder_ai_task" "task" { + count = data.coder_workspace.me.start_count + app_id = module.claude-code.task_app_id +} + +data "coder_task" "me" {} + +module "claude-code" { + source = "registry.coder.com/coder/claude-code/coder" + version = "4.7.3" + agent_id = coder_agent.main.id + workdir = "/path/to/project" # Set to your project directory + ai_prompt = data.coder_task.me.prompt + + # Route through AI Bridge (Premium feature) + enable_aibridge = true +} +``` + +## VS Code Extension + +The Claude Code VS Code extension is also supported. + +1. If pre-configured in the workspace environment variables (as shown above), it typically respects them. +2. You may need to sign in once; afterwards, it respects the workspace environment variables. + +**References:** [Claude Code Settings](https://docs.claude.com/en/docs/claude-code/settings#environment-variables) diff --git a/docs/ai-coder/ai-bridge/clients/cline.md b/docs/ai-coder/ai-bridge/clients/cline.md new file mode 100644 index 0000000000..0fe48d4edd --- /dev/null +++ b/docs/ai-coder/ai-bridge/clients/cline.md @@ -0,0 +1,36 @@ +# Cline + +Cline supports both OpenAI and Anthropic models and can be configured to use AI Bridge by setting providers. + +## Configuration + +To configure Cline to use AI Bridge, follow these steps: +![Cline Settings](../../../images/aibridge/clients/cline-setup.png) + +
+ +### OpenAI Compatible + +1. Open Cline in VS Code. +1. Go to **Settings**. +1. **API Provider**: Select **OpenAI Compatible**. +1. **Base URL**: Enter `https://coder.example.com/api/v2/aibridge/openai/v1`. +1. **OpenAI Compatible API Key**: Enter your **[Coder Session Token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself)**. +1. **Model ID** (Optional): Enter the model you wish to use (e.g., `gpt-5.2-codex`). + +![Cline OpenAI Settings](../../../images/aibridge/clients/cline-openai.png) + +### Anthropic + +1. Open Cline in VS Code. +1. Go to **Settings**. +1. **API Provider**: Select **Anthropic**. +1. **Anthropic API Key**: Enter your **Coder Session Token**. +1. **Base URL**: Enter `https://coder.example.com/api/v2/aibridge/anthropic` after checking **_Use custom base URL_**. +1. **Model ID** (Optional): Select your desired Claude model. + +![Cline Anthropic Settings](../../../images/aibridge/clients/cline-anthropic.png) + +
+ +**References:** [Cline Configuration](https://github.com/cline/cline) diff --git a/docs/ai-coder/ai-bridge/clients/codex.md b/docs/ai-coder/ai-bridge/clients/codex.md new file mode 100644 index 0000000000..addff83f58 --- /dev/null +++ b/docs/ai-coder/ai-bridge/clients/codex.md @@ -0,0 +1,50 @@ +# Codex CLI + +Codex CLI can be configured to use AI Bridge by setting up a custom model provider. + +## Configuration + +> [!NOTE] +> When running Codex CLI inside a Coder workspace, use the configuration below to route requests through AI Bridge. + +To configure Codex CLI to use AI Bridge, set the following configuration options in your Codex configuration file (e.g., `~/.codex/config.toml`): + +```toml +[model_providers.aibridge] +name = "AI Bridge" +base_url = "${data.coder_workspace.me.access_url}/api/v2/aibridge/openai/v1" +env_key = "OPENAI_API_KEY" +wire_api = "responses" + +[profiles.aibridge] +model_provider = "aibridge" +model = "gpt-5.2-codex" +``` + +Run Codex with the `aibridge` profile: + +```bash +codex --profile aibridge +``` + +If configuring within a Coder workspace, you can also use the [Codex CLI](https://registry.coder.com/modules/coder-labs/codex) module and set the following variables: + +```tf +module "codex" { + source = "registry.coder.com/coder-labs/codex/coder" + version = "~> 4.1" + agent_id = coder_agent.main.id + workdir = "/path/to/project" # Set to your project directory + enable_aibridge = true +} +``` + +## Authentication + +To authenticate with AI Bridge, get your **[Coder session token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself)** and set it in your environment: + +```bash +export OPENAI_API_KEY="" +``` + +**References:** [Codex CLI Configuration](https://developers.openai.com/codex/config-advanced) diff --git a/docs/ai-coder/ai-bridge/clients/factory.md b/docs/ai-coder/ai-bridge/clients/factory.md new file mode 100644 index 0000000000..2a941ee9ae --- /dev/null +++ b/docs/ai-coder/ai-bridge/clients/factory.md @@ -0,0 +1,35 @@ +# Factory + +Factort's Droid agent can be configured to use AI Bridge by setting up custom models for OpenAI and Anthropic. + +## Configuration + +1. Open `~/.factory/settings.json` (create it if it does not exist). +2. Add a `customModels` entry for each provider you want to use with AI Bridge. +3. Replace `coder.example.com` with your Coder deployment URL. +4. Use a **[Coder session token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself)** for `apiKey`. + +```json +{ + "customModels": [ + { + "model": "claude-4-5-opus", + "displayName": "Claude (Coder AI Bridge)", + "baseUrl": "https://coder.example.com/api/v2/aibridge/anthropic", + "apiKey": "", + "provider": "anthropic", + "maxOutputTokens": 8192 + }, + { + "model": "gpt-5.2-codex", + "displayName": "GPT (Coder AI Bridge)", + "baseUrl": "https://coder.example.com/api/v2/aibridge/openai/v1", + "apiKey": "", + "provider": "openai", + "maxOutputTokens": 16384 + } + ] +} +``` + +**References:** [Factory BYOK OpenAI & Anthropic](https://docs.factory.ai/cli/byok/openai-anthropic) diff --git a/docs/ai-coder/ai-bridge/clients/index.md b/docs/ai-coder/ai-bridge/clients/index.md new file mode 100644 index 0000000000..5d8e532395 --- /dev/null +++ b/docs/ai-coder/ai-bridge/clients/index.md @@ -0,0 +1,99 @@ +# Client Configuration + +Once AI Bridge is setup on your deployment, the AI coding tools used by your users will need to be configured to route requests via AI Bridge. + +## Base URLs + +Most AI coding tools allow the "base URL" to be customized. In other words, when a request is made to OpenAI's API from your coding tool, the API endpoint such as [`/v1/chat/completions`](https://platform.openai.com/docs/api-reference/chat) will be appended to the configured base. Therefore, instead of the default base URL of `https://api.openai.com/v1`, you'll need to set it to `https://coder.example.com/api/v2/aibridge/openai/v1`. + +The exact configuration method varies by client — some use environment variables, others use configuration files or UI settings: + +- **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` +- **Anthropic-compatible clients**: Set the base URL (commonly via the `ANTHROPIC_BASE_URL` environment variable) to `https://coder.example.com/api/v2/aibridge/anthropic` + +Replace `coder.example.com` with your actual Coder deployment URL. + +## Authentication + +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**: + +- **OpenAI clients**: Users set `OPENAI_API_KEY` to their Coder session token or API key +- **Anthropic clients**: Users set `ANTHROPIC_API_KEY` to their Coder session token or API key + +> [!NOTE] +> Only Coder-issued tokens can authenticate users against AI Bridge. +> AI Bridge will use provider-specific API keys to [authenticate against upstream AI services](https://coder.com/docs/ai-coder/ai-bridge/setup#configure-providers). + +Again, the exact environment variable or setting naming may differ from tool to tool. See a list of [supported clients](#all-supported-clients) below and consult your tool's documentation for details. + +### Retrieving your session token + +[Generate a long-lived API token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself) via the Coder dashboard and use it to configure your AI coding tool: + +```sh +export ANTHROPIC_API_KEY="your-coder-session-token" +export ANTHROPIC_BASE_URL="https://coder.example.com/api/v2/aibridge/anthropic" +``` + +## Compatibility + +The table below shows tested AI clients and their compatibility with AI Bridge. + +| Client | OpenAI | Anthropic | Notes | +|----------------------------------|--------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------| +| [Claude Code](./claude-code.md) | - | ✅ | | +| [Codex CLI](./codex.md) | ✅ | - | | +| [OpenCode](./opencode.md) | ✅ | ✅ | | +| [Factory](./factory.md) | ✅ | ✅ | | +| [Cline](./cline.md) | ✅ | ✅ | | +| [Kilo Code](./kilo-code.md) | ✅ | ✅ | | +| [Roo Code](./roo-code.md) | ✅ | ✅ | | +| [VS Code](./vscode.md) | ✅ | ❌ | Only supports Custom Base URL for OpenAI. | +| [JetBrains IDEs](./jetbrains.md) | ✅ | ❌ | Works in Chat mode via "Bring Your Own Key". | +| [Zed](./zed.md) | ✅ | ✅ | | +| WindSurf | ❌ | ❌ | No option to override base URL. | +| Cursor | ❌ | ❌ | Override for OpenAI broken ([upstream issue](https://forum.cursor.com/t/requests-are-sent-to-incorrect-endpoint-when-using-base-url-override/144894)). | +| Sourcegraph Amp | ❌ | ❌ | No option to override base URL. | +| Kiro | ❌ | ❌ | No option to override base URL. | +| Gemini CLI | ❌ | ❌ | No Gemini API support. Upvote [this issue](https://github.com/coder/aibridge/issues/27). | +| Antigravity | ❌ | ❌ | No option to override base URL. | +| + +*Legend: ✅ supported, ❌ not supported, - not applicable.* + +## Configuring In-Workspace Tools + +AI coding tools running inside a Coder workspace, such as IDE extensions, can be configured to use AI Bridge. + +While users can manually configure these tools with a long-lived API key, template admins can provide a more seamless experience by pre-configuring them. Admins can automatically inject the user's session token with `data.coder_workspace_owner.me.session_token` and the AI Bridge base URL into the workspace environment. + +In this example, Claude Code respects these environment variables and will route all requests via AI Bridge. + +```hcl +data "coder_workspace_owner" "me" {} + +data "coder_workspace" "me" {} + +resource "coder_agent" "dev" { + arch = "amd64" + os = "linux" + dir = local.repo_dir + env = { + ANTHROPIC_BASE_URL : "${data.coder_workspace.me.access_url}/api/v2/aibridge/anthropic", + ANTHROPIC_AUTH_TOKEN : data.coder_workspace_owner.me.session_token + } + ... # other agent configuration +} +``` + +## External and Desktop Clients + +You can also configure AI tools running outside of a Coder workspace, such as local IDE extensions or desktop applications, to connect to AI Bridge. + +The configuration is the same: point the tool to the AI Bridge [base URL](#base-urls) and use a Coder API key for authentication. + +Users can generate a long-lived API key from the Coder UI or CLI. Follow the instructions at [Sessions and API tokens](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself) to create one. + +## All Supported Clients + + diff --git a/docs/ai-coder/ai-bridge/clients/jetbrains.md b/docs/ai-coder/ai-bridge/clients/jetbrains.md new file mode 100644 index 0000000000..90935d03eb --- /dev/null +++ b/docs/ai-coder/ai-bridge/clients/jetbrains.md @@ -0,0 +1,35 @@ +# JetBrains IDEs + +JetBrains IDE (IntelliJ IDEA, PyCharm, WebStorm, etc.) support AI Bridge via the ["Bring Your Own Key" (BYOK)](https://www.jetbrains.com/help/ai-assistant/use-custom-models.html#provide-your-own-api-key) feature. + +## Prerequisites + +* [**JetBrains AI Assistant**](https://www.jetbrains.com/help/ai-assistant/installation-guide-ai-assistant.html): Installed and enabled. +* **Authentication**: Your **[Coder session token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself)**. + +## Configuration + +1. **Open Settings**: Go to **Settings** > **Tools** > **AI Assistant** > **Models & API Keys**. +1. **Configure Provider**: Go to **Third-party AI providers**. +1. **Choose Provider**: Choose **OpenAI-compatible**. +1. **URL**: `https://coder.example.com/api/v2/aibridge/openai/v1` +1. **API Key**: Paste your **[Coder session token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself)**. +1. **Apply**: Click **Apply** and **OK**. + +![JetBrains AI Assistant Settings](../../../images/aibridge/clients/jetbrains-ai-settings.png) + +## Using the AI Assistant + +1. Go back to **AI Chat** on theleft side bar and choose **Chat**. +1. In the Model dropdown, select the desired model (e.g., `gpt-5.2`). + +![JetBrains AI Assistant Chat](../../../images/aibridge/clients/jetbrains-ai-chat.png) + +You can now use the AI Assistant chat with the configured provider. + +> [!NOTE] +> +> * JetBrains AI Assistant currently only supports OpenAI-compatible endpoints. There is an open [issue](https://youtrack.jetbrains.com/issue/LLM-22740) tracking support for Anthropic. +> * JetBrains AI Assistant may not support all models that support OPenAI's `/chat/completions` endpoint in Chat mode. + +**References:** [Use custom models with JetBrains AI Assistant](https://www.jetbrains.com/help/ai-assistant/use-custom-models.html#provide-your-own-api-key) diff --git a/docs/ai-coder/ai-bridge/clients/kilo-code.md b/docs/ai-coder/ai-bridge/clients/kilo-code.md new file mode 100644 index 0000000000..c940060b45 --- /dev/null +++ b/docs/ai-coder/ai-bridge/clients/kilo-code.md @@ -0,0 +1,33 @@ +# Kilo Code + +Kilo Code allows you to configure providers via the UI and can be set up to use AI Bridge. + +## Configuration + +
+ +### OpenAI Compatible + +1. Open Kilo Code in VS Code. +1. Go to **Settings**. +1. **Provider**: Select **OpenAI**. +1. **Base URL**: Enter `https://coder.example.com/api/v2/aibridge/openai/v1`. +1. **API Key**: Enter your **[Coder Session Token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself)**. +1. **Model ID**: Enter the model you wish to use (e.g., `gpt-5.2-codex`). + +![Kilo Code OpenAI Settings](../../../images/aibridge/clients/kilo-code-openai.png) + +### Anthropic + +1. Open Kilo Code in VS Code. +1. Go to **Settings**. +1. **Provider**: Select **Anthropic**. +1. **Base URL**: Enter `https://coder.example.com/api/v2/aibridge/anthropic`. +1. **API Key**: Enter your **Coder Session Token**. +1. **Model ID**: Select your desired Claude model. + +![Kilo Code Anthropic Settings](../../../images/aibridge/clients/kilo-code-anthropic.png) + +
+ +**References:** [Kilo Code Configuration](https://kilocode.ai/docs/ai-providers/openai-compatible) diff --git a/docs/ai-coder/ai-bridge/clients/opencode.md b/docs/ai-coder/ai-bridge/clients/opencode.md new file mode 100644 index 0000000000..f9487e4eff --- /dev/null +++ b/docs/ai-coder/ai-bridge/clients/opencode.md @@ -0,0 +1,44 @@ +# OpenCode + +OpenCode supports both OpenAI and Anthropic models and can be configured to use AI Bridge by setting custom base URLs for each provider. + +## Configuration + +You can configure OpenCode to connect to AI Bridge 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" + } + } + } +} +``` + +## Authentication + +To authenticate with AI Bridge, get your **[Coder session token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself)** and replace `` in `~/.local/share/opencode/auth.json` + +```json +{ + "anthropic": { + "type": "api", + "key": "" + }, + "openai": { + "type": "api", + "key": "" + } +} +``` + +**References:** [OpenCode Documentation](https://opencode.ai/docs/providers/#config) diff --git a/docs/ai-coder/ai-bridge/clients/roo-code.md b/docs/ai-coder/ai-bridge/clients/roo-code.md new file mode 100644 index 0000000000..66749d121e --- /dev/null +++ b/docs/ai-coder/ai-bridge/clients/roo-code.md @@ -0,0 +1,39 @@ +# Roo Code + +Roo Code allows you to configure providers via the UI and can be set up to use AI Bridge. + +## Configuration + +Roo Code allows you to configure providers via the UI. + +
+ +### OpenAI Compatible + +1. Open Roo Code in VS Code. +1. Go to **Settings**. +1. **Provider**: Select **OpenAI**. +1. **Base URL**: Enter `https://coder.example.com/api/v2/aibridge/openai/v1`. +1. **API Key**: Enter your **[Coder Session Token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself)**. +1. **Model ID**: Enter the model you wish to use (e.g., `gpt-5.2-codex`). +![Roo Code OpenAI Settings](../../../images/aibridge/clients/roo-code-openai.png) + +### Anthropic + +1. Open Roo Code in VS Code. +1. Go to **Settings**. +1. **Provider**: Select **Anthropic**. +1. **Base URL**: Enter `https://coder.example.com/api/v2/aibridge/anthropic`. +1. **API Key**: Enter your **Coder Session Token**. +1. **Model ID**: Select your desired Claude model. + +![Roo Code Anthropic Settings](../../../images/aibridge/clients/roo-code-anthropic.png) + +
+ +### 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. + +**References:** [Roo Code Configuration Profiles](https://docs.roocode.com/features/api-configuration-profiles#creating-and-managing-profiles) diff --git a/docs/ai-coder/ai-bridge/clients/vscode.md b/docs/ai-coder/ai-bridge/clients/vscode.md new file mode 100644 index 0000000000..279709b98c --- /dev/null +++ b/docs/ai-coder/ai-bridge/clients/vscode.md @@ -0,0 +1,50 @@ +# VS Code + +VS Code's native chat can be configured to use AI Bridge with the GitHub Copilot Chat extension's custom language model support. + +## Configuration + +> [!IMPORTANT] +> You need the **Pre-release** version of the [GitHub Copilot Chat extension](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) and [VS Code Insiders](https://code.visualstudio.com/insiders/). + +1. Open command palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and search for _Chat: Open Language Models (JSON)_. +1. Paste the following JSON configuration, replacing `` with your **[Coder Session Token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself)**: + +```json +[ + { + "name": "Coder", + "vendor": "customoai", + "apiKey": "your-coder-session-token>", + "models": [ + { + "name": "GPT 5.2", + "url": "https://coder.example.com/api/v2/aibridge/openai/v1/chat/completions", + "toolCalling": true, + "vision": true, + "thinking": true, + "maxInputTokens": 272000, + "maxOutputTokens": 128000, + "id": "gpt-5.2" + }, + { + "name": "GPT 5.2 Codex", + "url": "https://coder.example.com/api/v2/aibridge/openai/v1/responses", + "toolCalling": true, + "vision": true, + "thinking": true, + "maxInputTokens": 272000, + "maxOutputTokens": 128000, + "id": "gpt-5.2-codex" + } + ] + } +] +``` + +_Replace `coder.example.com` with your Coder deployment URL._ + +> [!NOTE] +> The setting names may change as the feature moves from pre-release to stable. Refer to the official documentation for the latest setting keys. + +**References:** [GitHub Copilot - Bring your own language model](https://code.visualstudio.com/docs/copilot/customization/language-models#_add-an-openaicompatible-model) diff --git a/docs/ai-coder/ai-bridge/clients/zed.md b/docs/ai-coder/ai-bridge/clients/zed.md new file mode 100644 index 0000000000..1cfb8795f1 --- /dev/null +++ b/docs/ai-coder/ai-bridge/clients/zed.md @@ -0,0 +1,63 @@ +# Zed + +Zed IDE supports AI Bridge via its `language_models` configuration in `settings.json`. + +## Configuration + +To configure Zed to use AI Bridge, you need to edit your `settings.json` file. You can access this by pressing `Cmd/Ctrl + ,` or opening the command palette and searching for "Open Settings". + +You can configure both Anthropic and OpenAI providers to point to AI Bridge. + +```json +{ + "language_models": { + "anthropic": { + "api_url": "https://coder.example.com/api/v2/aibridge/anthropic", + }, + "openai": { + "api_url": "https://coder.example.com/api/v2/aibridge/openai/v1", + }, + }, + // optional settings to set favorite models for the AI + "agent": { + "favorite_models": [ + { + "provider": "anthropic", + "model": "claude-sonnet-4-5-thinking-latest" + }, + { + "provider": "openai", + "model": "gpt-5.2-codex" + } + ], + }, +} +``` + +*Replace `coder.example.com` with your Coder deployment URL.* + +> [!NOTE] +> These settings and environment variables need to be configured from client side. Zed currently does not support reading these settings from remote configuration. See this [feature request](https://github.com/zed-industries/zed/discussions/47058) for more details. + +## Authentication + +Zed requires an API key for these providers. For AI Bridge, this key is your **[Coder Session Token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself)**. + +You can set this in two ways: + +
+ +### Zed UI + +1. Open the **Assistant Panel** (right sidebar). +1. Click **Configuration** or the settings icon. +1. Select your provider ("Anthropic" or "OpenAI"). +1. Paste your **[Coder Session Token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself)** for the API Key. + +### Environment Variables + +1. Set `ANTHROPIC_API_KEY` and `OPENAI_API_KEY` to your **[Coder Session Token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself)** in the environment where you launch Zed. + +
+ +**References:** [Configuring Zed - Language Models](https://zed.dev/docs/reference/all-settings#language-models) diff --git a/docs/ai-coder/ai-bridge/index.md b/docs/ai-coder/ai-bridge/index.md index db3d4e5933..22a55416cd 100644 --- a/docs/ai-coder/ai-bridge/index.md +++ b/docs/ai-coder/ai-bridge/index.md @@ -33,7 +33,9 @@ AI Bridge is best suited for organizations facing these centralized management a ## Next steps - [Set up AI Bridge](./setup.md) on your Coder deployment -- [Configure AI clients](./client-config.md) to use AI Bridge +- [Configure AI clients](./clients/index.md) to use AI Bridge - [Configure MCP servers](./mcp.md) for tool access - [Monitor usage and metrics](./monitoring.md) and [configure data retention](./setup.md#data-retention) - [Reference documentation](./reference.md) + + diff --git a/docs/ai-coder/ai-bridge/reference.md b/docs/ai-coder/ai-bridge/reference.md index 3401e88437..398eb9a8ca 100644 --- a/docs/ai-coder/ai-bridge/reference.md +++ b/docs/ai-coder/ai-bridge/reference.md @@ -20,11 +20,11 @@ Where relevant, both streaming and non-streaming requests are supported. #### Intercepted - [`/v1/chat/completions`](https://platform.openai.com/docs/api-reference/chat/create) +- [`/v1/responses`](https://platform.openai.com/docs/api-reference/responses/create) #### Passthrough - [`/v1/models(/*)`](https://platform.openai.com/docs/api-reference/models/list) -- [`/v1/responses`](https://platform.openai.com/docs/api-reference/responses/create) _(Interception support coming in **Beta**)_ ### Anthropic diff --git a/docs/images/aibridge/clients/cline-anthropic.png b/docs/images/aibridge/clients/cline-anthropic.png new file mode 100644 index 0000000000..cfe2bb6ebd Binary files /dev/null and b/docs/images/aibridge/clients/cline-anthropic.png differ diff --git a/docs/images/aibridge/clients/cline-openai.png b/docs/images/aibridge/clients/cline-openai.png new file mode 100644 index 0000000000..f49ccd51de Binary files /dev/null and b/docs/images/aibridge/clients/cline-openai.png differ diff --git a/docs/images/aibridge/clients/cline-setup.png b/docs/images/aibridge/clients/cline-setup.png new file mode 100644 index 0000000000..9180d3661f Binary files /dev/null and b/docs/images/aibridge/clients/cline-setup.png differ diff --git a/docs/images/aibridge/clients/jetbrains-ai-chat.png b/docs/images/aibridge/clients/jetbrains-ai-chat.png new file mode 100644 index 0000000000..d8badd7935 Binary files /dev/null and b/docs/images/aibridge/clients/jetbrains-ai-chat.png differ diff --git a/docs/images/aibridge/clients/jetbrains-ai-settings.png b/docs/images/aibridge/clients/jetbrains-ai-settings.png new file mode 100644 index 0000000000..982c403eb7 Binary files /dev/null and b/docs/images/aibridge/clients/jetbrains-ai-settings.png differ diff --git a/docs/images/aibridge/clients/kilo-code-anthropic.png b/docs/images/aibridge/clients/kilo-code-anthropic.png new file mode 100644 index 0000000000..0423af2516 Binary files /dev/null and b/docs/images/aibridge/clients/kilo-code-anthropic.png differ diff --git a/docs/images/aibridge/clients/kilo-code-openai.png b/docs/images/aibridge/clients/kilo-code-openai.png new file mode 100644 index 0000000000..98c5b065d9 Binary files /dev/null and b/docs/images/aibridge/clients/kilo-code-openai.png differ diff --git a/docs/images/aibridge/clients/roo-code-anthropic.png b/docs/images/aibridge/clients/roo-code-anthropic.png new file mode 100644 index 0000000000..db3829acb8 Binary files /dev/null and b/docs/images/aibridge/clients/roo-code-anthropic.png differ diff --git a/docs/images/aibridge/clients/roo-code-openai.png b/docs/images/aibridge/clients/roo-code-openai.png new file mode 100644 index 0000000000..1f6ef0e57f Binary files /dev/null and b/docs/images/aibridge/clients/roo-code-openai.png differ diff --git a/docs/manifest.json b/docs/manifest.json index 94eeeea84f..8c6f01d887 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1025,7 +1025,7 @@ "description": "AI Gateway for Enterprise Governance \u0026 Observability", "path": "./ai-coder/ai-bridge/index.md", "icon_path": "./images/icons/api.svg", - "state": ["premium", "beta"], + "state": ["premium"], "children": [ { "title": "Setup", @@ -1035,7 +1035,59 @@ { "title": "Client Configuration", "description": "How to configure your AI coding tools to use AI Bridge", - "path": "./ai-coder/ai-bridge/client-config.md" + "path": "./ai-coder/ai-bridge/clients/index.md", + "children": [ + { + "title": "Claude Code", + "description": "Configure Claude Code to use AI Bridge", + "path": "./ai-coder/ai-bridge/clients/claude-code.md" + }, + { + "title": "Codex", + "description": "Configure Codex to use AI Bridge", + "path": "./ai-coder/ai-bridge/clients/codex.md" + }, + { + "title": "OpenCode", + "description": "Configure OpenCode to use AI Bridge", + "path": "./ai-coder/ai-bridge/clients/opencode.md" + }, + { + "title": "Factory", + "description": "Configure Factory to use AI Bridge", + "path": "./ai-coder/ai-bridge/clients/factory.md" + }, + { + "title": "Cline", + "description": "Configure Cline to use AI Bridge", + "path": "./ai-coder/ai-bridge/clients/cline.md" + }, + { + "title": "Kilo Code", + "description": "Configure Kilo Code to use AI Bridge", + "path": "./ai-coder/ai-bridge/clients/kilo-code.md" + }, + { + "title": "Roo Code", + "description": "Configure Roo Code to use AI Bridge", + "path": "./ai-coder/ai-bridge/clients/roo-code.md" + }, + { + "title": "VS Code", + "description": "Configure VS Code to use AI Bridge", + "path": "./ai-coder/ai-bridge/clients/vscode.md" + }, + { + "title": "JetBrains", + "description": "Configure JetBrains IDEs to use AI Bridge", + "path": "./ai-coder/ai-bridge/clients/jetbrains.md" + }, + { + "title": "Zed", + "description": "Configure Zed to use AI Bridge", + "path": "./ai-coder/ai-bridge/clients/zed.md" + } + ] }, { "title": "MCP Tools Injection",