pricing

package
v0.10.257 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package pricing derives an approximate USD cost for a model's token usage at public list prices. It exists so adapters that do not report a cost (e.g. subscription auth) can still surface an estimate instead of "unavailable".

Estimates are intentionally best-effort: a model the table does not know returns ok=false so callers leave the cost unavailable rather than render a wrong number. cr supports anyone's agents and any model, so unknown models degrading gracefully is the point — extend the table to price more models.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimateUSD

func EstimateUSD(model string, tokensIn, tokensOut, cacheRead, cacheCreate *int) (cost float64, ok bool)

EstimateUSD returns an approximate cost for the given token counts at the model's public list price. ok is false when the model is not priced, so the caller can leave cost unavailable. nil token pointers are treated as zero.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL