Repository navigation
feat(prices): price DeepSeek, at its peak rate - #319
Merged
Merged
Conversation
deepseek-flash, deepseek-v4-pro and the legacy deepseek-v4-flash (billed as Flash), from DeepSeek's pricing page (read from its raw markup). DeepSeek bills half its peak rate off-peak (all hours but 01:00-04:00 and 06:00-10:00 UTC on weekdays); a CostConfig has no time of day, so the snapshot carries the peak rate: an upper bound, so a Budget stops early rather than late. Off-peak rates can be installed as an override. - price_audit: DeepSeek's rates must be exactly twice models.dev's (which lists the off-peak ones), and models.dev's `reasoning` rate must equal its output rate (recorded gaps); positive controls for both. The live models.dev fixture slice is refreshed (V4 Pro's old figures were wrong; deepseek-v4-flash added). - The models.dev mapping skips DeepSeek (time-of-day pricing), so a live fetch never replaces the peak rate with the off-peak one; the live audit asserts it stays skipped. - Tests that used DeepSeek as "an unpriced model" use Mistral instead. The live smoke on DeepSeek now runs its cost check: 6/6. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG
…eak recipe, the example's literals - A models.dev price cache written before this change still held DeepSeek's off-peak rates and was installed as-is (fresh for a day, stale offline for a week): cached models.dev tables now drop the time-of-day providers too. Test seeds such a cache (fresh and stale; a non-models.dev source keeps what it lists); it fails without the fix. - pricing.md's off-peak override recipe states cache_write (without it install_override warned) and covers all three models. - examples/llm_compaction_live.rs read DeepSeek's rates from literals and said a crate-level price would be wrong; it uses the snapshot now. - TIME_OF_DAY_PRICED no longer sits between map_models_dev_cost and its doc comment. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The bundled price snapshot gains DeepSeek:
deepseek-flash,deepseek-v4-pro, and the legacydeepseek-v4-flash(served by V4.1 Flash, billed as Flash). Pricing stays opt-in (prices::enable_bundled()).Rates per million tokens, from DeepSeek's pricing page, read from its raw markup, not a summary:
DeepSeek has no cache-write charge, so
cache_write= input, under the existingcache_write_at_inputallowance.Why the peak rate
DeepSeek bills half of these off-peak, which is every hour except 01:00–04:00 and 06:00–10:00 UTC on weekdays (about 79% of the week). A
CostConfighas no time of day, so the snapshot carries the peak rate as an upper bound:Budgetstops early rather than late.docs/concepts/pricing.mdshows how to install the off-peak rates as an override for anyone who'd rather count those.Keeping it honest
tests/price_audit.rsnow records DeepSeek's differences from models.dev instead of skipping them, and asserts them both ways:input,outputandcache_readmust be exactly twice models.dev's, which lists the off-peak rates. If models.dev starts listing the peak rate, or the ratio changes, that is drift.reasoningrate must equal its output rate, recorded asFLAT_RATE_GAPSwith the figures pinned.deepseek-v4-flashis added.enable_live) skips DeepSeek's models as priced by time of day, so its off-peak rates never replace the bundled peak ones. The skip is reported inskipped, without the warning meant for unmappable data, and the live audit asserts it stays skipped.Tests
price_override_test, two inmodel.rs, theCostConfigdoc example) now use Mistral.price_fetch_testcounts are updated for the refreshed slice.cargo test --all-featurespasses;-D warnings, rustdoc and fmt are clean;🤖 Generated with Claude Code
https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG