providermodelcatalog

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultModelsDevURL = "https://models.dev/api.json"
)

Variables

This section is empty.

Functions

func IsCodingModel

func IsCodingModel(model Model) bool

func IsKnownNonCodingModelID

func IsKnownNonCodingModelID(id string) bool

func IsSTTModel

func IsSTTModel(model Model) bool

IsSTTModel reports whether a model transcribes speech to text — the models IsKnownNonCodingModelID filters OUT of the coding picker, filtered back IN for the /stt-model picker.

The reliable signal is the model's declared modalities, not its name: a transcriber consumes audio and emits text. Anything that emits audio is text-to-speech or speech-to-speech, never a transcriber, so audio output is a hard disqualifier. Only when a catalog entry carries no usable modality metadata (common for the Groq/OpenAI transcription models, which models.dev lists sparsely) do we fall back to a name heuristic.

func IsSTTModelID

func IsSTTModelID(id string) bool

IsSTTModelID is the name-only heuristic used when a catalog entry declares no modalities. It matches the known transcription model families and explicitly rejects text-to-speech names, so it never confuses a TTS model for a transcriber. Weaker than the modality signal in IsSTTModel — a fallback, not the primary test.

func LooksLikeCodingModelID

func LooksLikeCodingModelID(id string) bool

func ModelIDAllowedForProvider

func ModelIDAllowedForProvider(providerID, modelID string) bool

ModelIDAllowedForProvider reports whether a model ID is permitted for the given provider under provider-specific allow/block rules. For opencode-go-anthropic-compatible: only Qwen and MiniMax model IDs are allowed. Allows ANY model by default

func ModelsDevProviderID

func ModelsDevProviderID(provider providercatalog.Descriptor) string

func PublicLiveCatalog

func PublicLiveCatalog(providerID string) bool

PublicLiveCatalog reports whether the provider publishes a public live model list that Zero should prefer over third-party catalogs (models.dev) and that can be fetched without credentials.

Types

type FetchOptions

type FetchOptions struct {
	HTTPClient     *http.Client
	ModelsDevURL   string
	OpenGatewayURL string
	OpenRouterURL  string
}

type Model

type Model struct {
	ID                     string
	Description            string
	ContextWindow          int
	ToolCall               bool
	Reasoning              bool
	ReasoningEfforts       []string
	DefaultReasoningEffort string
	ServiceTiers           []string
	DefaultServiceTier     string
	InputModalities        []string
	OutputModalities       []string
	InputCost              float64
	OutputCost             float64
	Tags                   []string
	Source                 string
}

func FetchModelsDev

func FetchModelsDev(ctx context.Context, providerID string, options FetchOptions) ([]Model, error)

func FetchOpenGateway

func FetchOpenGateway(ctx context.Context, endpoint string, options FetchOptions) ([]Model, error)

func FetchOpenRouter

func FetchOpenRouter(ctx context.Context, endpoint string, options FetchOptions) ([]Model, error)

FetchOpenRouter loads OpenRouter's public live model list (GET /api/v1/models). Auth is optional for listing; callers may still attach a key for account-scoped probes via the live discovery path. When the live host is unreachable or returns an unparseable body, fall back to models.dev so the picker still degrades instead of failing entirely (both catalog and live probe hit openrouter.ai otherwise).

func FetchRemote

func FetchRemote(ctx context.Context, provider providercatalog.Descriptor, options FetchOptions) ([]Model, error)

func FilterModelsForProvider

func FilterModelsForProvider(providerID string, models []Model) []Model

FilterModelsForProvider filters a model slice by ModelIDAllowedForProvider.

func Models

func Models(provider providercatalog.Descriptor) []Model

func ParseModelsDevProvider

func ParseModelsDevProvider(body []byte, providerID string) ([]Model, error)

func ParseOpenGatewayCatalog

func ParseOpenGatewayCatalog(body []byte) ([]Model, error)

ParseOpenGatewayCatalog parses OpenGateway's live GET /v1/models payload (or the older {models:[...]} shape). The gateway already curates what it exposes, so every non-empty id is accepted rather than applying the coding-model heuristic.

func ParseOpenRouterCatalog

func ParseOpenRouterCatalog(body []byte) ([]Model, error)

ParseOpenRouterCatalog parses OpenRouter's public GET /api/v1/models list and keeps coding-capable entries (tools, reasoning, or coding-like ids).

Jump to

Keyboard shortcuts

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