From 823b14aa343f29d11392c6ccd02a1c6f43ca57d1 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Wed, 22 Oct 2025 18:55:54 +0500 Subject: [PATCH] docs: add base URLs and authentication section to AI Bridge (#20404) Co-authored-by: Danny Kopping --- docs/ai-coder/ai-bridge.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/ai-coder/ai-bridge.md b/docs/ai-coder/ai-bridge.md index 0a9ebeba81..c7cfbe7d85 100644 --- a/docs/ai-coder/ai-bridge.md +++ b/docs/ai-coder/ai-bridge.md @@ -81,6 +81,44 @@ Bridge is compatible with _[Google Vertex AI](https://cloud.google.com/vertex-ai > [!NOTE] > See [Supported APIs](#supported-apis) section below for a comprehensive list. +## Client Configuration + +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. + +### Setting Base URLs + +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/experimental/aibridge/openai/v1` +- **Anthropic-compatible clients**: Set the base URL (commonly via the `ANTHROPIC_BASE_URL` environment variable) to `https://coder.example.com/api/experimental/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 + +Users can generate a Coder API key using: + +```sh +coder tokens create +``` + +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. + +#### Compatibility Notes + +Most AI coding assistants that support custom base URLs can work with AI Bridge. However, client-specific configuration requirements vary: + +- Some clients require specific URL formats (e.g. try removing the `/v1` suffix) +- Some clients may proxy requests through their own servers, limiting compatibility (e.g. Cursor) +- Some clients may not support custom base URLs at all (e.g. Copilot CLI, Sourcegraph Amp) + +Consult your specific AI client's documentation for details on configuring custom API endpoints. + ## Collected Data Bridge collects: