You Don’t Have to Leave Claude Code to Use DeepSeek

K

Khasky

Guest
You do not have to give up Claude Code or Codex CLI to put DeepSeek to work, and you do not have to run a proxy either. Each client has its own documented route to the same API. 🔌


Code:
Claude Code   -> direct, Anthropic-compatible endpoint
Codex CLI     -> official setup script, Responses API
OpenCode      -> /connect, then /models
Aider         -> OpenAI-compatible base URL
LiteLLM       -> one local endpoint, fallback and budget
Ollama        -> local models, no API at all

Claude Code​


For Claude Code:

Code:
$env:ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic"
$env:ANTHROPIC_AUTH_TOKEN="sk-YOUR_DEEPSEEK_KEY"
$env:ANTHROPIC_MODEL="deepseek-flash[1m]"

claude

Everything above the provider stays: the same tools, the same project, the same way of working. Billing moves with the provider, so these requests draw down a DeepSeek balance instead of an Anthropic subscription.

Codex​


Code:
irm https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.ps1 | iex

codex

Codex talks to DeepSeek over the Responses API, and the official script writes the provider section for you and backs up the configuration it found. Read it before you run it, the way you would with any script that rewrites your tooling. 🔧

OpenCode and Aider​


OpenCode has DeepSeek in its own provider list, reached with /connect and then /models. Aider goes through the OpenAI-compatible base URL:

Code:
setx OPENAI_API_BASE "https://api.deepseek.com"
setx OPENAI_API_KEY "sk-YOUR_DEEPSEEK_KEY"

aider --model openai/deepseek-flash

LiteLLM and Ollama​


LiteLLM is the option worth reaching for when one provider is not enough: a local endpoint in front of DeepSeek, Claude, GPT and Gemini, with fallback, visible spend and a budget. Ollama is the other end of the same spectrum, where the model runs on your own card and no request leaves the room. 🧊

Code:
ollama run deepseek-coder:6.7b

An 11 GB card carries DeepSeek Coder 6.7B and the 7B and 8B R1 distills comfortably enough, and 14B in 4-bit with RAM spillover and low speed.

Why DeepSeek Flash instead of Claude Sonnet 5 or GPT-5.6 Terra?​


DeepSeek publishes two rates per million tokens, and off-peak is half of peak:

Code:
Flash, off-peak   $0.15 input (cache miss)   $0.60 output
Flash, peak       $0.30 input (cache miss)   $1.20 output
Pro, off-peak     $0.66 input (cache miss)   $1.98 output
Pro, peak         $1.32 input (cache miss)   $3.96 output

The standard rung at the two providers a coding CLI reaches for by default:

Code:
Claude Sonnet 5   $2 input    $10 output
GPT-5.6 Terra     $2 input    $12 output

Code:
Flash vs Claude Sonnet 5   ~7-17x cheaper
Flash vs GPT-5.6 Terra     ~7-20x cheaper

The low end of each range is peak input, the high end is off-peak output, so where a run lands depends on the hour it runs and on how much of it is output. This compares API rates against API rates, so a fixed monthly subscription is not directly comparable.

Flash is a strong default for:

  • repository exploration
  • tests
  • docs
  • boilerplate
  • routine refactors
  • CI fixes
  • subagent loops

I would still escalate to a frontier Claude or GPT model for:

  • ambiguous architecture
  • hard debugging
  • security review
  • risky migrations

Neither side is universally weaker, and the split is where each one is worth its price.

Privacy​


Do not casually send API keys, .env files, production credentials or large database dumps to a cloud model. For confidential code, prefer local inference or a provider whose retention policy matches your requirements.

The model list says one thing, the traffic says another​


The interface says DeepSeek-Flash and the traffic still goes to the OpenAI Responses endpoint, with no OpenAI key in play. The model catalog changed and the provider section did not.

Code:
[model_providers.deepseek]
name = "deepseek"
base_url = "https://api.deepseek.com/"
wire_api = "responses"
experimental_bearer_token = "sk-YOUR_DEEPSEEK_API_KEY"

Close Codex, ChatGPT Desktop and VS Code completely and open them again, because picking the model in a running window does not reload the provider.

A model name in a menu is a label, and the provider block is the address.

Reference links​

 

Thread statistics

Created
Khasky,
Replies
0
Views
2
Back
Top