Documentation
¶
Overview ¶
Package pricing prices token usage deterministically. It is the basis of the dollar budget the governor enforces and the cost ledger records. Prices are static, defensible list prices (USD per 1M tokens) and are overridable via config — RiskKernel never asks an LLM what something costs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadOverrides ¶ added in v0.2.0
LoadOverrides reads model→Rate overrides from a JSON file — the hook for keeping prices current as providers change them, without recompiling. The format is a map of model name (or prefix) to its rate in USD per 1M tokens:
{
"claude-sonnet-4": { "inputPerM": 3.0, "outputPerM": 15.0 },
"my-finetuned-model": { "inputPerM": 0.5, "outputPerM": 1.0 }
}
These layer on top of the built-in list prices (pass the result to NewTable). A missing, unreadable, malformed, or negative-rate file is an error: pricing is the dollar budget's basis, so the daemon refuses to start rather than silently misprice.
Types ¶
type Rate ¶
Rate is a model's price in USD per 1,000,000 tokens. The JSON tags are the pricing-override file format (see LoadOverrides).
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table prices models. The zero value is usable (built-in rates only); use NewTable to layer config overrides on top.
func NewTable ¶
NewTable returns a Table seeded with the built-in rates, with overrides applied on top (override keys are matched by the same prefix rule).