modelsdev

package module
v0.0.0-...-4da39aa Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package modelsdev provides access to merged model metadata from models.dev combined with a static overlay of custom fields (reasoning levels, default reasoning level, custom tool support) that models.dev does not supply.

Both the base models.dev API snapshot (models-dev-api.json) and the overlay (model-overlay.json) are embedded at compile time. The overlay is applied once on first use; callers see a single, already-merged view.

Typical usage:

if md := modelsdev.Lookup("openai", "gpt-5.2"); md != nil {
    fmt.Println(md.ReasoningLevels)   // ["low","medium","high","xhigh"]
    fmt.Println(md.DefaultReasonLevel) // "medium"
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModelCapabilities

type ModelCapabilities struct {
	ReasoningSummary *bool // nil = enabled by default for reasoning models
}

ModelCapabilities holds typed, model-specific feature flags for optional request fields whose support varies across models.

type ModelCost

type ModelCost struct {
	Input  float64
	Output float64
}

ModelCost holds the per-token cost for a model.

type ModelInfo

type ModelInfo struct {
	ID                 string
	Name               string
	Family             string
	Reasoning          bool
	ReasoningLevels    []string // valid reasoning level values for this model
	DefaultReasonLevel string   // default reasoning level (empty = provider decides)
	ContextWindow      int
	MaxOutputTokens    int
	InputModalities    []string
	OutputModalities   []string
	ToolCall           bool // whether this model supports tool/function calling
	CustomTools        bool // whether this model supports provider-specific custom grammar tools
	Capabilities       ModelCapabilities
	Cost               ModelCost
}

ModelInfo contains the merged metadata for a single model.

func AllForProvider

func AllForProvider(providerID string) []ModelInfo

AllForProvider returns merged metadata for every model under the given provider ID. Returns nil if the provider is not found.

func Lookup

func Lookup(providerID, modelID string) *ModelInfo

Lookup returns the merged model metadata for a specific provider and model ID. Returns nil if the provider or model is not found.

func (*ModelInfo) SupportsInputModality

func (m *ModelInfo) SupportsInputModality(modality string) bool

SupportsInputModality reports whether the model accepts the specified input modality (for example "image" or "pdf").

func (*ModelInfo) SupportsReasoningSummary

func (m *ModelInfo) SupportsReasoningSummary() bool

SupportsReasoningSummary reports whether the model accepts the optional reasoning.summary request field.

type ProviderInfo

type ProviderInfo struct {
	ID      string
	Name    string
	API     string   // default base URL
	NPM     string   // npm package used by models.dev (e.g. "@ai-sdk/openai-compatible")
	EnvVars []string // required env var names (e.g. ["ANTHROPIC_API_KEY"])
	Doc     string   // documentation URL or description
}

ProviderInfo holds provider-level metadata from models.dev.

func AllProviders

func AllProviders() []ProviderInfo

AllProviders returns metadata for every provider in models.dev.

func LookupProvider

func LookupProvider(providerID string) *ProviderInfo

LookupProvider returns provider-level metadata for the given provider ID. Returns nil if the provider is not found.

func ProvidersByNPM

func ProvidersByNPM(npmPackage string) []ProviderInfo

ProvidersByNPM returns all providers whose npm field matches the given package name. Used to bulk-register providers that share a common API implementation.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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