Tips & Recipes

Back to home

V1 Honesty: OffRouter routes delegated work. It does not replace your harness's primary model call.

Tips & Recipes

1. Enforce Subscription-First (No API Fallback)

By default, OffRouter tries to avoid spending your API keys if a subscription is available. You can guarantee this by disabling API key fallbacks entirely in your config.toml.

[policy]
subscription_first = true
allow_api_key_fallback = false

2. Add a Local Ollama Runtime

You can set up local models for maximum privacy. Edit config.toml to register a local Ollama environment providing an OpenAI-compatible URL.

[providers.ollama]
enabled = true
base_url = "http://localhost:11434/v1"
[[providers.ollama.accounts]]
id = "local-ollama"

3. Scripting with JSON Output

Many CLI commands export detailed standard data via the --json flag, making OffRouter easy to integrate into shell scripts and CI tools.

offrouter doctor --json
offrouter route explain "Hello" --profile claude-personal --json
offrouter status --providers --json

4. Checking Why a Route Was Chosen

If you're unsure which provider a prompt will be sent to, skip live calls and check local policy routing explicitly with the explain command.

offrouter route explain "summarize this file" --profile claude-personal

5. Tracking Near-Limit Warnings

If you have tight usage limits on particular provider accounts, configure a limit threshold (e.g., 0.1 for 10% remaining). The CLI and hooks will warn you when your usage nears the quota.

[policy]
near_limit_threshold = 0.1

6. Profile Guardrails for Work vs Personal

Keep your work data out of personal routes. OffRouter safely denies *-work profiles by default, but you can explicitly deny additional profiles.

# config.toml
denied_profile_patterns = ["*-work", "*-enterprise"]
allowlisted_profiles = ["claude-personal"]

7. Starting MCP Delegation Tools

OffRouter provides decision and delegation insights back to your agent harness via MCP. Start it over stdio to hook it into your development environment.

offrouter mcp serve

8. Proxy Usage

If you have other command line tools that simply need an OpenAI-compatible API base URL, run OffRouter as a proxy on your local machine.

offrouter proxy serve --port 8787
# Now your tool can target http://127.0.0.1:8787

9. Cap Paid API Spend

Set a hard cap on estimated paid API-key spend for the current accounting window. At or over the cap, API-key candidates are denied with spend_cap_exceeded; subscription and local routes are never blocked. A per-provider cap overrides the global one.

[policy]
spend_cap_usd = 25

[providers.anthropic]
spend_cap_usd = 10

Check where you stand with offrouter status --costs.

10. Require Explicit Approval for API Spend

Make every paid API-key route require a per-invocation acknowledgment. Without it, API-key candidates are denied with api_spend_approval_required; subscription and local routes are unaffected.

[policy]
require_api_spend_approval = true

Then approve explicitly when you mean it:

offrouter route explain "summarize this file" --profile claude-personal --approve-api-spend

11. Restrict Models per Provider

Limit which model ids a provider may route. When allowed_models is present, only listed ids may route (absent means all models); denied_models is always blocked, and deny beats allow. Entries are exact ids or a single trailing * prefix glob.

[providers.anthropic]
allowed_models = ["claude-sonnet-5", "claude-haiku-4-5"]
denied_models = ["claude-opus-*"]

Denied candidates show up in route explain as model_not_allowed.