A TINY FIELD GUIDE
Set up DeepSeek V4.1 Flash in Claude Code.
V4.1 Flash, in a separate profile. Your existing Claude Code. No extra tools.
This guide uses only environment variables to set up DeepSeek in a separate profile, keeping your regular Claude Code settings and login unchanged.
1Choose your provider.
Let your agent set it up via Hugging Face.
Plain text ↗Paste into your coding agent. Uses the selected provider.Hugging Face automatically selects the fastest provider, with failover. Use an HF token with Inference Providers permission. Get a key ↗
| Environment variable | Value |
|---|---|
CLAUDE_CONFIG_DIR | Absolute path to a separate folder named claude-deepseek (not a command). |
ANTHROPIC_BASE_URL | https://router.huggingface.co |
ANTHROPIC_AUTH_TOKEN | Your HF token (Make calls to Inference Providers permission). |
ANTHROPIC_API_KEY | The same HF token. |
Use this exact model ID for the main conversation, aliases, and subagents.
| Environment variable | Value |
|---|---|
ANTHROPIC_MODEL | deepseek-ai/DeepSeek-V4.1-Flash |
ANTHROPIC_DEFAULT_FABLE_MODEL | deepseek-ai/DeepSeek-V4.1-Flash |
ANTHROPIC_DEFAULT_OPUS_MODEL | deepseek-ai/DeepSeek-V4.1-Flash |
ANTHROPIC_DEFAULT_SONNET_MODEL | deepseek-ai/DeepSeek-V4.1-Flash |
ANTHROPIC_DEFAULT_HAIKU_MODEL | deepseek-ai/DeepSeek-V4.1-Flash |
CLAUDE_CODE_SUBAGENT_MODEL | deepseek-ai/DeepSeek-V4.1-Flash |
CLAUDE_CODE_SUBAGENT_MODEL_FORCE | 1 |
Choose 1M-capable providers in OpenRouter routing settings. Io Net currently exposes only 262,144 tokens: exclude it for this 1M / 400K setup. Get a key ↗
| Environment variable | Value |
|---|---|
CLAUDE_CONFIG_DIR | Absolute path to a separate folder named claude-deepseek (not a command). |
ANTHROPIC_BASE_URL | https://openrouter.ai/api |
ANTHROPIC_AUTH_TOKEN | Your OpenRouter API key. |
ANTHROPIC_API_KEY | Empty string (explicitly set blank). |
Use this exact model ID for the main conversation, aliases, and subagents.
| Environment variable | Value |
|---|---|
ANTHROPIC_MODEL | deepseek/deepseek-v4.1-flash |
ANTHROPIC_DEFAULT_FABLE_MODEL | deepseek/deepseek-v4.1-flash |
ANTHROPIC_DEFAULT_OPUS_MODEL | deepseek/deepseek-v4.1-flash |
ANTHROPIC_DEFAULT_SONNET_MODEL | deepseek/deepseek-v4.1-flash |
ANTHROPIC_DEFAULT_HAIKU_MODEL | deepseek/deepseek-v4.1-flash |
CLAUDE_CODE_SUBAGENT_MODEL | deepseek/deepseek-v4.1-flash |
CLAUDE_CODE_SUBAGENT_MODEL_FORCE | 1 |
Values only, not a shell script. Use your OS’s environment settings; Claude Code does not automatically read a .env file.
2Set context & task tracking.
| Environment variable | Value |
|---|---|
CLAUDE_CODE_MAX_CONTEXT_TOKENS | 1000000 |
CLAUDE_CODE_AUTO_COMPACT_WINDOW | 400000 |
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC | 1 |
CLAUDE_CODE_ENABLE_TODO_TOOLS | 1 |
Task tracking is explicitly enabled for custom models. The same 1M / 400K settings as our DeepSeek profile. The compaction window is a budget, not a guarantee of the exact trigger token. Use a route supporting at least 1M tokens; these variables do not increase provider capacity.
3Launch Claude Code.
A profile is a folder for Claude Code’s settings, login, and conversations. Here, claude-deepseek is that folder’s name; setting CLAUDE_CONFIG_DIR does not create a command with that name.
Run claude from your project with the custom environment. To return to native Claude, use a fresh terminal without those overrides.
Compatibility & profile details
Both services expose Anthropic-compatible endpoints. Hugging Face / Novita and OpenRouter were tested with Claude Code on 11 September 2026. Claude Code features may behave differently with non-Claude models.
Our original launcher also uses --dangerously-skip-permissions. That optional CLI flag bypasses permission checks; it is not needed for this connection.
Remove inherited OAuth credentials and cloud-provider selectors from the custom launch environment. A separate profile does not isolate project instructions, managed policies, or your filesystem.
Read the agent instructions
Set up a separate DeepSeek V4.1 Flash profile using Hugging Face and these environment variables. Use the existing Claude Code install (2.1.257+); no extra tools or setup script. CLAUDE_CONFIG_DIR = Absolute path to a separate folder named claude-deepseek (not a command). ANTHROPIC_BASE_URL = https://router.huggingface.co ANTHROPIC_AUTH_TOKEN = Your HF token (Make calls to Inference Providers permission). ANTHROPIC_API_KEY = The same HF token. ANTHROPIC_MODEL = deepseek-ai/DeepSeek-V4.1-Flash ANTHROPIC_DEFAULT_FABLE_MODEL = deepseek-ai/DeepSeek-V4.1-Flash ANTHROPIC_DEFAULT_OPUS_MODEL = deepseek-ai/DeepSeek-V4.1-Flash ANTHROPIC_DEFAULT_SONNET_MODEL = deepseek-ai/DeepSeek-V4.1-Flash ANTHROPIC_DEFAULT_HAIKU_MODEL = deepseek-ai/DeepSeek-V4.1-Flash CLAUDE_CODE_SUBAGENT_MODEL = deepseek-ai/DeepSeek-V4.1-Flash CLAUDE_CODE_SUBAGENT_MODEL_FORCE = 1 CLAUDE_CODE_MAX_CONTEXT_TOKENS = 1000000 CLAUDE_CODE_AUTO_COMPACT_WINDOW = 400000 CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = 1 CLAUDE_CODE_ENABLE_TODO_TOOLS = 1 Keep changes scoped to this profile, preserving native Claude settings and running sessions. Use a locally supplied key without displaying it. Ask only for missing setup details. Check for conflicting settings. In this profile’s launch environment only, clear inherited OAuth/cloud-provider overrides and unset DISABLE_AUTO_COMPACT and DISABLE_COMPACT. Report conflicts requiring changes elsewhere. The profile name claude-deepseek is a folder name, not an automatically created command. List changed files and give the OS-appropriate command to launch the existing claude binary with this profile’s environment. Keep normal permission checks. Leave launching and testing to me; do not start a session or make inference calls. References: https://code.claude.com/docs/en/env-vars https://huggingface.co/docs/inference-providers/en/integrations/claude-code https://router.huggingface.co/v1/models
Have a better setup?
Share your tips or improvements. Let’s discuss ↗