Phase 2 — CLI
Time: ~10 minutes
Prerequisites: Phase 1 complete; you chose "In my terminal" or want CLI
You'll need: Terminal, Node 18+, npm or pnpm
This phase installs the Restormel Keys CLI and runs doctor, validate, models list, and routing explain so you can debug and inspect from the terminal. You can also link a Gateway key with device login or the dashboard Copy .env snippet action.
Step 2.1 — Install the CLI
npm install -g @restormel/keys-cliOr as a dev dependency:
pnpm add -D @restormel/keys-cliThen run via npx keys or pnpm exec keys. You'll see keys --help with init,
login, add, list, validate, doctor, estimate, sync, models, routing, catalog, patch.
Step 2.2 — Link your project (device login, optional)
Run npx @restormel/keys-cli login, open the printed URL while signed in, enter the user code, and pick
a project. Restormel creates a new Gateway key and shows an env block in the terminal. Optional:
npx @restormel/keys-cli login --write-env .env.localOr use Gateway keys → create a key → Copy .env snippet for RESTORMEL_GATEWAY_KEY, RESTORMEL_PROJECT_ID, and RESTORMEL_KEYS_BASE. Approve
terminal linking at Connect CLI.
Step 2.3 — Run doctor
From your app directory (where restormel.config.json lives):
npx keys doctorDoctor checks framework, @restormel/keys, and config. Exit 0 means the local setup is valid. How to test: npx keys doctor exits with code 0.
Step 2.4 — Validate (optional)
If you have provider credentials in the local key store: npx keys validate. Skip if you use gateway-backed provider access only.
Step 2.5 — Models list
npx keys models listFilter by provider: npx keys models list --provider anthropic. You'll see a list of providers and their models with pricing hints.
Step 2.6 — Routing explain
npx keys routing explain gpt-4oYou'll see steps: which provider was found for the model, cost lookup, resolution result.
Prompts for this phase
Optional. Use if a coding agent should install the CLI, set RESTORMEL_* (device login or env snippet), and verify doctor, models list, and routing explain.
Checkpoint
You now have: CLI installed (global or dev dependency); optional device login or env snippet for RESTORMEL_GATEWAY_KEY; doctor passing; keys models list and keys routing explain working; and optionally validate run for local credentials.