DeepSeek V4.1 Flash Xploded in Claude Code

DeepSeek V4.1 Flash Xploded in Claude Code

Run deepseek-v4.1-flash-xploded as the model behind Claude Code through MagmaRouter, with a hard spend cap on the key and no prompt retention.

An uncensored DeepSeek V4.1 Flash: a million tokens of context, tool calling and reasoning you can turn down or off per request, and the longest replies on the line at up to 393,216 tokens. Text only, so it cannot read a screenshot.

Model iddeepseek-v4.1-flash-xploded
Context1.05M tokens
Input price$0.30 / million tokens
Output price$1.50 / million tokens
Tool callingSupported

Set it up

Point Claude Code's base URL at MagmaRouter (no /v1), set the auth token to your key, name this model, and set the context length to its real value of 1,048,576:

# Put these in your shell profile, then run: claude
export ANTHROPIC_BASE_URL=https://api.magmarouter.com
export ANTHROPIC_AUTH_TOKEN=sk-mr-...
export ANTHROPIC_MODEL=deepseek-v4.1-flash-xploded
export ANTHROPIC_DEFAULT_HAIKU_MODEL=glm-5.3-xploded
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=1048576

Or put the same values under env in ~/.claude/settings.json:

// ~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.magmarouter.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-mr-...",
    "ANTHROPIC_MODEL": "deepseek-v4.1-flash-xploded",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.3-xploded",
    "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "1048576"
  }
}

ANTHROPIC_DEFAULT_HAIKU_MODEL is the cheap background model, set to glm-5.3-xploded above. CLAUDE_CODE_MAX_CONTEXT_TOKENS is set because Claude Code assumes 200K for an id it does not recognise. Use ANTHROPIC_AUTH_TOKEN and leave ANTHROPIC_API_KEY unset. Full setup and every caveat is in the Claude Code guide.

Tool calling Claude Code reads, edits and runs commands only through tool calls, so the model you set here must support tool calling. A model without it can chat but cannot touch your files.

FAQ

Can DeepSeek V4.1 Flash Xploded edit files and run commands in Claude Code?

Yes. It supports tool calling, which is what Claude Code needs to use its Read, Edit, Write and Bash tools. A model without tool calling could only chat.

How much does it cost?

$0.30 per million input tokens and $1.50 per million output tokens through MagmaRouter. Put a spend cap on the key so an agent loop cannot overrun it.

Is this an official Anthropic setup?

No. Anthropic does not officially support routing Claude Code to non-Claude models through a gateway. It works because MagmaRouter translates the Messages API, but it is not a configuration Anthropic backs.

Other models for Claude Code