VS Code

Note

AI Gateway requires the AI Governance Add-On. As of Coder v2.32, deployments without the add-on will not be able to access AI Gateway.

VS Code's native chat can be configured to use AI Gateway via the Custom Endpoint language model provider (VS Code 1.122+, Stable). GitHub sign-in is not required, so this works in air-gapped or restricted environments.

Setup

Requires VS Code 1.122+ and the GitHub Copilot Chat extension.

For each provider below, the setup steps are:

  1. Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P on Mac) and run Chat: Manage Language Models.
  2. Select AddCustom Endpoint.
  3. Enter a group name, display name, your Coder API token as the API key, and the API type shown below.
  4. To add or edit models, select the gear icon next to the provider in the Language Models view to open chatLanguageModels.json.

Important

Enter your API token through the UI. VS Code stores it securely and inserts a reference like ${input:chat.lm.secret.XXXXX} into the JSON. Do not paste your token directly into the JSON file.

Replace coder.example.com with your Coder deployment URL. Model IDs must match what is configured in your AI Gateway.

OpenAI-compatible models

Set API type to responses.

{ "name": "Coder (OpenAI)", "vendor": "customendpoint", "apiKey": "${input:chat.lm.secret.XXXXX}", "apiType": "responses", "models": [ { "id": "gpt-5.5", "name": "GPT 5.5", "url": "https://coder.example.com/api/v2/aibridge/openai", "toolCalling": true, "vision": true, "thinking": true, "streaming": true, "maxInputTokens": 272000, "maxOutputTokens": 128000 } ] }

Anthropic models

Set API type to messages.

{ "name": "Coder (Anthropic)", "vendor": "customendpoint", "apiKey": "${input:chat.lm.secret.XXXXX}", "apiType": "messages", "models": [ { "id": "claude-sonnet-4.6", "name": "Claude Sonnet 4.6", "url": "https://coder.example.com/api/v2/aibridge/anthropic", "toolCalling": true, "vision": true, "thinking": true, "streaming": true, "maxInputTokens": 1000000, "maxOutputTokens": 64000 } ] }

References: VS Code - Bring your own language model