Skip to main content
ValarCode routes Pi through Valar by registering its own valar provider in Pi’s config. Pi speaks the Anthropic Messages API, so it works the same way as Claude Code: the gateway maps what Pi sends to the target your routing resolves to. See Set up ValarCode for the shared setup and the client-id model.

Prerequisites

  • Pi installed, with a ~/.pi/agent config directory.
  • A Valar coding key (vlrcode_…) and the valar CLI (install).

Enable routing

Run once per machine:
Pi reads its config at startup, so restart Pi for the change to take effect. Check the state any time:

What gets written

Pi keeps its config in three JSON files under ~/.pi/agent/. valar pi on edits all three, preserving other providers and unrelated keys: settings.json makes the valar provider active and pins a model from Valar’s list:
Your current selection is kept when Valar offers that model; otherwise it moves to Valar’s default. auth.json stores the bare coding key under a Valar-managed entry:
models.json declares the valar provider against the gateway, with its model list and the headers that attribute your traffic:
Each entry in models carries one model’s id, display name, context window, max output tokens, cost, and whether it accepts images. The array is the whole catalog for this provider — it is exactly what Pi’s model picker offers. Your own builtin anthropic provider is left alone, still pointed at api.anthropic.com. Pi’s Anthropic SDK appends /v1/messages, so a trailing /v1 on the base URL is stripped before it is written. All three files are written user-only (0600), since they hold the key and the client-id header. Before the first change, the originals are snapshotted to ~/.valar/pi/backup.json, so off restores them byte-for-byte.
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.

Turn off routing

This restores the three pre-enable files. Restart Pi for the change to take effect.

Next steps

Model routing

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

LiteLLM integration

Pi works through a LiteLLM proxy the same way Claude Code does.