前言

2026年4月24日,DeepSeek 发布 V4 Preview 版,推出 V4-Pro(旗舰)和 V4-Flash(轻量)两款模型,均支持 100万 token 超长上下文。

本文介绍:① V4 核心参数 ② 国内中转站接入方案 ③ 完整 Python 代码示例。


DeepSeek V4 参数对比

参数 V4-Pro V4-Flash
总参数 1.6T(激活49B) 284B(激活13B)
最大上下文 1,000,000 tokens 1,000,000 tokens
输入(缓存未命中) ¥12/M ¥1/M
输入(缓存命中) ¥1/M ¥0.2/M
输出 ¥24/M ¥2/M
SWE-bench Verified 83.7%

注意: deepseek-chatdeepseek-reasoner 将于 2026年7月24日退役,请使用新 model ID:deepseek-v4-flash / deepseek-v4-pro


国内接入方案

直连 DeepSeek 官方 API 在国内网络环境下可能不稳定。推荐使用 数眼智能(shuyanai.com) 中转服务,已于今日完成 V4 接入,定价与官方一致。


Python 完整示例代码

from openai import OpenAI

# 数眼智能接入配置
client = OpenAI(
    api_key="sk-xxx",           # 在 shuyanai.com 后台获取
    base_url="https://platform.shuyanai.com"
)

# V4-Flash:日常对话、代码补全
def chat_v4_flash(prompt: str) -> str:
    resp = client.chat.completions.create(
        model="deepseek-v4-flash",
        messages=[{"role": "user", "content": prompt}],
        max_tokens=4096
    )
    return resp.choices[0].message.content

# V4-Pro:复杂推理、大文件分析
def chat_v4_pro(prompt: str, context: str = "") -> str:
    messages = []
    if context:
        messages.append({"role": "system", "content": context})
    messages.append({"role": "user", "content": prompt})

    resp = client.chat.completions.create(
        model="deepseek-v4-pro",
        messages=messages,
        max_tokens=8192
    )
    return resp.choices[0].message.content

# 示例调用
if __name__ == "__main__":
    result = chat_v4_flash("用 Python 实现二叉树的中序遍历")
    print(result)

    with open("large_codebase.py", "r") as f:
        code = f.read()
    review = chat_v4_pro("请对以下代码进行安全审查,找出潜在漏洞", context=code)
    print(review)

旧代码迁移(一行搞定)

# 旧代码(7月24日后失效)
model="deepseek-chat"

# 新代码(等价替换)
model="deepseek-v4-flash"

总结

DeepSeek V4 今日上线,数眼智能已完成接入。V4-Flash 适合高频调用场景;V4-Pro 代码能力(SWE-bench 83.7%)在旗舰模型中表现突出,1M 上下文适合大型项目分析。

API Key 申请:shuyanai.com

Logo

欢迎加入DeepSeek 技术社区。在这里,你可以找到志同道合的朋友,共同探索AI技术的奥秘。

更多推荐