Use DeepSeek V4.1 Flash in Claude Code: setup guide

Set up Claude Code with DeepSeek's Anthropic endpoint, deepseek-flash[1m] for the main model and deepseek-flash for subagents. Verify the route and billing.

A desk lamp drawn in black ink on pale card, a muted background and the title DeepSeek V4.1 Flash.

Claude Code can connect to DeepSeek V4.1 Flash through https://api.deepseek.com/anthropic. DeepSeek’s documented setup uses deepseek-flash[1m] for the main, Opus and Sonnet selections, and deepseek-flash for Haiku and subagents. Those distinctions appear in the official Claude Code integration guide.

This guide was checked on September 10, 2026, against the direct DeepSeek documentation. We have not run paid inference or verified a successful Claude Code task. The release overview and API setup guide explain the model and its direct API access.

Configure an existing Claude Code installation

First check that claude --version works. If Claude Code is absent, install it using the current Claude Code installation instructions before applying provider settings. Obtain a DeepSeek API key from the DeepSeek Platform.

For macOS or Linux, use these settings in the terminal from which you will launch Claude Code. Replace the token placeholder locally. Quoting the model names keeps the [1m] suffix from being interpreted as a shell filename pattern:

export ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic"
export ANTHROPIC_AUTH_TOKEN="REPLACE_WITH_DEEPSEEK_API_KEY"
export ANTHROPIC_MODEL="deepseek-flash[1m]"
export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-flash[1m]"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-flash[1m]"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-flash"
export CLAUDE_CODE_SUBAGENT_MODEL="deepseek-flash"
export CLAUDE_CODE_EFFORT_LEVEL="max"
export CLAUDE_CODE_AUTO_COMPACT_WINDOW="786432"

These are the values in DeepSeek’s published integration, including the effort and compaction settings. The [1m] form is a client integration setting; the direct API model name remains deepseek-flash. Do not append the suffix to every API request by assumption.

Windows users can use the equivalent $env:NAME="value" assignments listed in the official guide. Keep credentials out of project files and shared terminal transcripts. Start with session-level settings so your existing provider setup remains easy to restore.

Check every model selection, not just the main one

The Opus, Sonnet, Haiku and subagent variables matter because a workflow can select more than its main model. Keeping an old default can leave some requests on a different route.

DeepSeek also documents automatic mappings for incoming Claude model names: claude-opus names map to V4 Pro, while claude-haiku and claude-sonnet names map to Flash. Its guide says the Opus mapping retains Pro billing until September 14, 2026, at 12:00 Beijing time (UTC+8). After that, Pro requests move to Flash and Flash billing. See the Pro migration guide for the scheduled change.

That is why the explicit Flash settings above are preferable when your goal is to evaluate V4.1 Flash now. A familiar Claude label does not prove which DeepSeek model or rate served the request.

Validate a small workflow and its cost

Enter a test project and run claude from the configured terminal. Ask it to explain one file before requesting a bounded edit. Check the resulting diff, tool behavior and test outcome; if your normal workflow delegates work, verify that path too.

Inspect the provider’s usage and billing records for the task. Our example is a setup procedure, not evidence of tested speed, savings or equivalent coding quality. The Flash pricing guide separates input cache hits, misses, output and peak/off-peak pricing.

If authentication fails, check the key and endpoint together. A request-format problem needs the response’s error details; repeatedly changing model names will not repair an incorrect protocol. Codex uses a different setup through the Responses API.

For a gateway such as Ofox, verify its actual model ID, Anthropic support and account price before replacing these direct-provider settings. The Ofox catalog is a place to begin that check; this article does not confirm that V4.1 Flash is available through Ofox or that signing up enables it.

Frequently Asked Questions

What model name should I set in Claude Code for DeepSeek V4.1 Flash?
DeepSeek's official integration sets ANTHROPIC_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL and ANTHROPIC_DEFAULT_SONNET_MODEL to deepseek-flash[1m]. It uses deepseek-flash without the suffix for Haiku and subagents.
Which base URL does the direct DeepSeek integration use?
Set ANTHROPIC_BASE_URL to https://api.deepseek.com/anthropic and authenticate with a DeepSeek API key in ANTHROPIC_AUTH_TOKEN. Do not substitute the Codex Responses configuration.
Does selecting a Claude Opus alias guarantee Flash billing?
No. DeepSeek documents claude-opus names as mapping to V4 Pro, with Pro billing until September 14, 2026, at 12:00 Beijing time. Use the explicit Flash settings and check provider usage records.