SkillKit.LLM.Pricing (SkillKit v0.4.0)

Copy Markdown View Source

Derives USD cost from token usage and a model id.

Per-million-token input/output rates are stored per model. Cache rates are properties of the caching mechanism, not the model, so they are applied as multipliers on the input rate: cache reads cost 0.1x input, and cache writes cost 1.25x input (the 5-minute TTL rate). The rarer 1-hour TTL write rate (2x) is not modeled here; reads dominate cost, so the resulting estimate error is negligible. Unknown models return nil.

Summary

Functions

Returns the USD cost of usage for model, or nil for an unknown model.

Functions

cost(usage, model)

@spec cost(SkillKit.Event.Usage.t(), String.t()) :: float() | nil

Returns the USD cost of usage for model, or nil for an unknown model.