Publish the rate card as a feed, and diff it against DeepSeek daily - #4
Merged
Conversation
…aily The card in lib/core.js was already the single source of the plugin, the bundle and the site. Two things were still missing: nobody outside this repo could read it, and its "verbatim from the published table" claim was re-established by a human remembering to look. docs/pricing.json is the card as machine-readable JSON, served at dsh.works/dsh-meter/pricing.json — both currencies, both live tariffs, the 24-hour UTC schedule, the retired flat card with the date it stopped applying, and the definition of each billed bucket, which is the half of a cost estimate a price list cannot give you. Generated from core.js and checked by `pnpm test`; a pure function of the card, so the file changes exactly when the price does. It exists because no external source is right. Checked 2026-08-20, four days after the switchover, models.dev and LiteLLM both still published DeepSeek's retired flat card as current — understating a v4-pro bill by 1.5x off-peak, 3x at peak, 12x on cached input at peak. Neither can fix it by refreshing: both schemas hold one flat price per model per bucket, with nowhere to put a tariff. scripts/verify-pricing.mjs scrapes DeepSeek's own two pricing pages and diffs every rate, the peak windows and the model list against the card. A page it can no longer parse fails too — the alarm should fire when the source changes shape, not only when a number moves. A daily workflow runs it and opens a pricing-drift issue. Deliberately outside `pnpm test`: a unit suite must not fail because a docs site is slow, and a price alarm must not stay silent because nobody opened a PR this week. Verified: the card matches both published tables today, and the verifier catches an injected 0.66 -> 0.60 and a widened peak window.
This was referenced Aug 20, 2026
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.
lib/core.jswas already the single source of the plugin, the bundle and the site. Two things were still missing: nobody outside this repo could read the card, and its "verbatim from the published table" claim was re-established by a human remembering to look.docs/pricing.jsonServed at https://dsh.works/dsh-meter/pricing.json (Pages =
main+/docs, and the host already answersaccess-control-allow-origin: *).Both currencies, both live tariffs, the 24-hour UTC schedule, the retired flat card with the date it stopped applying, and the definition of each billed bucket — which is the half of a cost estimate a price list cannot give you. Generated from
lib/core.jsbyscripts/build-pricing.mjs, checked bypnpm test. It is a pure function of the card (no timestamp, no fetch), so the file changes exactly when the price does.JS consumers can skip the fetch entirely:
import { costOf, tariffAt } from '@dshworks/dsh-meter/core'—core.jsimports nothing.Why publish it at all
Because no external source is right. Checked 2026-08-20, four days after the switchover:
last_updated: 2026-08-12/api/v1/modelsBoth aggregators understate a v4-pro bill by 1.5x off-peak, 3x at peak, and 12x on cached input at peak. Neither can fix it by refreshing: both schemas hold one flat price per model per bucket, with nowhere to put a tariff. A rate that doubles for seven hours of every UTC day cannot be represented in either.
Keeping it honest
scripts/verify-pricing.mjsscrapes DeepSeek's own two pricing pages — English and Chinese — and diffs every rate, the peak windows, and the model list (a model priced upstream and missing here would meter at zero). A page it can no longer parse exits non-zero too: the alarm should fire when the source changes shape, not only when a number moves..github/workflows/pricing-watch.ymlruns it daily and opens or comments on apricing-driftissue. Deliberately outsidepnpm test: a unit suite must not fail because a documentation site is slow, and a price alarm must not stay silent because nobody opened a PR this week. The last price change arrived with no announcement in any channel we watch.Verification
npm run verify:pricing, exit 0).0.66 → 0.60rate and a widened peak window (exit 1, both named in the report).Not in this PR
No version bump — the CHANGELOG entry sits under
Unreleased. This merge makes the feed live on the site; the npm release is a separate step.