Skip to main content
ValarCode routes VS Code through GitHub Copilot Chat’s bring-your-own-key Custom Endpoint provider. Enabling registers a Valar provider group in Copilot Chat and makes Valar Auto the default model for new conversations. The group speaks the Anthropic Messages API; the gateway maps whatever model it sends to the target your routing resolves to. See Set up ValarCode for the shared setup and the client-id model.
The VS Code integration uses the copilot harness, so the command is valar copilot. valar vscode is an alias you can use interchangeably; attribution is recorded under the copilot harness either way.

Prerequisites

  • VS Code (the stable build) with GitHub Copilot Chat signed in, and a version new enough to offer the Custom Endpoint provider. Insiders and forks keep their own config and are not routed.
  • A Valar coding key (vlrcode_…) and the valar CLI (install).

Enable routing

Run once per machine:
Then reload the VS Code window. New Copilot Chat conversations start on Valar Auto; you can still pick another Valar model in the model picker. If the group is not listed yet, reload again. Check the state any time:

What gets written

The CLI registers a provider group in Copilot Chat’s model config, chatLanguageModels.json, in the VS Code user directory (~/Library/Application Support/Code/User on macOS, ~/.config/Code/User on Linux), plus one file per additional VS Code profile under profiles/*/. The file is a JSON array of provider groups; the CLI adds a group named Valar:
In detail, enabling:
  • Registers a Valar group under the built-in customendpoint vendor, with apiType: "messages" so the group speaks the Anthropic Messages dialect. The group’s models list is the picker; you can switch to any Valar model there.
  • Writes the full per-model endpoint https://api.valarhq.ai/v1/messages on each model, since this vendor has no separate base-URL field.
  • Carries the coding key in the x-api-key request header rather than the vendor’s apiKey field. That field is stored in the OS keychain and cannot be populated by an external writer, so the key rides as a request header instead; the gateway authenticates it like a bearer token.
  • Adds X-Valar-Harness: copilot, X-Valar-Client-Id and X-Valar-Cli-Version to each model’s requestHeaders for attribution.
  • Sets "chat.defaultModel": "valar-auto" in the profile’s settings.json, so each new conversation starts on Valar Auto rather than on Copilot’s own Auto. Only that one setting is added or changed; your comments and the rest of the file are left exactly as they were. If you already chose a default model there (anything other than auto), it is kept, and on tells you that conversations started on it do not go through Valar.
On the first enable, the files it touches are snapshotted to ~/.valar/copilot/backup.json, and the previous chat.defaultModel of each settings.json it changes to ~/.valar/copilot/default-model.json. A VS Code profile you create later is routed by the next on and un-routed by off on the Valar marker, without a snapshot of its own.
The client id defaults to your OS username, so the header reads X-Valar-Client-Id: jdoe. Use --user-id RANDOM for an opaque vc_… id instead. See per-engineer attribution.
A chatLanguageModels.json that contains comments (JSONC) is skipped and reported rather than rewritten, so a hand-edited file is never clobbered. Remove the comments and re-run on to route that profile.

Turn off routing

This restores the pre-enable snapshot, removes the Valar group from any profile it was added to, and puts chat.defaultModel back to what it was (a value you changed while routed is kept). Reload the VS Code window if the Valar models are still listed in Copilot Chat.

Next steps

Model routing

How cohorts and the split decide which model serves each request.

Analytics

Per-engineer usage and savings, attributed by client id.