modelcatalog

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeChat               = "chat"
	ModeAudioSpeech        = "audio_speech"
	ModeAudioTranscription = "audio_transcription"
	ModeEmbedding          = "embedding"
	ModeImage              = "image"
)

Mode values align with LiteLLM model_prices_and_context_window.json.

Variables

This section is empty.

Functions

func EstimateCostUSD

func EstimateCostUSD(e usage.Event) *float64

EstimateCostUSD computes USD cost from catalog pricing and a usage event. Returns nil when the model is unknown or required pricing/metrics are missing.

func Key

func Key(providerType, model string) string

Key builds the catalog lookup key provider_type/model.

Types

type Entry

type Entry struct {
	Mode                  string   `json:"mode"`
	MaxInputTokens        int      `json:"max_input_tokens,omitempty"`
	MaxOutputTokens       int      `json:"max_output_tokens,omitempty"`
	InputCostPerMTok      *float64 `json:"input_cost_per_mtok,omitempty"`
	OutputCostPerMTok     *float64 `json:"output_cost_per_mtok,omitempty"`
	InputCostPerCharacter *float64 `json:"input_cost_per_character,omitempty"`
	InputCostPerSecond    *float64 `json:"input_cost_per_second,omitempty"`
	InputCostPerImage     *float64 `json:"input_cost_per_image,omitempty"`
	SupportsStreaming     *bool    `json:"supports_streaming,omitempty"`
	SupportsVision        bool     `json:"supports_vision,omitempty"`
	SupportsTools         bool     `json:"supports_tools,omitempty"`
}

Entry is curated metadata for a provider target model.

func Lookup

func Lookup(providerType, model string) (Entry, bool)

Lookup returns curated metadata for (providerType, targetModel). openai_compatible falls back to openai entries for shared model ids.

func (Entry) IsChat

func (e Entry) IsChat() bool

IsChat reports whether the entry is a chat/completions model.

func (Entry) IsEmbedding

func (e Entry) IsEmbedding() bool

IsEmbedding reports whether the entry is an embeddings model.

func (Entry) IsImage

func (e Entry) IsImage() bool

IsImage reports whether the entry is an image generation model.

func (Entry) IsSTT

func (e Entry) IsSTT() bool

IsSTT reports whether the entry is a speech-to-text model.

func (Entry) IsTTS

func (e Entry) IsTTS() bool

IsTTS reports whether the entry is a text-to-speech model.

func (Entry) StreamingEnabled

func (e Entry) StreamingEnabled() bool

StreamingEnabled returns whether streaming is supported (chat default true).

type Listed

type Listed struct {
	ProviderType string `json:"provider_type"`
	ID           string `json:"id"`
	Mode         string `json:"mode"`
	Entry        Entry  `json:"-"`
}

Listed is a curated catalog row for UI / seed helpers.

func List

func List(providerType string) []Listed

List returns curated models for a provider type (empty providerType → all).

Jump to

Keyboard shortcuts

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