# ── Providers ──────────────────────────────────────────────────────────────── # Every provider name referenced below (by a TIER_N_PROVIDER or PLANNER_PROVIDER # value) needs a matching {PROVIDER}_BASE_URL / {PROVIDER}_API_KEY pair — # uppercase the provider name, non-alphanumeric chars become "_" # (e.g. "my-proxy" -> MY_PROXY_BASE_URL). Add a brand new provider just by # adding its two vars here and pointing a tier or the planner at it below — # no code changes required. # # "openai" and "anthropic" are recognized by name and default their BASE_URL # and wire-format (_API) for you; every other provider name (including "local") # must set {PROVIDER}_BASE_URL explicitly, and defaults to the # openai-completions wire format (the common case for local/self-hosted # OpenAI-compatible servers). # Default provider — every tier and the planner use this unless overridden below. OPENAI_API_KEY= # OPENAI_BASE_URL=https://api.openai.com/v1 # override for Azure/a proxy # Anthropic — uncomment to route a tier or the planner at Claude directly. # ANTHROPIC_API_KEY= # A local OpenAI-compatible server (Ollama's /v1 endpoint, LM Studio, vLLM, # etc). Uncomment plus a TIER_N_PROVIDER=local line below to route a tier at it. # LOCAL_BASE_URL=http://localhost:11434/v1 # LOCAL_API_KEY=not-needed # most local servers ignore this but require *some* string # ── Tiers ──────────────────────────────────────────────────────────────────── # There is NO in-code default — every var below is required, and this is the # router's actual live config, not just documentation. The router will refuse # to start if any TIER_N_* var is missing. The values shipped here are a ready # -to-use OpenAI setup: copy this file to .env, fill in OPENAI_API_KEY, and # you're running. Change any value to point that tier at a different # provider/model — see the mixed-provider example further down. # Tier 1 — cheapest, read-only work. TIER_1_PROVIDER=openai TIER_1_MODEL=gpt-5-nano TIER_1_COST_INPUT=0.00005 # $ per 1k input tokens TIER_1_COST_OUTPUT=0.0004 TIER_1_CONTEXT_WINDOW=400000 TIER_1_MAX_TOKENS=128000 # Tier 2 — single-file edits, mechanical refactors. TIER_2_PROVIDER=openai TIER_2_MODEL=gpt-5.4-nano TIER_2_COST_INPUT=0.0002 TIER_2_COST_OUTPUT=0.00125 TIER_2_CONTEXT_WINDOW=400000 TIER_2_MAX_TOKENS=128000 # Tier 3 — multi-file work, debugging. TIER_3_PROVIDER=openai TIER_3_MODEL=gpt-5.4-mini TIER_3_COST_INPUT=0.00075 TIER_3_COST_OUTPUT=0.0045 TIER_3_CONTEXT_WINDOW=400000 TIER_3_MAX_TOKENS=128000 # Tier 4 — frontier, open-ended work. TIER_4_PROVIDER=openai TIER_4_MODEL=gpt-5.5 TIER_4_COST_INPUT=0.005 TIER_4_COST_OUTPUT=0.03 TIER_4_CONTEXT_WINDOW=1050000 TIER_4_MAX_TOKENS=128000 # ── Example: mixed setup — 2 tiers local, 2 tiers on hosted APIs ───────────── # To try this, comment out the matching TIER_N_* lines above and uncomment # this whole block (plus LOCAL_BASE_URL/LOCAL_API_KEY and ANTHROPIC_API_KEY # above): cheap/simple work stays free on a local model, harder work still # reaches OpenAI/Anthropic. Every var is still required — local models just # have $0 cost instead of a real price. # TIER_1_PROVIDER=local # TIER_1_MODEL=llama3.1:8b # TIER_1_COST_INPUT=0 # TIER_1_COST_OUTPUT=0 # TIER_1_CONTEXT_WINDOW=8192 # TIER_1_MAX_TOKENS=4096 # # TIER_2_PROVIDER=local # TIER_2_MODEL=qwen2.5-coder:7b # TIER_2_COST_INPUT=0 # TIER_2_COST_OUTPUT=0 # TIER_2_CONTEXT_WINDOW=32768 # TIER_2_MAX_TOKENS=8192 # # TIER_3_PROVIDER=openai # TIER_3_MODEL=gpt-5.4-mini # TIER_3_COST_INPUT=0.00075 # TIER_3_COST_OUTPUT=0.0045 # TIER_3_CONTEXT_WINDOW=400000 # TIER_3_MAX_TOKENS=128000 # # TIER_4_PROVIDER=anthropic # TIER_4_MODEL=claude-opus-4-5 # TIER_4_COST_INPUT=0.005 # TIER_4_COST_OUTPUT=0.025 # TIER_4_CONTEXT_WINDOW=200000 # TIER_4_MAX_TOKENS=64000 # ── Planner ────────────────────────────────────────────────────────────────── # The lightweight per-turn routing-decision call. Independent of the four # tiers above — can stay on OpenAI even if every tier is local, or vice versa. # Only openai-completions and anthropic-messages providers are supported here. # Required, same as the tiers — no in-code default. PLANNER_PROVIDER=openai PLANNER_MODEL=gpt-5-mini PLANNER_REASONING_EFFORT=low # openai-completions only; ignored on anthropic-messages # ── Logging & budgets ───────────────────────────────────────────────────────── LOG_FILE_PATH=./routing.log.json # Daily token budgets per tier (reset at local midnight) MAX_BUDGET_TIER_1=20000 MAX_BUDGET_TIER_2=30000 MAX_BUDGET_TIER_3=40000 MAX_BUDGET_TIER_4=80000 BUDGET_STATE_PATH=./budget-state.json