Documentation
¶
Overview ¶
Package cost estimates per-model pricing for prompt tokens.
Prices are per 1M input tokens, in USD, approximate list prices as of this project's v1. The map is used for README-style "cost impact per 100k runs" projections; it is not a substitute for live billing data.
Index ¶
- Constants
- func EstimateBulk(model string, count, invocations int64) float64
- func EstimateBulkCached(model string, count, invocations int64) (float64, bool)
- func IsCacheSupported(model string) bool
- func IsKnown(model string) bool
- func Lookup(model string) float64
- func SetOverride(model string, per1M float64)
- type Estimated
- type Price
Constants ¶
const PricesAsOf = "2026-08-13"
PricesAsOf is the date the built-in price table was last updated. Bump it whenever prices map changes so `prompt-diff models --check` can warn when it goes stale.
Variables ¶
This section is empty.
Functions ¶
func EstimateBulk ¶
EstimateBulk computes the cost to run each model's tokens n times.
func EstimateBulkCached ¶ added in v1.7.0
EstimateBulkCached computes the cost to run count prompt tokens across invocations calls, assuming the whole prompt is cached: the first call pays the cache-write price, every subsequent call pays the cheaper cache-read price. Returns (0, false) when model's family has no modeled caching discount — callers should treat that as "not applicable", not "free".
func IsCacheSupported ¶ added in v1.7.0
IsCacheSupported reports whether prompt-caching cost is modeled for model's provider family (see cacheMultipliers doc comment for why some are excluded).
func IsKnown ¶ added in v1.4.0
IsKnown reports whether model has an exact or override entry in the price table (as opposed to falling back to a prefix or family-default guess).
func Lookup ¶
Lookup returns the USD per-1M-token price for a model. Unlisted models fall back to a neutral default so projections never crash.
func SetOverride ¶ added in v1.3.0
SetOverride pins model's price, overriding the built-in list.