pricing

package
v0.0.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	BaseLLMURL   = "https://basellm.github.io/llm-metadata/api/newapi/ratio_config-v1-base.json"
	ModelsDevURL = "https://models.dev/api.json"
)

Variables

This section is empty.

Functions

func ConvertBaseLLM

func ConvertBaseLLM(data []byte) (map[string]ModelPricing, error)

func ConvertModelsDev

func ConvertModelsDev(data []byte) (map[string]ModelPricing, error)

func Fetch

func Fetch(targetURL string, proxyURL string) ([]byte, error)

Fetch retrieves data from the given URL with 1-hour in-memory caching. If proxyURL is non-empty, it is used as the HTTP proxy; otherwise the standard HTTP_PROXY/HTTPS_PROXY environment variables apply.

Types

type MatchResult

type MatchResult struct {
	Pricing     ModelPricing
	MatchType   string // "exact" or "fuzzy"
	MatchedName string
}

func Match

func Match(modelName string, source map[string]ModelPricing) *MatchResult

type ModelPricing

type ModelPricing struct {
	InputPrice      float64
	OutputPrice     float64
	CacheReadPrice  *float64
	CacheWritePrice *float64
}

Jump to

Keyboard shortcuts

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