Versions in this module Expand all Collapse all v0 v0.0.2 Aug 12, 2026 v0.0.1 Jul 22, 2026 Changes in this version + const DataSource + const Name + const Version + var ErrModelNotFound = errors.New("genaiprices: model not found") + var ErrProviderNotFound = errors.New("genaiprices: provider not found") + type ArrayMatch struct + Field string + Match MatchLogic + Type string + type ConditionalPrice struct + Constraint *Constraint + Prices ModelPrice + type Constraint struct + EndTime string + Kind string + StartDate time.Time + StartTime string + func (c *Constraint) UnmarshalJSON(data []byte) error + type ExtractPath struct + Steps []PathStep + func (e *ExtractPath) UnmarshalJSON(data []byte) error + type ExtractedUsage struct + Model *ModelInfo + Provider *Provider + Usage Usage + func ExtractUsage(provider *Provider, responseData any, opts ...Option) (*ExtractedUsage, error) + type MatchLogic struct + func And(clauses ...MatchLogic) MatchLogic + func Contains(s string) MatchLogic + func EndsWith(s string) MatchLogic + func Equals(s string) MatchLogic + func Or(clauses ...MatchLogic) MatchLogic + func Regex(s string) MatchLogic + func StartsWith(s string) MatchLogic + func (m *MatchLogic) IsMatch(text string) bool + func (m *MatchLogic) UnmarshalJSON(data []byte) error + type ModelInfo struct + ContextWindow *int + Deprecated bool + Description string + ID string + Match MatchLogic + Name string + PriceComments string + Prices []ConditionalPrice + func (m *ModelInfo) UnmarshalJSON(data []byte) error + type ModelPrice struct + CacheAudioReadMTok *Price + CacheReadMTok *Price + CacheWriteMTok *Price + InputAudioMTok *Price + InputMTok *Price + OutputAudioMTok *Price + OutputMTok *Price + RequestsKCount *float64 + type Option func(*resolveOptions) + func WithAPIFlavor(flavor string) Option + func WithProvider(p *Provider) Option + func WithProviderAPIURL(url string) Option + func WithProviderID(id string) Option + func WithTimestamp(t time.Time) Option + type PathStep struct + Array *ArrayMatch + Key string + func (s *PathStep) UnmarshalJSON(data []byte) error + type Price struct + Flat float64 + Tiered *TieredPrices + func (p *Price) UnmarshalJSON(data []byte) error + type PriceCalculation struct + InputPrice float64 + Model *ModelInfo + ModelPrice ModelPrice + OutputPrice float64 + Provider *Provider + TotalPrice float64 + func CalcPrice(usage Usage, modelRef string, opts ...Option) (*PriceCalculation, error) + type Provider struct + APIPattern string + Description string + Extractors []UsageExtractor + FallbackModelProviders []string + ID string + ModelMatch *MatchLogic + Models []ModelInfo + Name string + PriceComments string + PricingURLs []string + ProviderMatch *MatchLogic + func FindProvider(opts ...Option) (*Provider, error) + func Providers() []Provider + type Tier struct + Price float64 + Start int + type TieredPrices struct + Base float64 + Tiers []Tier + func (t *TieredPrices) UnmarshalJSON(data []byte) error + type Usage struct + CacheAudioReadTokens int + CacheReadTokens int + CacheWriteTokens int + InputAudioTokens int + InputTokens int + OutputAudioTokens int + OutputTokens int + type UsageExtractor struct + APIFlavor string + Mappings []UsageExtractorMapping + ModelPath ExtractPath + Root ExtractPath + type UsageExtractorMapping struct + Dest string + Path ExtractPath + Required bool