Repository navigation
Price selectable models from the markdown table - #199
Conversation
OpenCode 2 selects a context tier by its token size, so a 272k, 256k, or 100k surcharge is no longer stored as a 200k rate. Fast modes with a published multiplier become their own catalog price, and Fast modes the docs name without a number stay unpriced. Co-authored-by: Oleksiy Akimov <[email protected]>
[Medium impact] The reviewed changes appear safe to merge; no new actionable issues remain. SummaryThe PR prices selectable models from markdown rows, then fills supported gaps from Cursor model pages and provider prices.
No new actionable issues found. The three supplied, unnumbered previous findings are addressed. This review used source inspection; no tests or live requests were run.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Offline markdown now checks the 2x Fast multipliers, explicit Fast-row precedence, unpriced Fast notes, and the missing Opus 4.7 reference. Co-authored-by: Oleksiy Akimov <[email protected]>
Offline markdown checks 2x input at an explicit threshold and the default context, Haiku's published 5x rates, and a missing threshold. Invalid cost tiers are rejected. Co-authored-by: Oleksiy Akimov <[email protected]>
The generator treats each model's rendered HTML pricing table as the rate and uses the main table only when that page has no matching row. Auto uses the Cursor staff forum rate. GPT-5.4 Fast and its long-context tier are derived from that page's own prose. Co-authored-by: Oleksiy Akimov <[email protected]>
CodeQL flagged chained entity replaces, comment stripping, and a script regex that misses a spaced end tag. Entity decoding is one replace, and comments and script blocks are removed by scanning for their markers. Co-authored-by: Oleksiy Akimov <[email protected]>
--from-file with --context-from-file no longer downloads model pages. --pages-from-dir reads saved <model-id>.html copies instead. Co-authored-by: Oleksiy Akimov <[email protected]>
A run with both markdown files and --pages-from-dir reads those files only. A model in the pricing markdown whose HTML file is absent fails the run instead of being fetched. Co-authored-by: Oleksiy Akimov <[email protected]>
A pricing-markdown row is the rate. A model page is read only when a selectable variant has no row, and it does not replace that row. Notes are not prices. Auto stays the hand-edited staff rate. Generation fails before writing when a selectable model has no price. Co-authored-by: Oleksiy Akimov <[email protected]>
The file run loads a model page only when a selectable variant has no markdown row. Drop the 25 pages that run never reads. Co-authored-by: Oleksiy Akimov <[email protected]>
A page fetched for a selectable Fast or long-context gap must contain a pricing table and that row. Otherwise generation throws before writing and does not keep the base rate for the missing variant. Co-authored-by: Oleksiy Akimov <[email protected]>
…del pages Co-authored-by: Oleksiy Akimov <[email protected]>
…rate Co-authored-by: Oleksiy Akimov <[email protected]>
Cursor bills third-party models at API list price. A Fast variant with no Cursor price now comes from the Anthropic or OpenAI page. The standard row is not copied onto Fast. Co-authored-by: Oleksiy Akimov <[email protected]>
CodeQL rejected a RegExp built from the Anthropic and OpenAI pricing URLs. Co-authored-by: Oleksiy Akimov <[email protected]>
Validate standard and Fast context tiers independently. Use the published Gemini 3.1 Pro long-context rate and leave route-dependent Auto unpriced. Validate Cursor pages before provider fallback and make saved-input generation reproduce the same bytes.
|
Follow-up in
All 3,641 Linux tests passed. Pricing coverage checked 101 IDs with zero missing, and the live pricing check reproduced the committed file. OpenCode 1.19.6 and 2.3.2 loaded the build with a recorded catalog. |
Adopt upstream's oakimov#199 pricing table, oakimov#200 in-place catalog refresh, oakimov#201 CURSOR_PROGRESS_CONTINUATION opt-out, and oakimov#202 local AI SDK entry. The fork's earlier ports (deb1787, 2bbab84, 9bf27b0 gate) are dropped where upstream now covers the same ground. Keep the fork-only pieces upstream still lacks: the seven-day conversation snapshot default with fixed 24 h .tmp cleanup and resolver-derived test ages, scripts/build-atomic.sh, scripts/sync-upstream.sh, the stale-dist gate, and test/updater-build.test.ts. Retire the last topic branch: nothing on perf/cache-ttl-and-lean-runtime remains that upstream or this merge does not already cover, so TOPICS is empty and the updater tests seed a synthetic topic into the copied script.
Summary
Use published Fast and long-context token rates in the OpenCode catalog and in the provider’s cost estimates. The generator uses the Cursor pricing table first, then the Cursor model page for missing rates, then supported fallbacks to the provider’s official pricing. Context windows come from the Cursor model reference.
-fastmodel. Reselect saved Fast variants that moved from the base model to a dedicated entry.default) remains the sole intentional unpriced entry because its rate can vary by route and plan. Cursor Auto pricingSelected rates
Rates are USD per million tokens. The threshold applies once the prompt exceeds the listed size.
Cursor’s model pages supply the GPT-5.5 and GPT-5.6 rates. The provider fallbacks use Anthropic Fast mode, the OpenAI Fast tier, and Google’s Gemini 3.1 Pro Standard tier. Gemini 3.1 Pro gets its 200k pricing threshold even though Cursor advertises it as a single 1M model entry. Generated rates · Google pricing
Offline generation
Supply both
--from-fileand--context-from-filefor a fully offline run. Save required Cursor pages as<model-id>.htmlin--pages-from-dir. Save provider inputs asanthropic.html,openai.html, orgoogle.mdin--provider-pages-from-diras required. Required Cursor pages are validated before provider fallback. The saved fixtures reproduce the generated file byte for byte regardless of local input paths.Verification
Validated
ef5388f.bun testpassed all 3,641 tests.bun run check:pricingchecked 101 IDs with zero missing and Auto as the sole exception.bun run generate:pricing -- --checkreproduced the committed file from live public pricing sources. The offline fixtures reproduced the same bytes.copilot.totalNanoAiu.