DeepSeek V4.1 FlashQwen3.8 Flash编码成本开源
Qwen vs DeepSeek:一个用一半的 token 价格赢了
100% 有帮助0% 没帮助
测试的模型
- 模型 A:Qwen3.8 Flash(
qwen3.8-flash),通过 oh-my-pi(omp)运行,思考级别 medium - 模型 B:DeepSeek V4.1 Flash(
deepseek-v4.1-flash),通过同一套 omp 设置运行,运行后期思考级别 high - 用场景:写代码——用一个 prompt 从头到尾搭一个小而能跑的应用
- 为啥选这俩:它们的 token 单价差不多,所以这是一场公平的同价对比。每个模型各给一个空文件夹、完全相同的 prompt,中间我完全不插手。
我用的 prompt
Build a small personal expense tracker as a self-contained Python web app using only the standard library (http.server, sqlite3, unittest). No pip installs, no external services, no API keys.
Deliverables:
1. app.py - an HTTP server on port 8000 with:
- POST /expenses accepting JSON {amount, category, date (YYYY-MM-DD), optional note}; reject invalid input (missing fields, negative or zero amount, malformed date) with a 400 and a clear error message
- GET /expenses returning a JSON list, supporting ?category= and ?month=YYYY-MM filters
- GET /summary returning totals grouped by category and by month
- GET / serving a single HTML page that lists all expenses and has a working add-expense form (no frameworks, vanilla JS fetch is fine)
2. SQLite persistence in expenses.db, created automatically on first run.
3. tests/ using unittest, covering: adding a valid expense, each validation error case, the category and month filters, and summary correctness. Every test must pass.
4. README.md with the exact commands to run the server and the tests.
5. A final demo run: start the server, add 5 sample expenses across at least 2 categories and 2 months, then show the output of GET /summary.
Acceptance criteria:
- python -m unittest discover -s tests -v runs with all tests green
- The server starts with python app.py and every endpoint above behaves as specified
- The HTML page renders and its form actually adds an expense end to end
- Nothing beyond the Python standard library is required
Work in the current empty folder. When finished, print the full test output and the demo summary output.
任务和结果
任务 1 - 一个 prompt 把整个 app 搭出来
- 输入:上面那段 prompt,每个模型各跑一次,每次都是全新的空文件夹。
- Qwen3.8 Flash 的输出:app.py(大约 330 行)、19 个 unittest 测试、README、自动创建的 expenses.db。19 个测试全过("Ran 19 tests in 9.651s, OK")。第一次跑测试有 3 个失败:2 个是它自己测试里的预期写错了(排序顺序),1 个是 app 里真实的漏洞——
?month=2026-13能通过格式检查,但它根本不是真实的月份。它把 app 和测试都修了,第二次跑就全绿了。它还跑了一次真实的 Chromium 检查:填了表单、点了 Add、拿到 "Added #8: coffee 8.40",表格从 5 行涨到 6 行。 - DeepSeek V4.1 Flash 的输出:app.py(大约 475 行)、23 个 unittest 测试、README、自动创建的 expenses.db。23 个测试全过("Ran 23 tests in 0.544s, OK")。最终报告显示一次全绿的运行。它后面又加固了几个边界情况:会溢出的超大金额、过大的请求体(413),还有清理测试里打开的 HTTP 错误流。它也在无头 Chromium 里检查了表单:提交了 "Snacks $9.99",行和总额都在不刷新页面的情况下更新了。
- 两个服务器都能用
python app.py启动,都自己建了 SQLite 文件,而且都只用标准库。
截图(并排,把同样的 5 条演示支出载入到两个 app 里):

每个会话里的浏览器检查:


任务 2 - 演示运行和 /summary 输出
- 输入:添加 5 条支出,覆盖 2 个以上类别、2 个以上月份,然后调用 GET /summary。
- Qwen 的输出:添加了 5 条支出,覆盖 4 个类别、3 个月份,总计 142.24。/summary 返回总计、计数,以及按类别、按月份的小计和计数。它还抽查了金额为 0 会返回 400 和 "amount must be greater than zero"。
- DeepSeek 的输出:在 2026-10 和 2026-11 添加了 5 条支出,分布在 Food 和 Transport。/summary 返回朴素的
by_category和by_month总计(Food 116.45、Transport 42.0;按月份是 63.25 和 95.2)。这完全满足 prompt 要求,只是细节没 Qwen 那版多。
UI 差别(这是我第一眼注意到的)
Qwen 的页面能跑,但就是一张纯白页面:浏览器默认输入框、灰色默认按钮、光秃秃的表格,金额也没有货币符号。DeepSeek 的页面看起来像个完成度挺高的小产品:卡片布局、蓝色主按钮、浅灰背景、带大写列头的样式化表格、金额带 $、有运行总额,还有跟随系统主题的深色模式(它自己的会话截图里显示的就是深色版)。prompt 里没人要求做样式,这是 DeepSeek 自己选的。
成本
记录在 omp 会话导出里:
| 项目 | Qwen3.8 Flash | DeepSeek V4.1 Flash |
|---|---|---|
| 输入 token(未缓存) | 150($0.00002) | 41,585($0.0062) |
| 输出 token | 20,539($0.0097) | 21,854($0.0131) |
| 缓存读取 token | 662,823($0.0106) | 891,136($0.0027) |
| 缓存写入 token | 115,134($0.0230) | 0 |
| 模型轮次 | 26 | 32 |
| 模型调用耗时 | 约 358 秒 | 约 145 秒 |
| 总计 | $0.0433 | $0.0220 |
DeepSeek 花的钱大约是 Qwen 的一半,模型耗时还不到一半。Qwen 多出来的成本主要花在缓存写入上。
我诚实的结论
- 让我印象深刻的:两个模型都用一个 prompt 一次成活了能跑的 app,带完整测试套件、真实持久化和端到端能用的表单,还只要几毛钱。Qwen 靠跑自己的测试发现并修掉了一个真实的校验 bug;DeepSeek 写了更多测试(23 vs 19)、处理了更多边界情况、做出了好看得多的 UI,而且花的钱只有一半、时间还更短。
- 让我失望的:Qwen 的 UI 太朴素,而且跑下来成本翻倍。
- 值不值? 这轮 DeepSeek V4.1 Flash 赢得明明白白。照着规格搭一个小 app,它更便宜、更快、测试更多、产出的外观也更好。