Skip to main content

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.lm API.
  • 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

RequirementDetail
VS Code1.106 or newer
API keyAn Agent Router API key from the Console
NetworkOutbound HTTPS to the configured base URL, and to router.tetrate.ai for model metadata

Setup

Do not skip step 3

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.

  1. Install the extension from the Visual Studio Marketplace, or from a terminal:

    code --install-extension tetrate.tetrate-model-provider
  2. 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.

  3. 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.

For Enterprise tiers

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

SettingTypeDefaultScopePurpose
tetrate-model-provider.baseUrlstringhttps://api.router.tetrate.ai/v1machineThe OpenAI-compatible endpoint to call
tetrate-model-provider.modelFilterstring[][]windowGlob patterns limiting which models are offered; empty offers every chat model
tetrate-model-provider.requestHeadersobject{}machineExtra 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:

.vscode/settings.json
{
"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

CommandEffect
Tetrate Agent Router: Set Agent Router API KeyStore or replace the API key
Tetrate Agent Router: Clear Agent Router API KeyRemove the stored key
Tetrate Agent Router: Set Base URLChange the endpoint, with validation
Tetrate Agent Router: Refresh Model ListDiscard 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:

FieldMeaningExamples
vendorAlways tetrate-agent-routertetrate-agent-router
familyThe upstream provider nameanthropic, openai, gemini, xai, groq
idThe model id as the endpoint reports itclaude-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_tokens or max_completion_tokens through modelOptions.
  • 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 becomes NotFound, and everything else surfaces with the status and the server's message.

Troubleshooting

SymptomResolution
No models in the pickerModels start hidden. Run Chat: Manage Language Models and enable them.
No models after enablingCheck the key with Set Agent Router API Key, then Refresh Model List.
Models missing after editing settingsmodelFilter may exclude them. An empty array offers everything.
A 401 on every requestThe key is invalid or revoked. Set a fresh one from the Console.
A 404 on every requestThe base URL is wrong. It must end in /v1 or another version segment.
Fallback limits on every modelrouter.tetrate.ai is unreachable, so catalog metadata is unavailable. Discovery still works.
Claude models appear twiceAnother 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.