llm

package
v1.0.138 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRefreshInterval = 12 * time.Hour

Functions

This section is empty.

Types

type ModelPrice

type ModelPrice struct {
	OutputCostPerToken float64 `json:"output_cost_per_token"`
	InputCostPerToken  float64 `json:"input_cost_per_token"`
	Provider           string  `json:"litellm_provider"`
	Mode               string  `json:"mode"` // chat, embedding, moderation, audio_speech, audio_transcription, etc
}

type ModelPricing

type ModelPricing interface {
	// Start starts the pricing update loop
	Start(ctx context.Context)
	// GetPrice returns the price for a given model, or nil if the model is not found
	GetPrice(model string) *ModelPrice
	// Close stops the pricing update loop
	Close()
}

ModelPricing is an interface for getting the price for a given model

func NewModelPricing added in v1.0.32

func NewModelPricing(options ...ModelPricingOption) ModelPricing

type ModelPricingOption added in v1.0.32

type ModelPricingOption func(*modelPricing)

func WithInterval

func WithInterval(interval time.Duration) ModelPricingOption

func WithOnError

func WithOnError(onError func(error)) ModelPricingOption

func WithOnUpdate

func WithOnUpdate(onUpdate func(int)) ModelPricingOption

Jump to

Keyboard shortcuts

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