DeepSeek V4.1 Flash 在 OpenCode 中免费:配置与限制

OpenCode 中的 DeepSeek V4.1 Flash 免费模型怎么用?本文给出三步配置、200K 上下文等限制、隐私条款,以及需要 API 时的真实成本。

用 Apifox,节省研发团队的每一分钟

DeepSeek V4.1 Flash 在 OpenCode 中免费:配置与限制

免费使用 Apifox

相关推荐

最新文章

API

一体化协作平台

API 设计

API 文档

API 调试

自动化测试

API Mock

API Hub

立即体验 Apifox
目录

2026 年 10 月 15 日,OpenCode 在 X 上发布:“DeepSeek V4.1 Flash 现在在 OpenCode 中免费。”模型 ID 是 opencode/deepseek-v4.1-flash-free,OpenCode Zen 文档称其“在 OpenCode 中限时免费”。我们于 10 月 16 日安装全新 OpenCode,在无需登录、无需 API 密钥的情况下选择该模型,并看它在 32 秒内编写并运行了一个小型 Node.js 脚本。

优惠附带三项限制:免费模型只能在 OpenCode 内使用,不能作为 API;上下文上限 200K token,付费版为 1M;OpenCode 尚未公布结束日期。本文介绍配置、限制影响,以及在自己的代码中使用同一模型的成本。模型背景见 DeepSeek V4.1 Flash 是什么。如果代码要调用 API,Apifox CLI 可以让同一个 Agent 从终端测试。

OpenCode 免费提供了什么

DeepSeek V4.1 Flash 于 2026 年 9 月 10 日在 DeepSeek API 正式可用,权重采用 MIT 许可。OpenCode 通过自己的网关 OpenCode Zen 提供免费版和付费版。对比如下:

DeepSeek V4.1 Flash 的访问路径:OpenCode 免费、Zen API、Go 套餐、DeepSeek API
路径 价格 上下文 / 最大输出 适用范围
OpenCode,deepseek-v4.1-flash-free 限时 $0 200K / 32K token 仅 OpenCode 内部
OpenCode Zen,deepseek-v4.1-flash 每 100 万 token 输入 $0.30 / 输出 $1.20 1M / 384K 任何持有 Zen API 密钥的客户端
OpenCode Go 套餐 每月 $10;该模型每月用量上限 $80 1M / 384K OpenCode 内部
DeepSeek API,deepseek-flash 非高峰每 100 万 token 输入 $0.15 / 输出 $0.60 1M / 384K 任何客户端

限制来自 OpenCode 随附的模型元数据,可用 opencode models opencode --verbose 查看。价格来自 Zen 文档、Go 文档和 DeepSeek 定价页,核查于 10 月 16 日。

如何在 OpenCode 中免费使用

第一次使用?OpenCode 概览介绍了这个 Agent。配置分三步。

1. 安装 OpenCode

官方脚本适用于 macOS 和 Linux:

curl -fsSL https://opencode.ai/install | bash

也可用 npm install -g opencode-ai 或 brew install anomalyco/tap/opencode。Windows 推荐 WSL;也有 Chocolatey(choco install opencode)和 Scoop(scoop install opencode)包。

2. 选择免费模型

cd ~/code/orders-service
opencode

输入 /models,选择 DeepSeek V4.1 Flash Free。要设为项目默认,在根目录添加 opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "opencode/deepseek-v4.1-flash-free"
}

3. 运行任务

可以在交互式会话中继续工作,也可以直接从 shell 发送一次性任务:

opencode run -m opencode/deepseek-v4.1-flash-free \
  "Create status.js exporting isClientError(code) for 4xx codes, add a node:assert self-test, then run it"

我们的测试结果

我们运行 OpenCode 1.19.2(10 月 16 日的 opencode-ai npm 版本),配置和数据目录为空。opencode models opencode 在十个免费模型中列出 deepseek-v4.1-flash-free。一行问题 5 秒返回;上面的任务耗时 32 秒,模型编写 status.js,用 node 运行,并报告 all tests passed。文件写入和 shell 工具都正常。

没有任何步骤要求登录。Zen 文档中的登录 Console、添加账单和复制 API 密钥针对付费模型;免费模型无需这些。

元数据列出三种推理强度(low、high、max),并启用图片输入,可附上失败 UI 截图。PDF 输入未启用。

“免费”背后的限制

OpenCode 中免费的 DeepSeek V4.1 Flash 与付费 API 的限制对比

只能在 OpenCode 内使用

Zen 文档把免费模型列在 OpenAI 兼容端点旁边,看起来像免费 API,但它不是。从 OpenCode 外调用会被拒绝:

curl https://opencode.ai/inference/openai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek-v4.1-flash-free", "messages": [{"role": "user", "content": "ping"}]}'
{"type":"error","error":{"type":"FreeTierError","message":"OpenCode's free tier can only be used from within OpenCode. Download it at https://opencode.ai and keep building."}}

我们 10 月 16 日得到 HTTP 403,无论是否带 Authorization 请求头。免费层只覆盖在 OpenCode 中编码。应用后端、自己调用 LLM 的脚本,以及 Cursor、Claude Code 等 Agent 都无法使用。

一些社区插件通过本地 opencode serve 转发其他工具的请求,让请求看起来来自 OpenCode。它们依赖未记录的行为,网关检查可能随时变化。

上下文是 200K,不是 1M

付费模型接受 1M 上下文,最多返回 384K;免费版限制输入 200K、输出 32K。200K 足以覆盖大多数编码会话,但在大型 monorepo 或读取大量文件的长时间会话中会更早耗尽;32K 限制单次响应的代码量。需要完整窗口时,用 /models 切换到付费模型。

限时免费,没有结束日期

OpenCode 以前做过类似推广。更早的 deepseek-v4-flash-free 一直在免费列表,直到推广结束;到 2026 年 8 月 21 日,它已从选择器消失,OpenCode 在 GitHub issue #43805 确认移除是有意为之。

预计这次也会同样结束。把模型名放在 opencode.json,而不是脚本里,切换付费模型只需改一行。

隐私性优于大多数免费选项

免费模型并非都以同样方式处理代码。对于 DeepSeek V4.1 Flash Free,Zen 文档称提供商“遵循零保留政策,不会将你的数据用于模型训练”。

并非所有免费模型都如此。Big Pickle 和 MiMo 注明数据“可能用于改进模型”,NVIDIA Nemotron 试用提醒不要提交个人或机密数据。对于私有仓库,DeepSeek 模型是较安全的选择。OpenCode 表示所有 Zen 模型托管在美国和欧盟。

没有公开的速率限制

Zen 和 Console 文档都没有说明免费模型的请求限制。OpenCode 不承诺免费端点的速度或可用性与付费版一致,高峰时可能变慢。

需要 API 时的成本

当模型必须运行在产品内,请选择付费路径。DeepSeek API 每 token 最便宜:非高峰每 100 万输入 token $0.15、输出 $0.60;高峰(周一至周五 UTC 01:00–04:00 和 06:00–10:00)翻倍;缓存命中非高峰每 100 万 token $0.003。Zen 付费版统一 $0.30 和 $1.20,与 DeepSeek 高峰价相同,一个 Zen 密钥可访问网关所有模型。

一个输入 20,000 token、输出 2,000 token 的 Agent 轮次:

  • DeepSeek API 非高峰:0.02 x $0.15 + 0.002 x $0.60 = $0.0042
  • OpenCode Zen 付费:0.02 x $0.30 + 0.002 x $1.20 = $0.0084

一千个轮次在任何缓存折扣前花费 $4.20 或 $8.40。如果每天在 OpenCode 编码而免费推广结束,Go 套餐是折中:每月 $10;按 2026 年 10 月 16 日的 Go 文档,该模型每月用量上限 $80,OpenCode 估计每月约 173,330 次请求。

详细计算见 DeepSeek V4.1 Flash 定价指南;多语言请求代码见如何使用 DeepSeek V4.1 Flash API。

让 OpenCode 用 Apifox CLI 测试 API

免费模型不仅能写代码,还能从同一终端测试代码调用的端点,无需打开 GUI。Apifox CLI 提供读取规范、编写并运行测试的命令。先配置:

npm install -g apifox-cli@latest
apifox login --with-token <YOUR_TOKEN>
npx -y skills add https://apifox.com   # 按提示选择你的 Agent

令牌来自 Apifox 的账号设置 > API 访问令牌。最后一行安装 Apifox 的 Agent skills,教 OpenCode 驱动 CLI。给 Agent 一段提示:

Use Apifox CLI on project <id>. Export the /orders endpoints as OpenAPI and write a
typed TypeScript client from them. Then create a test case for POST /orders that
asserts a 201 and an order id, run it against the dev environment, and summarize
any failures.

它运行的命令(对照 Apifox CLI 2.2.7):

apifox export --project <id> --format openapi --output ./openapi.json
apifox cli-schema get test-case-create
apifox cli-schema validate test-case-create --file case.json
apifox test-case create --project <id> --file case.json
apifox run --test-case <caseId> --project <id> -e <envId> -r cli,json

先导出规范,客户端就匹配团队设计的 API,而不是模型猜测的字段名。每个命令返回 JSON,许多包含 agentHints.nextSteps。如果 CLI 拒绝在主分支写入,请在项目设置 > 功能设置 > 外部 AI 编辑权限(External AI Edit Permissions)中启用,或让 Agent 在 AI 分支工作(apifox branch create --project <id> --type ai --name ai/orders-tests --from main)。同样的 apifox run 加 -r junit 可接入 CI;Apifox CLI CI/CD 流水线有可复制版本。

常见问题

DeepSeek 在 OpenCode 中免费吗? 是。DeepSeek V4.1 Flash(opencode/deepseek-v4.1-flash-free)自 2026 年 10 月 15 日起免费。OpenCode 称其为限时优惠,未给结束日期。

需要 OpenCode 账户或 API 密钥吗? 我们的测试中不需要。全新 OpenCode 1.19.2 无需两者即可运行免费模型。Zen 付费模型需要 Console 的 API 密钥。

可以从自己的代码调用免费模型吗? 不可以。OpenCode 外部的请求返回 403 FreeTierError。请改用 DeepSeek API 或 Zen 付费版。

它是完整的 DeepSeek V4.1 Flash 吗? OpenCode 把它列在付费模型相同的 deepseek-flash 系列,但限制更低:200K 上下文和 32K 输出,而不是 1M 和 384K。其他差异未说明。

OpenCode 会用我的代码训练吗? Zen 文档称该模型提供商零数据保留,不用于训练。列表中其他免费模型条款不同,切换前请确认。

还有其他免费方式吗? 有:MIT 许可权重和 DeepSeek 聊天应用。「DeepSeek V4.1 Flash 全部免费选项」有排名,「DeepSeek 免费吗」覆盖整个模型系列。

趁还能用

免费模型在 32 秒内通过文件和 shell 测试,只要留在 OpenCode 内且不超过 200K token,成本就是 $0。安装 OpenCode,把 opencode/deepseek-v4.1-flash-free 设为模型,并加入 Apifox CLI,让同一个 Agent 测试它构建的东西。把模型名保留在 opencode.json,推广结束时只需改配置。下载 Apifox,打开 Agent 通过 --upload-report 上传的测试报告。