pricing

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModelPricing

type ModelPricing struct {
	Model           string  `json:"model"`
	InputCostPer1M  float64 `json:"input_cost_per_1m"`
	OutputCostPer1M float64 `json:"output_cost_per_1m"`
	Provider        string  `json:"provider"`
	Available       bool    `json:"available"`
}

type PricingCache

type PricingCache struct {
	// contains filtered or unexported fields
}

func NewPricingCache

func NewPricingCache(ttl time.Duration) *PricingCache

func (*PricingCache) CalculateCost

func (c *PricingCache) CalculateCost(model string, inputTokens, outputTokens int) float64

func (*PricingCache) CheapestForCapability

func (c *PricingCache) CheapestForCapability(models []string, inputTokens, outputTokens int) (string, float64)

func (*PricingCache) FetchFromLiteLLM

func (c *PricingCache) FetchFromLiteLLM() error

func (*PricingCache) Get

func (c *PricingCache) Get(model string) (ModelPricing, bool)

func (*PricingCache) IsExpired

func (c *PricingCache) IsExpired() bool

func (*PricingCache) List

func (c *PricingCache) List() []ModelPricing

func (*PricingCache) LoadDefaults

func (c *PricingCache) LoadDefaults()

func (*PricingCache) PriceComparison

func (c *PricingCache) PriceComparison(models []string, inputTokens, outputTokens int) string

func (*PricingCache) Set

func (c *PricingCache) Set(model string, pricing ModelPricing)

type PricingSource

type PricingSource string
const (
	SourceLiteLLM    PricingSource = "litellm"
	SourceOpenRouter PricingSource = "openrouter"
	SourceManual     PricingSource = "manual"
)

Jump to

Keyboard shortcuts

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