pricing

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const FallbackVersion = "2026-04-13"

FallbackVersion must be bumped whenever FallbackPricing rates change so the startup seeder knows to re-upsert.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModelPricing

type ModelPricing struct {
	ModelPattern         string
	InputPerMTok         float64
	OutputPerMTok        float64
	CacheCreationPerMTok float64
	CacheReadPerMTok     float64
}

ModelPricing holds per-model token pricing in cost per million tokens. Separate from db.ModelPricing — the CLI command converts between the two.

func FallbackPricing

func FallbackPricing() []ModelPricing

FallbackPricing returns hardcoded pricing for key Claude models. Used when the LiteLLM fetch fails. Prices in USD per million tokens, current as of 2026-04.

func FetchLiteLLMPricing

func FetchLiteLLMPricing() ([]ModelPricing, error)

FetchLiteLLMPricing downloads the LiteLLM pricing JSON and parses it into ModelPricing entries.

func ParseLiteLLMPricing

func ParseLiteLLMPricing(
	data []byte,
) ([]ModelPricing, error)

ParseLiteLLMPricing parses the LiteLLM JSON map into ModelPricing entries. Per-token costs are converted to per-million-token costs. Entries missing both input and output cost are skipped.

Jump to

Keyboard shortcuts

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