DeepSeek CLI with Claude Code
bex deepseek launches Claude Code on DeepSeek's Anthropic-compatible endpoint — pay-as-you-go, one console key. The first launch captures that key with a hidden paste and verifies it live; every launch after is just the one command.
bex deepseek
Quickstart
# Claude Code is the runtime — install it once npm install -g @anthropic-ai/claude-code# first launch opens the provider console and captures your key once bex deepseek# everything after the provider name goes straight to claude bex deepseek --continue# rotate or replace the stored key any time bex code keys set deepseek
How bex deepseek works
Documented seams, nothing forked
bex deepseek starts your installed Claude Code with ANTHROPIC_BASE_URL pointed at https://api.deepseek.com/anthropic and your key in ANTHROPIC_AUTH_TOKEN — only Claude Code's documented environment variables, injected at exec time.
An isolated config dir
CLAUDE_CONFIG_DIR is set to ~/.bex/code/claude-deepseek (base overridable with BEX_CODE_HOME): settings, history and permissions never collide with another provider, your personal ~/.claude is neither read nor modified, and inherited ANTHROPIC_* values are stripped so nothing leaks in.
One hidden paste, verified live
The first bex deepseek opens the provider's API-key console, takes one hidden paste, and verifies the key live against the provider's Messages endpoint — only an explicit 401/403 fails. The key is stored owner-only in ~/.bex/code/keys.toml and injected at launch, never written into a config file.
The environment always wins
A key already set in DEEPSEEK_API_KEY overrides the stored one — the first set variable wins — so CI jobs and one-off shells can bring their own key without touching keys.toml.
Everything else goes to claude
Arguments after the provider name pass through to claude unchanged: bex deepseek --continue resumes your last session, bex deepseek -p "one prompt" runs a single prompt, and Claude Code's own --help works as-is.
Manual env vars vs bex deepseek
By hand: five exports, every shell
export ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic"
export ANTHROPIC_AUTH_TOKEN="<api-key>"
export ANTHROPIC_MODEL="deepseek-chat"
export ANTHROPIC_SMALL_FAST_MODEL="deepseek-chat"
export CLAUDE_CONFIG_DIR="$HOME/.claude-deepseek"
claudeClaude Code's provider seams are environment variables, so a manual setup exports the endpoint, the key, both model slots and a config dir — in every new shell, for every provider, with nothing checking that the key actually works.
With bex: one command
bex deepseekbex deepseek injects the same variables at exec time, keeps ~/.bex/code/claude-deepseek isolated so histories and settings never collide, and verifies your key before Claude Code starts.
DeepSeek defaults
| Default model | deepseek-chat |
|---|---|
| Small/fast model | deepseek-chat |
| Base URL | https://api.deepseek.com/anthropic |
| API-key console | https://platform.deepseek.com/api_keys |
| Key environment variables | DEEPSEEK_API_KEY |
The default model fills ANTHROPIC_MODEL and the opus/sonnet slots; the small/fast model fills ANTHROPIC_SMALL_FAST_MODEL and the haiku slot. Key environment variables are probed in order — the first set value wins, and the environment always beats the stored key.
What's specific to DeepSeek
DeepSeek is the simplest entry in the catalog: one pay-as-you-go API key, one environment variable, and one model id filling every Claude Code slot.
Do I need a subscription, or does this bill per request?
Per request. DeepSeek's API is pay-as-you-go: you create a key at https://platform.deepseek.com/api_keys and your DeepSeek account is billed for what Claude Code sends. bex deepseek adds nothing in between — the key is injected into the child process and the traffic goes straight to https://api.deepseek.com/anthropic.
Why is the same model id in both model slots?
The catalog gives DeepSeek one id, deepseek-chat, for ANTHROPIC_MODEL and the opus/sonnet slots and the same one for ANTHROPIC_SMALL_FAST_MODEL and the haiku slot. There is no cheaper slot to fall back to, so the short background calls Claude Code would send to haiku are handled like every other one.
Why does bex ignore the key I stored?
Because DEEPSEEK_API_KEY is set. DeepSeek is the only launcher with a single key variable, and the environment always beats the store: a stale exported value is used as-is rather than falling back to keys.toml. Unset it, or run bex code keys set deepseek to replace the stored one.
The other launchers
- GLM (Z.ai coding plan)Use your Z.ai coding plan with Claude Code — GLM's own documented pairing, one command away.
- Muse Spark (Meta Model API)Meta's Muse Spark models behind Claude Code's workflow, keyed through the Meta Model API.
- Kimi (Moonshot platform)Moonshot's Kimi K3 driving Claude Code, with a key from the Moonshot platform console.