BYO Inference Endpoint
The config seam through which Harness / Model Separation is
actually exercised: point the harness's inference client at a different
base URL, hand it a different credential, and name a different model. In
Claude Code the source shows it as project-scoped environment variables
in .claude/settings.local.json —
ANTHROPIC_BASE_URL at an OpenRouter or a local Ollama
server, the OpenRouter key placed (confusingly) in
ANTHROPIC_AUTH_TOKEN, and ANTHROPIC_API_KEY
deliberately blanked. Ollama ships a convenience wrapper,
ollama launch claude, that does the same thing and lets you
pick from locally pulled models.
The sharp edge is partial override. A modern harness does not call one model — it calls a fleet of model slots: a main model, a cheap model for tool calls and file searches, a small-fast model, a subagent model, and per-tier defaults. Overriding only the base URL and the token — which is what the source says OpenRouter's own integration documentation instructs — leaves those slots on the vendor's paid defaults. The harness then routes its high-volume mechanical work back to the vendor, over the operator's own credentials, while the banner reports the substituted model. The source discovered this only by reading his billing logs: page after page of Claude Haiku 4.5 calls, tagged with the app name "Claude Code," each a fraction of a cent, accumulating while he believed he was running free. He fixed it by setting every slot:
ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_API_KEY=""
ANTHROPIC_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL,
ANTHROPIC_DEFAULT_HAIKU_MODEL, ANTHROPIC_SMALL_FAST_MODEL, CLAUDE_CODE_SUBAGENT_MODEL
The general lesson outlives those variable names, which are Claude Code's and will not transfer: a redirect is only complete when every model slot is redirected, and the default when a slot is unset is the vendor's paid model, not an error. Cost silence is the failure mode — the harness works, the operator is billed, and nothing surfaces it except the logs. This is a "no silent caps" problem wearing a config hat.
Two secondary hazards the source demonstrates. Pasting a config
containing a live API key into the coding agent's own chat sends the key
to the vendor you are routing around — he flags this and rotates the key
afterward. And a free router endpoint
(openrouter/free) that picks the most-available model per
request dodges rate limits at the cost of knowing which model answered —
which makes Harness / Model Fit
untestable, because the engine changes under you.
Claims
- When redirecting a harness to a third-party endpoint, override every model slot — main, tier defaults, small-fast, subagent — not just the base URL and credential. best practice — context: harnesses that dispatch internal work to named sub-models. The vendor's fallback for an unset slot is its own paid model, so a partial override bills you silently for tool calls and file searches. The specific variable names are harness-specific and will change; the shape of the mistake will not.
- An unset model slot fails open to the vendor's paid default, not to an error. principle — durable: a harness that errored on an unset slot would break its own defaults, so silent fallback is the only design available. Any operator redirecting a harness inherits this.
- Verify a redirect against the billing log, not the harness banner. best practice — context: any BYO-endpoint setup where cost is the motivation. The banner reports the main model; the sub-model slots are invisible to it. The source's own logs were the only channel that surfaced the leak.
- Never paste a live configuration containing an API key into an agent chat you are routing around. best practice — context: the source does exactly this on camera and notes "Anthropic is reading that," mitigating by deleting the key after. The general rule — an agent's context is exfiltration surface — applies to any vendor.
- A router endpoint that selects the model per request trades
away the ability to reason about fit.
observation — the source's
reason for recommending against
openrouter/freedespite it evading rate limits: "you just don't have any control over what model is getting called." - The source states that OpenRouter's own Claude Code integration documentation sets only the base URL and token, which is insufficient and results in charges to Anthropic's paid Haiku and Sonnet. observation — a specific, groundable claim about third-party documentation; not verified here, and documentation of this kind changes.
Related
- Harness / Model Separation — the architectural fact; this page is the config seam that realizes it.
- Harness / Model Fit — what you must then test, and what a per-request free router makes untestable.
- Model-Tier Routing — the sub-model slots exposed here are a tier-routing surface: the harness already routes tool calls to a cheap tier. Redirecting each slot is tier routing performed on someone else's map.
- Agent Gateway — the other place a harness's outward connections are configured per-channel.
- Total Cost of Inference — the leak this page describes is the first way "free" quietly isn't.
- Distillate: Ollama + Claude Code = 99% CHEAPER