Visual Studio Code
The Tetrate Agent Router Model Provider extension registers Agent Router as a language model provider in Visual Studio Code. One API key brings every chat model the key can reach into VS Code chat, agent mode, and any extension that selects models through the vscode.lm API.
Persona: Developer adding Agent Router models to a local Visual Studio Code install.
Estimated time: 5 minutes, plus time to pick the models to enable.
Outcomes
By the end of this guide:
- The Tetrate Agent Router Model Provider extension is installed and holds an Agent Router API key in secret storage.
- The chosen models appear in the VS Code chat model picker and in agent mode.
- Other extensions can select the same models through the
vscode.lmAPI. - The base URL points at the hosted service, an Enterprise tenant, or a self-hosted deployment as required.
Why a provider extension
VS Code can already call an OpenAI-compatible endpoint through its built-in custom endpoint support (Bring Your Own Key, or BYOK), but that path serves only the chat view. Models configured that way are not offered to other extensions through the vscode.lm API, so each model-consuming extension falls back to asking for its own provider key.
The extension registers as a language model chat provider instead, under the vendor id tetrate-agent-router. A single Agent Router key then serves:
- The chat view and agent mode
- Any third-party extension that selects models through
vscode.lm - Anthropic, OpenAI, Google, xAI, Groq, and DeepInfra models behind a single endpoint and a single bill
Models are discovered from the endpoint at runtime, so newly released models appear in the picker without an extension update. Tetrate Agent Router: Refresh Model List forces a re-query on demand.
Requirements
| Requirement | Detail |
|---|---|
| VS Code | 1.106 or newer |
| API key | An Agent Router API key from the Console |
| Network | Outbound HTTPS to the configured base URL, and to router.tetrate.ai for model metadata |
Setup
Extension-contributed models start out hidden in the VS Code chat model picker. An installed extension with a valid key still shows nothing in the dropdown until the models are enabled. This is a VS Code default, not a bug, and it is the most common setup issue.
-
Install the extension from the Visual Studio Marketplace, or from a terminal:
code --install-extension tetrate.tetrate-model-provider -
Run Tetrate Agent Router: Set Agent Router API Key from the Command Palette and paste the key. This step is optional: the extension prompts for the key the first time VS Code resolves models interactively.
-
Run Chat: Manage Language Models, select Tetrate Agent Router, and enable the required models. The enabled models appear in the chat model picker.
Discovery is lazy, so an installed but unconfigured extension costs nothing at startup.
On an Enterprise tier, the base URL must point at the dedicated proxy instance. See Point at an Enterprise or self-hosted endpoint.
Where the key is stored
The key is held in VS Code secret storage, backed by the operating system keychain. It is never written to a settings file, a log, or the output channel, and it is excluded from Settings Sync, so it stays on the machine where it was set.
Configuration
| Setting | Type | Default | Scope | Purpose |
|---|---|---|---|---|
tetrate-model-provider.baseUrl | string | https://api.router.tetrate.ai/v1 | machine | The OpenAI-compatible endpoint to call |
tetrate-model-provider.modelFilter | string[] | [] | window | Glob patterns limiting which models are offered; empty offers every chat model |
tetrate-model-provider.requestHeaders | object | {} | machine | Extra HTTP headers sent with every request |
baseUrl and requestHeaders are machine-scoped, so they can be set in User settings but not in a workspace or folder settings.json. Both decide where the API key is sent, and a cloned repository must not be able to redirect it. modelFilter only narrows the picker, so it stays settable per workspace.
Changing any of these reloads the model list.
Point at an Enterprise or self-hosted endpoint
The base URL is pre-configured for the hosted service. For a dedicated Agent Router Enterprise tenant or a self-hosted deployment, change it in Settings or with Tetrate Agent Router: Set Base URL from the Command Palette:
{
"tetrate-model-provider.baseUrl": "https://router.tare-<tenantID>.tetrate.ai/v1"
}
Input is normalized before use: surrounding whitespace and trailing slashes are stripped, and /v1 is appended when no version segment is present. Both http and https are accepted, which allows a local proxy such as http://localhost:8080.
Filter the model list
The hosted catalog exposes more than 160 conversational models. To keep the picker manageable, restrict it by glob pattern:
{
"tetrate-model-provider.modelFilter": ["claude-*", "gpt-5.6-*", "gemini-3.1-pro-preview"]
}
Only * is special, and it matches within and across segments. Everything else, including . and -, compares literally; matching is case-insensitive. A model is offered when it matches at least one pattern.
Because the filter is workspace-scoped, a team working under an approved model list can commit it to .vscode/settings.json and every developer on the project sees the same narrowed catalog.
Add request headers
Use requestHeaders for a routing hint or a tenant identifier required by a self-hosted deployment:
{
"tetrate-model-provider.requestHeaders": {
"X-Tenant-Id": "team-platform"
}
}
Do not put the API key here. It belongs in secret storage, and settings files are frequently committed to source control. An Authorization entry is discarded: that header is always derived from the stored key.
Commands
| Command | Effect |
|---|---|
| Tetrate Agent Router: Set Agent Router API Key | Store or replace the API key |
| Tetrate Agent Router: Clear Agent Router API Key | Remove the stored key |
| Tetrate Agent Router: Set Base URL | Change the endpoint, with validation |
| Tetrate Agent Router: Refresh Model List | Discard the cached model list and re-query the endpoint |
Use the models from another extension
Extension authors need no dependency on this extension and no coordination with Tetrate. Select by vendor through the VS Code API:
const [model] = await vscode.lm.selectChatModels({
vendor: 'tetrate-agent-router',
// family: 'anthropic',
// id: 'claude-sonnet-5',
});
if (!model) {
return;
}
const response = await model.sendRequest(
[vscode.LanguageModelChatMessage.User('Summarize this file.')],
{ justification: 'Generating a summary of the open file.' },
cancellationToken
);
for await (const chunk of response.text) {
process.stdout.write(chunk);
}
The selector fields map onto the model list as follows:
| Field | Meaning | Examples |
|---|---|---|
vendor | Always tetrate-agent-router | tetrate-agent-router |
family | The upstream provider name | anthropic, openai, gemini, xai, groq |
id | The model id as the endpoint reports it | claude-sonnet-5, gpt-5.6-terra, xai/grok-4.5 |
VS Code asks the user for consent the first time an extension sends a request, so the justification string is worth writing carefully.
Tool calling is supported: pass tools in the request options and read LanguageModelToolCallPart values from response.stream. Provider-specific options such as temperature, max_tokens, and reasoning_effort pass through unchanged via modelOptions. Full details, including request translation and streaming behaviour, are documented on the extension's Marketplace page.
Behaviour and limitations
- Output length. No token cap is sent, so each model's server-side default applies. Set
max_tokensormax_completion_tokensthroughmodelOptions. - Images are sent only to models reporting vision support. Audio and PDF inputs are not forwarded.
- Reasoning traces are not surfaced; the supported VS Code versions have no thinking part to render them into.
- Token counts are estimated locally and deliberately pessimistically, since the endpoint exposes no token-counting route.
- Prompt caching is not configured explicitly. Where the upstream provider applies it automatically, it still takes effect.
- Errors propagate as-is: a 401 or 403 becomes
LanguageModelError.NoPermissions, a 404 becomesNotFound, and everything else surfaces with the status and the server's message.
Troubleshooting
| Symptom | Resolution |
|---|---|
| No models in the picker | Models start hidden. Run Chat: Manage Language Models and enable them. |
| No models after enabling | Check the key with Set Agent Router API Key, then Refresh Model List. |
| Models missing after editing settings | modelFilter may exclude them. An empty array offers everything. |
| A 401 on every request | The key is invalid or revoked. Set a fresh one from the Console. |
| A 404 on every request | The base URL is wrong. It must end in /v1 or another version segment. |
| Fallback limits on every model | router.tetrate.ai is unreachable, so catalog metadata is unavailable. Discovery still works. |
| Claude models appear twice | Another Claude provider extension is installed. Both contribute under separate vendors. |
The Tetrate Agent Router output channel logs the discovered model count, configuration changes, and failures with status codes. Open it from View → Output and pick the channel from the dropdown. It never logs the API key or message content.
Where to go next