cost

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calculate

func Calculate(model string, inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens int64) float64

Calculate returns the estimated cost in USD for the given token usage. Returns 0 if the model is unknown.

Types

type ModelPricing

type ModelPricing struct {
	Input      float64
	Output     float64
	CacheRead  float64
	CacheWrite float64
}

ModelPricing holds per-million-token pricing in USD.

Jump to

Keyboard shortcuts

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