Cost routing
Keep your Claude or OpenAI model for the hard turns and route the rest to cheaper open models, with the CLI's auto router running on your machine.
Cost routing moves workloads off an expensive frontier model and onto an open model, without changing your agent. The CLI's auto router, which runs on your machine, decides request by request whether a turn needs your strong model or whether an open model handles it just as well. You give it two models, a strong one and an economy one, and point your agent at it.
| Role | Example | Billed by |
|---|---|---|
| Strong | Your Claude or OpenAI model, through your key or subscription | Your provider or subscription |
| Economy | deepseek-v4.1-flash on Spare | Spare, at the live price |
Set up
-
Connect both models to the CLI: your strong model with a key or subscription, and Spare with your
SPARE_API_KEY. Check that both appear inspare models. -
Bind the auto router to the two routes, using the
provider:modelids thatspare modelsprints:spare policy init auto --router auto \ --strong <provider>:<your-strong-model> \ --economy <provider>:deepseek-v4.1-flash spare policy check -
Start the CLI and send requests to the model
spare/auto:spare start spare claude --model spare/auto # or: spare codex --model spare/auto
Any OpenAI- or Anthropic-format client can use it too: point it at the CLI's local address and send
"model": "spare/auto". Naming a specific model instead skips the Router for that request.
How it decides
The policy file policy-lock.yaml that spare policy init writes maps kinds of requests to the strong or
the economy tier. A request that matches no rule goes to the default tier. Edit the policy and run
spare policy check before reloading.
Routing picks a model for a request that would succeed. It is separate from fallbacks, which replace a request that failed.
See where each turn went
spare requests --limit 25Each row shows the model you asked for, the model and provider that served it, its tokens, cost and status. Turns served by Spare also appear in the console's Activity page, with their settlement.
Your data
The Router runs on your machine. Turns it sends to your strong model go straight from the CLI to your provider and never pass through Spare. Turns sent to Spare are recorded without their prompt or response content.
How is this guide?