Repository navigation
Commit 07607d5
Price selectable models from the markdown table (oakimov#199)
* fix(pricing): price selectable Fast modes at the published thresholds
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.
* test(pricing): cover Fast note rules in buildPricing
Offline markdown now checks the 2x Fast multipliers, explicit Fast-row
precedence, unpriced Fast notes, and the missing Opus 4.7 reference.
* test(pricing): cover long-context notes in buildPricing
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.
* fix(pricing): read per-model docs tables for every selectable rate
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.
* fix(pricing): parse model-page HTML in one pass
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.
* fix(pricing): keep local pricing generation offline
--from-file with --context-from-file no longer downloads model pages.
--pages-from-dir reads saved <model-id>.html copies instead.
* fix(pricing): fail offline generation when a saved page is missing
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.
* fix(pricing): price markdown rows first and pages only for gaps
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.
* test(pricing): keep only gap pages in the offline fixture
The file run loads a model page only when a selectable variant has no
markdown row. Drop the 25 pages that run never reads.
* fix(pricing): refuse to write when a gap page lacks its row
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.
* fix(pricing): read stated same-rate and Fast multiplier rules from model pages
* fix(pricing): use the published row when the page states no separate rate
* fix(pricing): price unpublished Fast variants at the provider list price
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.
* test(pricing): assert provider URLs as text, not as a regex
CodeQL rejected a RegExp built from the Anthropic and OpenAI pricing URLs.
* fix(pricing): verify selectable rates before generation
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.1 parent 556c39f commit 07607d5
55 files changed
Lines changed: 6226 additions & 162 deletions
File tree
- docs
- scripts
- src
- tasks
- lessons
- test
- fixtures
- pricing-offline
- pages
- providers
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
| 203 | + | |
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | | - | |
| 349 | + | |
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
49 | 55 | | |
50 | 56 | | |
51 | | - | |
| 57 | + | |
52 | 58 | | |
53 | | - | |
| 59 | + | |
| 60 | + | |
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
61 | | - | |
| 68 | + | |
62 | 69 | | |
63 | 70 | | |
64 | 71 | | |
| |||
70 | 77 | | |
71 | 78 | | |
72 | 79 | | |
73 | | - | |
| 80 | + | |
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
| |||
0 commit comments