Blog

How to Set Up DeepSeek V4 Flash in Claude Code, Cursor, and Codex | TeamoRouter

Quick Answer

DeepSeek V4 Flash is the cheapest major coding model of 2026 at $0.14/$0.28 per million tokens — and through TeamoRouter, it now comes with a free tier (50 requests/day, model ID deepseek-v4-flash-free) that new users get automatically. This guide walks you through configuring V4 Flash in five tools — Claude Code, Cursor, Codex, Cline, and OpenClaw — in under five minutes each. Every configuration uses TeamoRouter as the unified API gateway so you manage one key across all your tools.

Why Set Up V4 Flash Across Multiple Tools

Most developers use different tools for different phases of work: Claude Code for heavy terminal-based agent loops, Cursor for interactive editing, Codex for OpenAI-native automation, Cline for VS Code tasks, and OpenClaw for lightweight scripting. Configuring V4 Flash in every tool means you can reach for the cheapest capable model no matter which environment you are in.

The free tier makes this a zero-cost experiment. You get 50 requests per day on deepseek-v4-flash-free — the exact same model binary as the paid deepseek-v4-flash, only rate-limited. If you hit the cap, the paid tier is $0.14/$0.28 per million tokens, which is still roughly 36x cheaper than GPT-5.6 Sol and 21x cheaper than Claude Sonnet 4.6 on input.

Prerequisites: Get Your TeamoRouter Key

All five configurations below use TeamoRouter as the gateway. One key, every model, every protocol.

  1. Sign up at TeamoRouter (Alipay, WeChat Pay, or card supported).
  2. Navigate to the API Keys page in the dashboard.
  3. Create a new key and copy it — it will look like tr-xxxxxxxxxxxx.

The free tier with model ID deepseek-v4-flash-free is auto-activated for new accounts. No separate registration, no credit card hold, no trial expiration. You can start making requests immediately.

Tool-by-Tool Setup

1. Claude Code

Claude Code speaks the Anthropic Messages API natively. To route it through TeamoRouter and use V4 Flash as the model, set three environment variables:

bash
export ANTHROPIC_BASE_URL="https://api.teamorouter.com/anthropic"
export ANTHROPIC_API_KEY="tr-your-key-here"
export ANTHROPIC_MODEL="deepseek-v4-flash-free"

Then launch Claude Code as usual:

bash
claude

Claude Code will now use V4 Flash for every request. For the free tier, use deepseek-v4-flash-free; switch to deepseek-v4-flash for the paid tier (no request cap, same model binary).

Note: Because V4 Flash is served through an Anthropic-compatible gateway, all of Claude Code's native features — tool use, file editing, bash execution, MCP servers — work unchanged. The model receives the same structured tool definitions Claude Code always sends. The only difference is which model processes them.

If you want to keep Claude Code on a Claude model for hard tasks and use V4 Flash for simpler work, you can switch models per session:

bash
# Hard architectural work — Claude Sonnet
ANTHROPIC_MODEL="claude-sonnet-4-6" claude

# High-volume edits — V4 Flash free tier
ANTHROPIC_MODEL="deepseek-v4-flash-free" claude

2. Cursor

Cursor supports custom OpenAI-compatible API providers through its model configuration. This is the simplest setup in the list.

  1. Open Cursor Settings (Cmd+Shift+J or Ctrl+Shift+J).
  2. Go to the Models tab.
  3. Under "OpenAI API Key", toggle "Use your own API key."
  4. Set the Base URL to https://api.teamorouter.com/v1.
  5. Paste your TeamoRouter API key.
  6. Add a custom model with the ID deepseek-v4-flash-free (or deepseek-v4-flash for paid).

Cursor will now show V4 Flash in the model picker. You can select it for chat, inline editing, and the Composer.

The equivalent configuration via cursor.json (for automated setup):

json
{
  "openai": {
    "baseUrl": "https://api.teamorouter.com/v1",
    "apiKey": "tr-your-key-here",
    "models": ["deepseek-v4-flash-free"]
  }
}

3. Codex

Codex (OpenAI's agent CLI) is OpenAI-compatible by default. Point it at TeamoRouter with two environment variables:

bash
export OPENAI_BASE_URL="https://api.teamorouter.com/v1"
export OPENAI_API_KEY="tr-your-key-here"

Then run Codex and specify the model:

bash
codex --model deepseek-v4-flash-free

To make this persistent, add it to your shell profile (~/.zshrc or ~/.bashrc):

bash
# TeamoRouter + DeepSeek V4 Flash for Codex
export OPENAI_BASE_URL="https://api.teamorouter.com/v1"
export OPENAI_API_KEY="tr-your-key-here"

And set the default model in Codex's config.toml (~/.codex/config.toml):

toml
[model]
default = "deepseek-v4-flash-free"

[provider.openai]
base_url = "https://api.teamorouter.com/v1"
api_key = "tr-your-key-here"

Now every Codex session defaults to V4 Flash. Switch models with --model on the command line when you need V4 Pro or a Claude model.

4. Cline (VS Code Extension)

Cline is a VS Code extension that acts as an autonomous coding agent inside your editor. It supports custom OpenAI-compatible providers natively.

  1. Open the Cline sidebar in VS Code.
  2. Click the settings gear icon.
  3. Under API Provider, select OpenAI Compatible.
  4. Set the Base URL to https://api.teamorouter.com/v1.
  5. Paste your TeamoRouter API key.
  6. Set Model ID to deepseek-v4-flash-free (free) or deepseek-v4-flash (paid).

Cline will immediately start using V4 Flash for all agent operations — file reads, edits, terminal commands, and browser actions. The free tier is particularly useful in Cline because agent loops tend to make many small requests; 50 requests per day covers a solid session of iterative coding.

5. OpenClaw / opencode

OpenClaw and opencode (terminal-based coding agents) both read from opencode.json. Configure it once:

json
{
  "provider": {
    "openai": {
      "baseUrl": "https://api.teamorouter.com/v1",
      "apiKey": "tr-your-key-here"
    }
  },
  "model": "deepseek-v4-flash-free"
}

Save this as ~/.config/opencode/opencode.json (OpenClaw) or opencode.json in your project root (opencode). Then run:

bash
opencode "Add input validation to the user signup endpoint"

Both tools are lightweight and agentic — perfect for V4 Flash's fast, cheap execution style.

Quick-Reference: Tool vs Protocol Support

Not every tool speaks the same protocol. This table shows which tools work with which protocol and how to configure V4 Flash in each.

Tool Protocol Config Method Free Model ID
Claude Code Anthropic Messages ANTHROPIC_BASE_URL, ANTHROPIC_MODEL env vars deepseek-v4-flash-free
Cursor OpenAI Chat Settings UI or cursor.json deepseek-v4-flash-free
Codex OpenAI Chat OPENAI_BASE_URL env var + config.toml deepseek-v4-flash-free
Cline OpenAI Chat VS Code extension settings deepseek-v4-flash-free
OpenClaw / opencode OpenAI Chat opencode.json deepseek-v4-flash-free
Direct API (curl) OpenAI or Anthropic base_url in request deepseek-v4-flash-free

TeamoRouter handles the protocol translation. You set the same API key in every tool, and the gateway routes requests to the correct model endpoint — whether the tool speaks Anthropic or OpenAI format. This is the core value of using a unified gateway: you configure once per protocol, not once per model.

Quick API Test (curl)

Before diving into tool configuration, verify your key works with a direct curl call:

bash
curl -s https://api.teamorouter.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer tr-your-key-here" \
  -d '{
    "model": "deepseek-v4-flash-free",
    "messages": [{"role": "user", "content": "Say hello in exactly three words."}]
  }' | jq '.choices[0].message.content'

If you get a three-word response, your key is active and the free tier is working. Now any of the tool configurations above will work.

For the Anthropic-compatible endpoint (used by Claude Code):

bash
curl -s https://api.teamorouter.com/anthropic/v1/messages \
  -H "Content-Type: application/json" \
  -H "x-api-key: tr-your-key-here" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "deepseek-v4-flash-free",
    "max_tokens": 100,
    "messages": [{"role": "user", "content": "Say hello in exactly three words."}]
  }' | jq '.content[0].text'

Free Tier vs Paid Tier: Which Model ID to Use

Both tiers run the identical model binary — same weights, same architecture (284B MoE with 13B active parameters), same 1M-token context window, same thinking-mode-on-by-default behavior. The only difference is the rate limit:

Tier Model ID Rate Limit Price
Free deepseek-v4-flash-free 50 requests/day $0
Paid deepseek-v4-flash 2,500 concurrent (account-level) $0.14/$0.28 per M tokens

If you exceed 50 requests in a day on the free tier, you will get a 429 rate-limit response. The paid tier removes this cap entirely — you pay per token at the standard V4 Flash rate. Switching from free to paid is a one-word change in your model ID: deepseek-v4-flash-free becomes deepseek-v4-flash. Every configuration above works identically for both.

Troubleshooting: Common Setup Errors and Fixes

"Model not found" or 404 error

Cause: The model ID is misspelled or you are using a model ID not available on your account. Fix: Verify the model ID is exactly deepseek-v4-flash-free (free) or deepseek-v4-flash (paid). Check the TeamoRouter dashboard under Available Models to confirm the model is listed for your account.

401 Unauthorized

Cause: The API key is missing, expired, or incorrectly formatted. Fix: Check that the key starts with tr-. In Claude Code, the env var is ANTHROPIC_API_KEY (not OPENAI_API_KEY). In OpenAI-compatible tools, the header is Authorization: Bearer tr-.... Regenerate the key from the TeamoRouter dashboard if needed.

429 Too Many Requests

Cause: You have hit the free tier's 50 requests/day cap. Fix: Wait for the daily reset (midnight UTC), or switch the model ID to deepseek-v4-flash to move to the paid tier. Ensure your TeamoRouter account has a positive balance.

Claude Code says "unsupported model" or falls back to a default

Cause: The ANTHROPIC_MODEL environment variable is not set, or the gateway does not recognize the model ID. Fix: Run echo $ANTHROPIC_MODEL to confirm the variable is set in your current shell. Make sure it is exactly deepseek-v4-flash-free or deepseek-v4-flash. If you set it in ~/.zshrc, source the file (source ~/.zshrc) or open a new terminal.

Cursor shows an error on first request

Cause: The Base URL might have a trailing slash issue, or Cursor is sending the request to the wrong endpoint. Fix: Set the Base URL to exactly https://api.teamorouter.com/v1 — no trailing slash. Verify the API key is pasted correctly (no leading/trailing spaces). Restart Cursor after saving the settings.

Codex ignores the OPENAI_BASE_URL variable

Cause: The variable might be set in the wrong shell profile, or Codex was launched before the variable was exported. Fix: Run export | grep OPENAI before launching Codex to confirm both variables are set. For a persistent fix, add the exports to ~/.zshrc and restart your terminal. Alternatively, use the config.toml approach described above — it is more reliable across sessions.

High latency or slow responses on the free tier

Cause: The free tier may have lower priority in the request queue during peak hours. Fix: This is expected for a free service. For latency-sensitive work, switch to the paid model ID deepseek-v4-flash. The paid tier has dedicated capacity and lower queuing delay. You can also schedule batch work outside Beijing peak hours (9am-12pm, 2pm-6pm Beijing time) when the shared infrastructure is under less load.

Maximizing Your Free Tier

Fifty requests per day goes further than it sounds if you are intentional about how you use them:

  1. Batch related edits into a single prompt. Instead of three separate "fix this function" requests, combine them into one structured prompt with numbered steps.
  2. Use the 1M context window. V4 Flash can read an entire codebase in one request. Dump the relevant files into the context instead of making multiple read-and-edit cycles.
  3. Reserve V4 Flash for execution, not planning. Write your plan in a text editor, then give V4 Flash one well-structured prompt to implement it. This makes each request count.
  4. Fall back to the paid tier when you hit the cap. At $0.14/$0.28 per million tokens, even a heavy coding day costs pocket change. A 1M-token input + 500K-token output session costs roughly $0.28.

FAQ

Do I need separate API keys for different tools?

No. TeamoRouter gives you one API key that works across all five tools — and every model the gateway supports. The same key that powers V4 Flash in Cursor also works for Claude Opus 4.8 in Claude Code and GPT-5.6 Sol in Codex. Billing is unified; you see all usage in one dashboard.

Can I use the free tier in multiple tools simultaneously?

Yes. The 50 requests/day limit is per account, not per tool. You can use your free requests across Claude Code, Cursor, Codex, Cline, and OpenClaw in any combination. The counter resets daily at midnight UTC.

Does V4 Flash support vision or image inputs?

No. V4 Flash (both free and paid) is text-only. For multimodal tasks, switch to GPT-5.6 Sol or a Claude model through the same TeamoRouter key. The model picker in each tool makes this a one-click change.

Is the free tier really unlimited in time?

Yes. There is no trial expiration, no credit card requirement, and no "first month only" restriction. The 50 requests/day free tier is a permanent offering for all TeamoRouter users. DeepSeek and TeamoRouter have not announced any end date.

What happens to my data when I use the free tier?

TeamoRouter routes requests to DeepSeek's API. DeepSeek's data policy applies — refer to their current terms. TeamoRouter does not log or store prompt/response content; it only tracks token counts and request metadata for billing and rate limiting.

Can I switch between free and paid mid-session?

Yes. The only change is the model ID string in your tool configuration. Swap deepseek-v4-flash-free for deepseek-v4-flash in Claude Code's ANTHROPIC_MODEL, Cursor's model picker, or Codex's config.toml. All other settings (base URL, API key) stay the same.

What if my tool does not support custom endpoints?

All five tools covered in this guide support custom endpoints. If you are using a tool not listed here, check whether it supports OpenAI-compatible or Anthropic-compatible custom base URLs. If it does, the same configuration pattern applies: set the base URL to https://api.teamorouter.com/v1 (OpenAI) or https://api.teamorouter.com/anthropic (Anthropic), use your TeamoRouter key, and specify the model ID.

The Bottom Line

Setting up DeepSeek V4 Flash across your tools takes under five minutes per tool and gives you a zero-cost coding model everywhere you work. The free tier removes the last barrier to trying a frontier-class model — you can run a full development session on deepseek-v4-flash-free without spending anything, and if the quality surprises you (it usually does), the paid tier at $0.14/$0.28 per million tokens is the cheapest major API available.

TeamoRouter makes the multi-tool setup trivial: one key, two base URLs (one for OpenAI-compatible tools, one for Anthropic-compatible), and the same model ID everywhere. Start with the curl test above, configure your primary tool, and you will be coding with V4 Flash in minutes.

Start Coding Free with TeamoRouter →

One key, every tool, zero cost to start. DeepSeek V4 Flash free tier available now on TeamoRouter.

Ready to connect?Log in · top up · create an API key — three steps to start.
How to Set Up DeepSeek V4 Flash in Claude Code, Cursor, and Codex | TeamoRouter · TeamoRouter