Skip to content
gentic.news — AI News Intelligence Platform
Connecting to the Living Graph…

Listen to today's AI briefing

Daily podcast — 5 min, AI-narrated summary of top stories

Terminal window showing command routing code tasks between two AI models, with a split-screen interface and cost…

Route Claude Code to DeepSeek for Cheap Tasks: The Two-Command Trust Split

Use ANTHROPIC_BASE_URL and LiteLLM's drop_params to create a claude-cheap alias for DeepSeek, keeping your subscription for high-stakes work.

·1d ago·5 min read··25 views·AI-Generated·Report error
Share:
Source: dev.tovia devto_claudecode, medium_claude, reddit_claudeMulti-Source
How do I run Claude Code against a cheaper model like DeepSeek without breaking Plan Mode?

Set ANTHROPIC_BASE_URL to your LiteLLM proxy's /v1/messages endpoint, add drop_params: true to litellm_config.yaml to strip unsupported context_management, and use a shell function to swap env vars for a cheap agent.

TL;DR

Point ANTHROPIC_BASE_URL at LiteLLM's /v1/messages endpoint to run a cheap DeepSeek agent alongside your subscription, with drop_params: true to fix Plan Mode.

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.

Cover image for One terminal, two trust levels — running Claude Code against a real subscription and a cheap proxy

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_TOKEN is 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_TRAFFIC cuts 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

  1. Set up a LiteLLM proxy with drop_params: true and your DeepSeek/OpenRouter credentials.
  2. Point ANTHROPIC_BASE_URL at the proxy's /v1/messages endpoint.
  3. Add the claude-cheap function to your shell config.
  4. Run claude-cheap for exploratory reads and scratch work; keep claude for planning and review.

Your subscription stays for what matters. Your cheap agent handles the rest.


Source: dev.to

Source: gentic.news · · author= · citation.json

AI-assisted reporting. Generated by gentic.news from multiple verified sources, fact-checked against the Living Graph of 4,300+ entities. Edited by Ala SMITH.

Following this story?

Get a weekly digest with AI predictions, trends, and analysis — free.

AI Analysis

Claude Code users should adopt this two-tier pattern immediately. The key insight is that `ANTHROPIC_BASE_URL` can point to any Anthropic-compatible endpoint, and LiteLLM's `drop_params: true` solves the Plan Mode 400 error that would otherwise make the proxy unusable. This isn't just about cost — it's about trust tiering. You're consciously deciding which tasks get the full attention of your most capable model, and which get a cheaper, faster model that's "good enough" for the job. To implement this, copy the `claude-cheap` shell function verbatim, but adapt the model names to whatever you're routing through. If you're using OpenRouter, you can also route to other models like Llama or Mistral. The subshell pattern is the critical piece — it ensures your environment variables don't leak into your main session, so you always know which agent you're running. The tab title change is a small but powerful guard against costly mistakes. Finally, consider the broader implication: this pattern extends beyond cost. You could route to a local model for privacy-sensitive tasks, or to a faster model for high-volume code review. The supervisor/executor split is a mental model that applies to any agentic workflow — decide what you're willing to have wrong, and route accordingly.
This story is part of
The AI Infrastructure War Shifts from Chips to Developer Tools
Nvidia's enterprise pivot and AWS's OpenAI bet collide with Cursor's quiet ascent
Compare side-by-side
Anthropic vs DeepSeek
Enjoyed this article?
Share:

AI Toolslive

Five one-click lenses on this article. Cached for 24h.

Pick a tool above to generate an instant lens on this article.

Related Articles

From the lab

The framework underneath this story

Every article on this site sits on top of one engine and one framework — both built by the lab.

More in Products & Launches

View all