# VS Code

<Callout type="info" title="Note">
  AI Gateway is part of [AI Governance](/beta-docs/ai-coder/ai-governance/), which is
  included with a Premium license.
</Callout>

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 [#setup]

Requires VS Code 1.122+ and the [GitHub Copilot Chat extension](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat).

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 **Add** → **Custom Endpoint**.
3. Enter a **group name**, **display name*&#x2A;, your &#x2A;*[Coder API token](/beta-docs/admin/users/sessions-tokens/#generate-a-long-lived-api-token-on-behalf-of-yourself)** 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`.

<Callout type="idea" title="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.
</Callout>

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

### OpenAI-compatible models [#openai-compatible-models]

Set **API type** to `responses`.

```json
{
    "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/ai-gateway/openai",
            "toolCalling": true,
            "vision": true,
            "thinking": true,
            "streaming": true,
            "maxInputTokens": 272000,
            "maxOutputTokens": 128000
        }
    ]
}
```

### Anthropic models [#anthropic-models]

Set **API type** to `messages`.

```json
{
    "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/ai-gateway/anthropic",
            "toolCalling": true,
            "vision": true,
            "thinking": true,
            "streaming": true,
            "maxInputTokens": 1000000,
            "maxOutputTokens": 64000
        }
    ]
}
```

**References:** [VS Code - Bring your own language model](https://code.visualstudio.com/docs/copilot/customization/language-models)
