Files
traefik-llmgateway/builtin_model_meta.go
T
lukaszraczylo 55ebe1fae1 feat(pricing): price cached and cache-write input tokens
Cost now prices cache-read and cache-write prompt tokens at their own rates.
A model without a cache price keeps the input rate, so cost does not change.
The cache shares are clamped to the prompt, so odd usage cannot give a negative cost.
LiteLLM field names cache_read_input_token_cost and cache_creation_input_token_cost were confirmed in the fetched source.
The pricing-sync tool reads both fields. The table regeneration is a separate commit.
2026-11-26 00:37:19 +00:00

29 lines
1.4 KiB
Go

package traefikllmgateway
// builtinModelMeta is one built-in, LiteLLM-synced catalog entry (feature
// v0.23): a model's context window and per-token cost, in the same
// micro-USD-per-million-tokens unit ModelMetaConfig uses (modelmeta.go's
// microUSDPerUSD). Zero in any field means "this table has no data for
// it" — resolveModelMeta (modelmeta.go) only ever trusts a field greater
// than zero, never a bare zero value, so there is no ambiguity with a
// genuinely free or zero-context entry (this table never has one:
// pricing_data_gen.go's generator only ever emits a field it found a
// positive upstream value for). Regenerated wholesale by `make
// pricing-sync` (tools/pricing-sync) — see pricing_data_gen.go's own
// header for the source snapshot and pruning rule, and
// tools/pricing-sync/main.go's own doc comment for the full pruning/
// naming-bridge design.
//
// Kept in its own file, separate from modelmeta.go's resolution logic:
// this type is the generated table's own data shape, needed to compile
// pricing_data_gen.go on its own, independent of the resolveModelMeta/
// registry wiring layered on top of it.
type builtinModelMeta struct {
ContextTokens int
InputCostPerMTokMicroUSD int64
OutputCostPerMTokMicroUSD int64
// Cache prices; 0 means unknown, so billing falls back to the input price.
CachedInputCostPerMTokMicroUSD int64
CacheWriteCostPerMTokMicroUSD int64
}