providermodelcatalog

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 11 Imported by: 0

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 added in v0.3.0

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 added in v0.3.0

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 added in v0.3.0

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

Types

type FetchOptions

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

type Model

type Model struct {
	ID               string
	Description      string
	ContextWindow    int
	ToolCall         bool
	Reasoning        bool
	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 FetchRemote

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

func FilterModelsForProvider added in v0.3.0

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)

Jump to

Keyboard shortcuts

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