catalog

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderFake             = "fake"
	ProviderOpenAI           = "openai"
	ProviderAnthropic        = "anthropic"
	ProviderGoogle           = "google"
	ProviderMoonshot         = "moonshot"
	ProviderChatGLM          = "chatglm"
	ProviderDeepSeek         = "deepseek"
	ProviderQwen             = "qwen"
	ProviderOpenRouter       = "openrouter"
	ProviderXAI              = "xai"
	ProviderGroq             = "groq"
	ProviderOllama           = "ollama"
	ProviderOpenAICompatible = "openai-compatible"
)
View Source
const (
	APIFake              = "fake"
	APIOpenAIChat        = "openai-chat-completions"
	APIAnthropicMessages = "anthropic-messages"
)

Variables

This section is empty.

Functions

func APIKind

func APIKind(providerID string) string

func ContextPolicy

func ContextPolicy(providerID, modelID string) contextpolicy.Policy

func CostForUsage

func CostForUsage(model Model, usage provider.Usage) float64

func DefaultBaseURL

func DefaultBaseURL(providerID string) string

func EnvKeys

func EnvKeys(providerID string) []string

func NormalizeProvider

func NormalizeProvider(id string) string

func RegisterForTest

func RegisterForTest(p Provider) func()

func SupportsModel

func SupportsModel(providerID, modelID string) bool

func SupportsProvider

func SupportsProvider(id string) bool

Types

type CacheCapability

type CacheCapability struct {
	PromptCacheKey        bool `json:"prompt_cache_key,omitempty"`
	PromptCacheRetention  bool `json:"prompt_cache_retention,omitempty"`
	AnthropicCacheControl bool `json:"anthropic_cache_control,omitempty"`
}

func Cache

func Cache(providerID, modelID string) CacheCapability

type Cost

type Cost struct {
	InputPerMTok      float64 `json:"input_per_mtok,omitempty"`
	OutputPerMTok     float64 `json:"output_per_mtok,omitempty"`
	CacheReadPerMTok  float64 `json:"cache_read_per_mtok,omitempty"`
	CacheWritePerMTok float64 `json:"cache_write_per_mtok,omitempty"`
}

type Model

type Model struct {
	ID             string          `json:"id"`
	Name           string          `json:"name"`
	Provider       string          `json:"provider"`
	API            string          `json:"api"`
	ContextWindow  int64           `json:"context_window,omitempty"`
	MaxTokens      int64           `json:"max_tokens,omitempty"`
	Input          []string        `json:"input"`
	Reasoning      bool            `json:"reasoning"`
	Cost           Cost            `json:"cost,omitempty"`
	Cache          CacheCapability `json:"cache,omitempty"`
	Default        bool            `json:"default,omitempty"`
	OpenAIModelID  string          `json:"openai_model_id,omitempty"`
	AnthropicModel string          `json:"anthropic_model,omitempty"`
}

func DefaultModel

func DefaultModel(providerID string) (Model, bool)

func FindModel

func FindModel(providerID, modelID string) (Model, bool)

func Models

func Models(providerID string) []Model

type Provider

type Provider struct {
	ID             string              `json:"id"`
	Name           string              `json:"name"`
	API            string              `json:"api"`
	DefaultBaseURL string              `json:"default_base_url,omitempty"`
	DefaultModel   string              `json:"default_model,omitempty"`
	EnvKeys        []string            `json:"env_keys,omitempty"`
	Custom         bool                `json:"custom,omitempty"`
	Cache          CacheCapability     `json:"cache,omitempty"`
	WebSearch      WebSearchCapability `json:"web_search,omitempty"`
	Models         []Model             `json:"models"`
}

func FindProvider

func FindProvider(id string) (Provider, bool)

func Providers

func Providers() []Provider

type WebSearchCapability

type WebSearchCapability struct {
	DefaultSource    string   `json:"default_source,omitempty"`
	HostedWireShape  string   `json:"hosted_wire_shape,omitempty"`
	HostedWireShapes []string `json:"hosted_wire_shapes,omitempty"`
}

func WebSearch

func WebSearch(providerID string) WebSearchCapability

Jump to

Keyboard shortcuts

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