最后更新:
DeepSeek V4.1 Flash API:价格、高峰时段和代码
DeepSeek API 以 deepseek-flash 提供 V4.1 Flash,同时支持 OpenAI 和 Anthropic 格式。价格取决于调用时间:工作日高峰时段是闲时价格的两倍。本页列出完整价格表、多个时区的高峰时段、常见任务的费用以及可直接运行的代码。
官方价格(每百万 token)
| 闲时(美元) | 高峰(美元) | 闲时(人民币) | 高峰(人民币) | |
|---|---|---|---|---|
| 输入(缓存命中) | $0.003 | $0.006 | ¥0.02 | ¥0.04 |
| 输入(缓存未命中) | $0.15 | $0.30 | ¥1 | ¥2 |
| 输出 | $0.60 | $1.20 | ¥4 | ¥8 |
费用从充值余额或赠送余额中扣除(优先扣赠送余额)。DeepSeek 表示价格可能调整。
来源: DeepSeek 模型与价格
各时区的高峰时段
| 时区 | 高峰时段 1 | 高峰时段 2 |
|---|---|---|
| UTC | 01:00–04:00 | 06:00–10:00 |
| 北京(UTC+8) | 09:00–12:00 | 14:00–18:00 |
| 东京 / 首尔(UTC+9) | 10:00–13:00 | 15:00–19:00 |
| 柏林 / 巴黎(CEST,UTC+2) | 03:00–06:00 * | 08:00–12:00 * |
| 美国太平洋时间(PDT,UTC-7) | 18:00–21:00 * | 23:00–03:00 * |
* 夏令时。时钟调整后(欧洲 2026 年 10 月 25 日,美国 2026 年 11 月 1 日),这些时段提前一小时开始。高峰日按 UTC 计为周一至周五,中国法定节假日全天按闲时计费。
来源: DeepSeek 模型与价格
常见任务要花多少钱
两个示例任务,按标价计算,忽略缓存写入费用。A:1,000 次调用,每次 20K 输入 token(一半命中缓存)和 2K 输出。B:100 次长上下文调用,每次 200K 输入 token(90% 命中缓存)和 4K 输出。
| 模型 | 任务 A | 任务 B |
|---|---|---|
| DeepSeek V4.1 Flash,闲时 | $2.73 | $0.59 |
| DeepSeek V4.1 Flash,高峰 | $5.46 | $1.19 |
| Claude Haiku 5.5 | $2.10 | $2.90(长提示词价格) |
| Gemini 3.8 Flash(首发价) | $15.75 | $4.35 |
短提示词下 Haiku 5.5 更便宜(100K token 以内 $0.10 / $0.50),超过后变为 $0.50 / $2.50;DeepSeek 在整个 1M 上下文内只有一个价格,缓存命中也便宜得多。各家分词器计算的 token 数不同,请用自己的提示词实测。
与 Gemini 3.8 Flash、Haiku 5.5 的完整对比
来源: DeepSeek 模型与价格
来源: Anthropic 价格文档
来源: Gemini API 价格
用 curl 发起第一次调用
- 在 DeepSeek 开放平台创建 API key 并充值。
- 把 key 保存为环境变量 DEEPSEEK_API_KEY。
- 向 https://api.deepseek.com/chat/completions 发送 POST 请求,模型填 deepseek-flash。
curl https://api.deepseek.com/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DEEPSEEK_API_KEY}" \
-d '{
"model": "deepseek-flash",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"thinking": {"type": "enabled"},
"reasoning_effort": "high",
"stream": false
}'Python(OpenAI SDK)与思考模式
思考模式默认开启,强度为 high。reasoning_effort 可取 low、high 和 max;在 OpenAI SDK 中,思考开关要放在 extra_body 里。做简单分类或信息抽取时可以关闭思考,节省输出 token。
# pip install openai
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["DEEPSEEK_API_KEY"], base_url="https://api.deepseek.com")
response = client.chat.completions.create(
model="deepseek-flash",
messages=[{"role": "user", "content": "Explain this stack trace in two sentences: ..."}],
reasoning_effort="high", # low / high / max
extra_body={"thinking": {"type": "enabled"}}, # "disabled" for fast, non-thinking replies
)
print(response.choices[0].message.content)来源: DeepSeek 思考模式指南
Anthropic SDK
同一模型也可以通过 https://api.deepseek.com/anthropic 以 Anthropic Messages 格式调用。以 claude 开头的模型名会被映射:claude-opus 系列映射到 deepseek-v4-pro,其他 claude 名称映射到 deepseek-flash;其他未知名称会返回错误。
# pip install anthropic
# export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
# export ANTHROPIC_API_KEY=<your DeepSeek API key>
import anthropic
client = anthropic.Anthropic()
message = client.messages.create(
model="deepseek-flash",
max_tokens=1000,
messages=[{"role": "user", "content": "Hi, how are you?"}],
)
print(message.content)在 Claude Code 中使用 DeepSeek V4.1 Flash
DeepSeek 为 Claude Code 公布了以下环境变量(macOS 和 Linux;Windows 下在 PowerShell 中用 $env: 设置同名变量)。然后在项目目录中运行 claude。
- 全新安装需要 Node.js 18 或更高版本(npm install -g @anthropic-ai/claude-code);Windows 还需要安装 Git for Windows。
- Claude Code 原生支持联网搜索,2026 年 11 月 1 日免费期结束后,按 Search API 调用次数加模型 token 计费。
- Claude Code 是 Anthropic 的工具;将它接入第三方接口由 DeepSeek 提供配置和支持,而非 Anthropic。
export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_AUTH_TOKEN=<your 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
cd /path/to/your-project
claude来源: DeepSeek 指南:接入 Claude Code
来源: DeepSeek 模型与价格
常见问题
DeepSeek V4.1 Flash 的 API 模型名是什么?
deepseek-flash。旧名称 deepseek-v4-flash 和 deepseek-v4-flash-vision-exp 仍然可用,按相同价格计费。
DeepSeek V4.1 Flash API 多少钱?
闲时每百万输入/输出 token $0.15 / $0.60,高峰 $0.30 / $1.20,缓存命中 $0.003 / $0.006。
DeepSeek API 什么时候更便宜?
工作日 UTC 01:00–04:00 和 06:00–10:00 以外的时间、整个周末以及中国法定节假日。这些闲时价格是高峰价格的一半。
DeepSeek V4.1 Flash 能用 OpenAI SDK 调用吗?
可以。把 base_url 设为 https://api.deepseek.com,model 设为 deepseek-flash。思考相关设置通过 extra_body 传入。
能在 Claude Code 里用 DeepSeek V4.1 Flash 吗?
可以。按 DeepSeek 指南,把 ANTHROPIC_BASE_URL 设为 https://api.deepseek.com/anthropic,在 ANTHROPIC_AUTH_TOKEN 中填入 DeepSeek key,并把模型相关变量设为 deepseek-flash。
有什么速率限制?
DeepSeek 为 deepseek-flash 列出的并发上限为 2,500 个请求。
独立教程站,与 DeepSeek、Google 及 Anthropic 无关联。价格和模型版本经常变化,正式使用前请以链接的官方页面为准。