Documentation
¶
Overview ¶
Package pricing is what a model costs, as its provider publishes it.
It is the one table the application states a price in. The chat client adds up what a conversation has spent from it, the picker shows it beside a model, and routing weighs a switch of model against it. Nothing else in the code states a price.
It is short and it is meant to be: a made-up price is worse than no price at all, so a model that is not in here is shown with its token counts and nothing else. Every rate says the day it was read and the page it was read from, because a price is a fact about a day rather than one that lasts, and a test fails a release whose table has not been read again for too long. Only a provider's own first-party rates are here: a model reached through a partner platform or a gateway is priced by whoever serves it, and is not guessed at.
Index ¶
Constants ¶
const Day = "2006-01-02"
Day is the layout of every date in the table.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Rate ¶
type Rate struct {
In float64
Out float64
// CacheRead is what input read from the prompt cache costs, where it is
// not the usual tenth of In. Writing to the cache is charged a quarter more
// than In, which is Anthropic's five-minute write; only Anthropic's answers
// report a cache write at all.
CacheRead float64
// Above, when set, is a prompt length in tokens beyond which a request is
// charged the Long rates instead. Google prices its Pro models higher for a
// long prompt.
Above int
LongIn, LongOut, LongRead float64
// From and Until are the first and last days this rate is published for,
// as YYYY-MM-DD; empty is unbounded. A price already announced to change
// is two entries, one either side of the day it changes.
From, Until string
// Checked is the day the rate was read off Source, as YYYY-MM-DD.
Checked string
Source string
}
Rate is what a model costs, in dollars per million tokens.