Skip to content

fix(standard): count and book a call over a price's prompt size at that size's rates - #504

Open
pierreleca wants to merge 4 commits into
ThinkFlowLab:mainfrom
pierreleca:fix/prompt-size-prices
Open

pierreleca wants to merge 4 commits into
ThinkFlowLab:mainfrom
pierreleca:fix/prompt-size-prices

Conversation

@pierreleca

Copy link
Copy Markdown
Contributor

Closes #503

What

  • Claude Haiku 5.5 bills five times past 100,000 prompt tokens. Every call was priced at one rate.
  • A price row may hold above: rates past a prompt size.
  • The public list's *_above_<N>k_tokens costs fill it.
  • --price m=0.1,0.5/100000=0.5,2.5 and nullius prices set --above take it.
  • The relay's cost and the cap's booking use it.
  • A row without above prices as before.
  • Settings' form keeps a row's above on a save.

Verified

  • 9 cases fail on main: costs at 100,000 and 100,001 tokens, a capped call refused unsent, the list, --price, set --above, Settings.
  • The list's Claude Haiku 5.5 row matches the pricing page.
  • Backend 3,276, routes 848.

Risk

  • The estimate leaves out pictures: a prompt they take past the size is booked low.
  • Settings takes one set of rates: a price typed there hides the list's above, and a kept above may be stale.
  • Undo: revert.

Agents

  • Claude Code, Opus 5.5
  • Codex, gpt-6-astra

…at size's rates

Some models are billed at higher rates once a request's prompt passes a
size: Claude Haiku 5.5 at five times its rates over 100,000 prompt tokens,
cache reads and writes counted. A price row held one set of rates, and the
public list's `_above_<N>k_tokens` costs were dropped when it was read.
Such calls were counted and booked at the lower rates, and a spending cap
let the bill reach several times the cap.

A row may now hold `above`: the rates of a prompt over a number of tokens.
The list's own fields fill it; `--price` takes it after a `/` and
`nullius prices set` with `--above`. The relay prices a reply by its prompt
tokens, and the cap books a call at the rates of its estimated prompt. A
row without `above` prices as before.
… size given twice

A size may leave out any rate, the input rate too: a rate left out stays
as it is below that size. A user's row whose size gave no input rate
did not load. The public list's sizes were found from its input fields
alone, and a size the list gives only an output or a cache rate for was
lost.

Two entries of the same size passed the row's check and loaded. The
`--price` written from that row for a host was then refused there. Such
a row is now kept in its file and reported, as other rows that cannot
price are.

The tests now also check a capped call's booking past a size, its output
included, and a rate left out between two sizes.
… row with a size of none

A user's row with `"above": null` was taken as a row with no sizes and
priced with no word. A row that names `above` must give a list: such a
row is now kept in its file and reported, as other rows that cannot
price are.

A list field past a size of 0 tokens made its whole model unusable, and
the model lost its price. That size is now left out and the row kept.

The test of a user's file now covers each part of a size's check: a
size with a cache rate alone loads, and a rate that is no number, a
size of 0, below 0 or a boolean, and `above` as null or an object are
each kept, reported and not priced.
…saves it

The Settings form holds one set of rates. Saving a model's price there
wrote a new row and dropped, with no word, the rates past a prompt size
that `nullius prices set --above` or the prices file had given it. Those
rates now stay when the form saves the model's other rates; the form
gains no field. A row without them is saved as before.
@pierreleca
pierreleca marked this pull request as ready for review November 30, 2026 09:33
@github-actions github-actions Bot added the needs review Tests pass, no conflict, no verdict on its latest commit label Nov 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review Tests pass, no conflict, no verdict on its latest commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A call over a model's long-prompt size is counted, and capped, at its lower rates

1 participant