fix(deepseek): update V4 pricing for peak/off-peak billing - #4891
fix(deepseek): update V4 pricing for peak/off-peak billing#4891guillaumegay13 wants to merge 2 commits into
Conversation
Action items
|
|
No actionable findings. |
|
Two things that have changed since this was opened, both relevant to the comment block rather than the numbers — the 1. The peak windows are now qualified by day of week. The footnote on https://api-docs.deepseek.com/quick_start/pricing/ reads, as of today:
The Chinese page says the same in local terms — 高峰时段为北京时间周一至周五 9:00 - 12:00、14:00 - 18:00 — and Beijing is UTC+8, so the two agree. Neither this PR's proposed comment nor #5222's carries the Monday through Friday qualifier, so as written they describe weekends as following the weekday schedule. Saturday and Sunday are now off-peak end to end, which is 48 of every 168 hours. Adding four words to the header block covers it: The USD and CNY tables are also consistent at a fixed 6.8182 CNY/USD on every 2. The stale rates are propagating downstream. {"input": 0.435, "output": 0.87, "reasoning": 0.87, "cache_read": 0.003625}Those three values now appear byte-identical in Not asking anyone to merge on my account — I have an unrelated PR open here (#5280) and no stake in this one. Posting it because the day-of-week change post-dates both open DeepSeek PRs and would otherwise land as a comment that is wrong about weekends, and because the downstream copy is the concrete answer to "does this actually matter." Cross-vendor cache-read rates I checked these against: https://xyzs996.github.io/llm-api-pricing/ |
|
Independent confirmation from actual billing, plus one gap this PR leaves. Billing verification. I reconciled a real opencode session tree (root + 3 subagents, 203 requests, deepseek-v4-pro) against the provider's billing export for that day: billed cache-hit tokens matched the tree to the exact token, and the effective rates during the session (Mon 07:05–08:21 UTC, inside the 06:00–10:00 UTC peak window) were exactly input 1.32 / output 3.96 / cache read 0.044 per 1M — the numbers in this PR. So the peak-rate reading is confirmed not just by the docs page but by what DeepSeek actually charges. For scale: the same session estimated by the current catalog rates came out at $0.29 vs $1.69 billed (~6× under), with cache read understated 12×. Gap: |
DeepSeek switched V4 to peak/off-peak billing on 2026-08-16 at 16:00 UTC. The catalog still carries the pre-change flat rates, which are now wrong under either interpretation —
deepseek-v4-flashis listed at0.14input, while the real rates are0.22off-peak and0.44peak.Rates from the official pricing page (USD per 1M tokens):
Peak hours are 01:00–04:00 and 06:00–10:00 UTC; every other hour is off-peak at exactly half the peak rate.
Why peak in
[cost]The schema has no time dimension, so a single number has to stand in. This PR uses the peak rate because the docs present it as the list price and off-peak as a discount off it — the same convention the catalog already follows by listing standard rates rather than batch or promotional discounts. The off-peak rates and the windows are recorded in a comment above
[cost]in each file so the information isn't lost.bun run validatepasses.Follow-ups (not in this PR)
cost.tiers[]already has atier.typediscriminator, but it'sz.literal("context")and bothCostandCostTierare.strict(), so this can't be expressed as data today. Atype: "time"variant with UTC windows would fit the existing shape, and DeepSeek is unlikely to be the last provider to do this. Happy to open that PR if you're open to the schema change — note the duplicate-size check inschema.tsdoestiers.map((tier) => tier.tier.size)unconditionally and would need a guard.deepseek-chatanddeepseek-reasonerstill carry0.14 / 0.28. If they resolve to V4 Flash they need the same rates, but fix(deepseek): deprecate legacy model aliases #3371 proposes deprecating them, so I left them alone to avoid a conflict — happy to fold them in if you'd prefer.providers/edenai/models/flexai/contains bothDeepSeek-V4-Flash-0731.tomlanddeepseek-v4-flash-0731.toml, which can't be checked out together on a case-insensitive filesystem (macOS default) — one always shows as modified.