What Changed — The Specific Setup
You're paying for a Claude Code subscription, but not every task needs the most capable model. Exploratory reads, "summarize this directory," draft-and-discard scratch work — that's high-volume, low-stakes stuff that burns tokens. The fix: a second, cheaper backend for that category of work.
The catch: Claude Code only speaks Anthropic's Messages API. It has no built-in notion of "same tool, different model." But you can point it elsewhere with a few environment variables and a self-hosted proxy.
This setup, shared by a developer on dev.to, runs two agents from the same terminal:
- Trusted agent:
claude— real Anthropic subscription, default session - Cheap agent:
claude-cheap— same CLI, routed through a LiteLLM proxy to DeepSeek V4 (pro for Sonnet-tier, flash for Haiku-tier)
The proxy translates Anthropic-format requests to DeepSeek, served through an OpenRouter API. A persistent SSH tunnel from a VPS connects to each machine.
The Core Trick — /v1/messages, Not /v1/chat/completions
The critical move: point ANTHROPIC_BASE_URL at LiteLLM's /v1/messages endpoint, not the OpenAI-compatible path LiteLLM also exposes. Claude Code only understands the Anthropic shape, so the OpenAI-shaped endpoint fails in ways that look like a client bug and aren't. Once LiteLLM sits on the right endpoint and translates underneath, Claude Code has no idea it isn't talking to Anthropic.
The One Bug Worth Flagging — Plan Mode's context_management
Claude Code's Plan Mode attaches a context_management parameter to its requests. Anthropic's API handles it. Most other backends don't recognize it and reject the whole request with a 400 — which looks like Plan Mode itself is broken, when it's a parameter the downstream model was never built to accept.

One-line fix in the LiteLLM config:
litellm_config.yaml
---
drop_params: true
That tells LiteLLM to silently strip unsupported parameters instead of forwarding them and letting the backend reject the call. Plan Mode then works the same regardless of which model is actually answering.
Two Commands, Deliberately Asymmetric
This is the part worth copying more than any proxy config: the trusted and cheap agents don't look the same, on purpose.
claude — the real thing, full subscription, no wrapper. Default terminal, default prompt. It's the session where mistakes cost the most, so you want zero visual noise between you and what it's doing.
claude-cheap — a shell function that drops into an isolated subshell, retitles the tab with a distinct label and icon, and resets on exit. Not aesthetics: at 11pm switching between six tabs, you want it structurally impossible to mistake the cheap, more permissive session for the one running on your subscription. The expensive tool gets no ceremony; the cheap tool gets a costume.
# --- Cheap agent: DeepSeek via self-hosted LiteLLM proxy ---
claude-cheap() {
(
unset ANTHROPIC_API_KEY
export ANTHROPIC_BASE_URL=http://localhost:3456
export ANTHROPIC_AUTH_TOKEN=anything
export ANTHROPIC_MODEL=deepseek/deepseek-v4-pro
export ANTHROPIC_DEFAULT_SONNET_MODEL=deepseek/deepseek-v4-pro
export ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek/deepseek-v4-flash
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
echo -ne "\033]0;🐋 DEEPSEEK-AGENT\007"
claude "$@"
echo -ne "\033]0;Terminal\007"
)
}
Why this works:
- The subshell
( ... )makes the exports throwaway — they don't leak into the parent shell once the function returns. ANTHROPIC_AUTH_TOKENis set to a dummy value because LiteLLM doesn't check it; it just needs something present so Claude Code doesn't refuse to start.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICcuts calls back to Anthropic's own telemetry endpoints, since this session has no real Anthropic account behind it.
Why Bother — Supervisor/Executor Split
The goal was never "make Claude Code cheaper." It's a supervisor/executor split: the subscription session does planning, review, anything you'd be upset to see broken. The proxy session handles high-volume, low-stakes work, and its output gets reviewed before it's trusted the same way.
Same shape of decision as picking a cloud model over a local one for a monitoring agent — not "which model is smarter," but "which failure mode can I tolerate, and what's the cheapest thing that clears the bar." Here the axis is subscription cost instead of on-device vs. cloud. The underlying question is identical: what am I willing to have wrong, and what's watching for when it is.
What's Still Open — Local-Only Variant
There's also a local-only variant: same two-tier pattern, but the cheap tier runs entirely on-device instead of through a hosted proxy. That one hit a tool-calling format mismatch — a story of its own, the author plans to write up separately.
Try It Now
- Set up a LiteLLM proxy with
drop_params: trueand your DeepSeek/OpenRouter credentials. - Point
ANTHROPIC_BASE_URLat the proxy's/v1/messagesendpoint. - Add the
claude-cheapfunction to your shell config. - Run
claude-cheapfor exploratory reads and scratch work; keepclaudefor planning and review.
Your subscription stays for what matters. Your cheap agent handles the rest.
Source: dev.to







