cache

package
v0.0.343 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModelCacheTTL = 6 * time.Hour
)

Variables

This section is empty.

Functions

func IsCacheValid

func IsCacheValid(cache *ModelCache) bool

func WriteModelCache

func WriteModelCache(provider string, models []string) error

func WriteModelInfoCache added in v0.0.267

func WriteModelInfoCache(provider string, modelInfos []CachedModel) error

Types

type CachedModel added in v0.0.267

type CachedModel struct {
	ID          string  `json:"id"`
	DisplayName string  `json:"display_name,omitempty"`
	Created     int64   `json:"created,omitempty"`
	OwnedBy     string  `json:"owned_by,omitempty"`
	InputLimit  int     `json:"input_limit,omitempty"`
	InputPrice  float64 `json:"input_price,omitempty"`
	OutputPrice float64 `json:"output_price,omitempty"`
}

type ModelCache

type ModelCache struct {
	Models     []string      `json:"models"`
	ModelInfos []CachedModel `json:"model_infos,omitempty"`
	FetchedAt  time.Time     `json:"fetched_at"`
}

func ReadModelCache

func ReadModelCache(provider string) (*ModelCache, error)

Jump to

Keyboard shortcuts

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