Documentation
¶
Index ¶
- Constants
- func IsCodingModel(model Model) bool
- func IsKnownNonCodingModelID(id string) bool
- func IsSTTModel(model Model) bool
- func IsSTTModelID(id string) bool
- func LooksLikeCodingModelID(id string) bool
- func ModelIDAllowedForProvider(providerID, modelID string) bool
- func ModelsDevProviderID(provider providercatalog.Descriptor) string
- func PublicLiveCatalog(providerID string) bool
- type FetchOptions
- type Model
- func FetchModelsDev(ctx context.Context, providerID string, options FetchOptions) ([]Model, error)
- func FetchOpenGateway(ctx context.Context, endpoint string, options FetchOptions) ([]Model, error)
- func FetchOpenRouter(ctx context.Context, endpoint string, options FetchOptions) ([]Model, error)
- func FetchRemote(ctx context.Context, provider providercatalog.Descriptor, options FetchOptions) ([]Model, error)
- func FilterModelsForProvider(providerID string, models []Model) []Model
- func Models(provider providercatalog.Descriptor) []Model
- func ParseModelsDevProvider(body []byte, providerID string) ([]Model, error)
- func ParseOpenGatewayCatalog(body []byte) ([]Model, error)
- func ParseOpenRouterCatalog(body []byte) ([]Model, error)
Constants ¶
const (
DefaultModelsDevURL = "https://models.dev/api.json"
)
Variables ¶
This section is empty.
Functions ¶
func IsCodingModel ¶
func IsKnownNonCodingModelID ¶
func IsSTTModel ¶
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 ¶
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 ModelIDAllowedForProvider ¶
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 ¶
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 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 FetchOpenGateway ¶
func FetchOpenRouter ¶
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 ¶
FilterModelsForProvider filters a model slice by ModelIDAllowedForProvider.
func Models ¶
func Models(provider providercatalog.Descriptor) []Model
func ParseModelsDevProvider ¶
func ParseOpenGatewayCatalog ¶
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 ¶
ParseOpenRouterCatalog parses OpenRouter's public GET /api/v1/models list and keeps coding-capable entries (tools, reasoning, or coding-like ids).