anomalyco / anomalyco/opencode
Cost for DeepSeek is under-reported during peak hours (price table only stores the off-peak rate)
@MrMushrooooom is already working on this.
Since Sep 12, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
Cost is computed from a static price table (Model.cost.input/output/cache_read/cache_write, sourced from models.dev). DeepSeek bills with peak / off-peak rates (off-peak is half of peak), but the catalog only carries the off-peak numbers. As a result the displayed cost is under-reported ~2x during DeepSeek peak hours.
Data
models.dev deepseek/deepseek-flash currently has:
cost: { input: 0.15, output: 0.6, reasoning: 0.6, cache_read: 0.003 }
DeepSeek official pricing (https://api-docs.deepseek.com/quick_start/pricing):
| item | off-peak | peak |
|---|---|---|
| input (cache miss) | $0.15 | $0.30 |
| output | $0.60 | $1.20 |
| input (cache hit) | $0.003 | $0.006 |
Peak = UTC Mon–Fri 01:00–04:00 and 06:00–10:00 (= Beijing Mon–Fri 09:00–12:00 / 14:00–18:00); all other hours are off-peak. The table above picks the off-peak column.
Impact (measured locally, opencode 1.18.30)
793 assistant messages with providerID = deepseek:
- displayed total:
$0.7590 - time-corrected total:
$1.0680 - under-reported:
$0.3091(~41%); 299 / 793 messages fell in peak.
Why it can't be worked around locally
There is no time dimension in the cost schema — Model.cost has input/output/cache_read/cache_write plus context-size tiers (context_over_200k), but no peak/off-peak windows. Searching the shipped binary finds 0 occurrences of off-peak/offpeak. A static override can only ever pick one of the two rates (under-report at peak, or over-report ~2x off-peak).
Proposal
- models.dev: carry both rates for models that have them (e.g.
cost.off_peakor a small schedule). - opencode: when computing cost, select the rate from the request/completion time (UTC, weekday-aware).
If models.dev intentionally standardizes on the lowest (off-peak) rate, please at least document that, so the value is understood to be a lower bound rather than the amount actually charged.
Environment
- opencode 1.18.30, macOS 26.6.2
- model
deepseek/deepseek-flash(DeepSeek-V4.1-Flash)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.