modelgen

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 18 Imported by: 0

README

Model catalog generator

Port of Pi's packages/ai/catalog/** (the catalog generation model that replaced packages/ai/scripts/generate-models.ts). go run ./cmd/gen-models without -src fetches the upstream catalogs and writes the built-in model catalog the way Pi's node catalog/generate.ts does, byte for byte:

  • -data-output <dir>: the provider data files (<provider>.json, model values grouped by API) and .manifest.json (Pi's src/providers/data);
  • -json-only -json-output <dir>: only the public catalog JSON served by pi.dev (models.json, models.all.json, providers.json, providers/<id>.json, providers/<id>.all.json);
  • -strict fails instead of degrading when upstream data is unexpected, -data-only regenerates only the providers already in -data-output, -pretty indents, -record <dir> stores every upstream response, -replay <dir> serves recorded responses instead of fetching.

go run ./cmd/gen-models -src <models.generated.ts or .js> -out ai/models_generated.go is the other job: it turns Pi's generated catalog into the Go catalogs of package ai (make model-catalogs, run by make pin-bump).

Layout

Path Pi counterpart Contents
obj.go (JavaScript objects) Obj, an insertion-ordered plain object: the generated JSON is compared byte for byte with Pi's, so models keep the member order Pi's code gives them.
models_dev.go, source_openrouter.go, source_vercel.go, sources.go catalog/sources/ Upstream fetchers: models.dev v2 (normalized), OpenRouter, Vercel AI Gateway, NVIDIA NIM, Radius. All sources are fetched before anything is built.
providers/<id>.go catalog/providers/<id>.ts One file per built-in provider; register new files in providers/index.go.
family_*.go catalog/families/ Facts about a model family that hold on every host. They apply to every provider's models.
define.go catalog/define.ts ProviderDefinition and the helpers provider files use.
build.go catalog/build.ts Runs the provider definitions in a fixed order.
reasoning.go catalog/reasoning.ts models.dev effort values to Pi thinking levels.
modeldata/ scripts/model-data.ts, hydrate-model-catalog.ts Data manifest, structure hash and validation of the data directory.
../../cmd/gen-models/generate.go catalog/generate.ts Flags, staging, validation and output.

Build order

For each provider: Models returns its chat models (upstream entries mapped to pi models, corrections, authored models; ctx.ProviderModels(id) returns another provider's models from this step); Compat defaults for each API sit under each model's own compat, then the shared rules run (models.dev effort levels for APIs that send them natively, then the family rules); Finalize applies provider-specific behavior and wins over the shared rules; image input limits get the default resize profile, then FinalizeAll runs cross-model logic. Match the TypeScript object construction exactly (member order, || against ??, where a spread puts a key): a model that is built differently serializes differently.

Checking a change

test/parity/testdata/catalog-generation/equivalence.sh runs Pi's generator (from .upstream/current) and this one over the same recorded upstream responses and compares the data directory and the public JSON byte for byte:

test/parity/testdata/catalog-generation/equivalence.sh record build/catalog-fixtures
test/parity/testdata/catalog-generation/equivalence.sh compare build/catalog-fixtures

go test ./cmd/gen-models -run TestCatalogGenerationMatchesPi holds the Go generator to the sha256 of what Pi's generator wrote for a pruned set of recorded responses (cmd/gen-models/testdata/catalog-generation). After a pin bump, re-record, prune (prune.mjs), and refresh the golden file with equivalence.sh golden.

The golden file holds the sha256 of Pi's generator at the pin (b556cfe5) with Pi 9ee7586a9 applied (OpenCode Zen and Go Claude models get per-message effort, #10954; it changes only catalog/providers/opencode.ts). Pi v1.5.0 comes before that commit, so the first pin that contains it is the move to Pi main. Until then a re-record from the mirrored pin produces the old golden and fails eight checksums (models.json, models.all.json, catalog/providers/opencode*.json, data/opencode*.json). Apply the commit's change to the mirror first:

git -C <pi checkout> diff b556cfe5 9ee7586a9 -- packages/ai/catalog/providers/opencode.ts | git apply --directory=.upstream/v1.4.0+b556cfe5 -

.upstream/v1.4.0+b556cfe5 is the mirror directory of the pin (.upstream/current points at it); the patch paths start at packages/ai. The pin bump that reaches 9ee7586a9 re-records the golden from the mirror without this step.

Documentation

Index

Constants

View Source
const (
	ModelsDevURL = "https://models.dev/experimental/v2.0/api.json"
	// v2 has no provider-agnostic decision metadata endpoint; v1 still serves it.
	ModelsDevDecisionsURL = "https://models.dev/models.json?type=decision"
)

The models.dev v2 catalog. The schema is published as experimental, so everything the catalog reads goes through NormalizeModelsDevModel.

View Source
const DefaultRadiusGateway = "https://radius.pi.dev"

DefaultRadiusGateway is the unauthenticated public Radius gateway.

View Source
const KimiK3MaxTokens = 131072

KimiK3MaxTokens is the K3 family's canonical output limit.

View Source
const NvidiaBaseURL = "https://integrate.api.nvidia.com/v1"

NvidiaBaseURL is the NVIDIA NIM endpoint.

View Source
const OpenAILongContextInputThreshold = 272000

OpenAILongContextInputThreshold is the prompt size above which OpenAI bills the long-context tier.

Variables

View Source
var OpenAIMidConvoModelIDs = func() map[string]bool {
	ids := map[string]bool{"gpt-5.4": true, "gpt-5.4-mini": true, "gpt-5.4-pro": true, "gpt-5.5": true}
	for id := range OpenAIToolSearchModelIDs {
		ids[id] = true
	}
	return ids
}()

OpenAIMidConvoModelIDs are the models that accept mid-conversation developer messages.

View Source
var OpenAIToolSearchModelIDs = map[string]bool{
	"gpt-5.6-sol": true, "gpt-5.6-terra": true, "gpt-5.6-luna": true,
	"gpt-6-astra": true, "gpt-6-sol": true, "gpt-6-luna": true, "gpt-6.1-sol": true, "gpt-6.1-terra": true,
}

OpenAIToolSearchModelIDs are the models that accept tool search and `additional_tools`.

Functions

func EnableClaudeMidConvoEffort

func EnableClaudeMidConvoEffort(model ChatModel)

EnableClaudeMidConvoEffort enables per-message effort changes. Models that cannot disable thinking with it lose "off".

func EnableOpenAIGrammarTools

func EnableOpenAIGrammarTools(model ChatModel)

EnableOpenAIGrammarTools enables OpenAI custom grammar tools on Responses endpoints. OpenAI rejects `type: "custom"` tools for pre-GPT-5 models (gpt-4.x, gpt-4o, o-series).

func EnableOpenAIMidConvoSystemMessages

func EnableOpenAIMidConvoSystemMessages(model ChatModel, proxy bool)

EnableOpenAIMidConvoSystemMessages: newer OpenAI Responses models accept developer messages after the conversation has started. Proxies that pass them through also pass `additional_tools` items through unchanged, for the models that accept them.

func IsKimiK3FamilyID

func IsKimiK3FamilyID(modelID string) bool

IsKimiK3FamilyID: Kimi K3 and its point releases (kimi-k3.1-pro, kimi-k3.1-pro-highspeed) share K3's request format. https://api.moonshot.ai/v1/models reports effort levels and dynamic tool loading for all of them.

func MergeCompat

func MergeCompat(model ChatModel, compat *Obj)

MergeCompat shallow-merges compat flags into a model.

func MergeThinking

func MergeThinking(model ChatModel, levels *Obj)

MergeThinking shallow-merges thinking level mappings into a model. Later values win.

func NormalizeNvidiaModelID

func NormalizeNvidiaModelID(modelID string) string

NormalizeNvidiaModelID is the id form models.dev lists NIM models under.

func OpenAIStandardCosts

func OpenAIStandardCosts() map[string]*Obj

OpenAIStandardCosts keeps current OpenAI prices authoritative until models.dev and passthrough catalogs catch up. https://developers.openai.com/api/docs/pricing

func ParseFloat

func ParseFloat(text string) float64

ParseFloat is Number.parseFloat(text): NaN when text has no decimal prefix.

func ParseJSON

func ParseJSON(data []byte) (any, error)

ParseJSON is JSON.parse for catalog sources: objects become *Obj in document order (a repeated key keeps its first position and takes its last value), numbers become float64.

func Quote

func Quote(text string) string

Quote is JSON.stringify(string): it escapes control characters, quotes and backslashes only.

func RoundCost

func RoundCost(value float64) float64

RoundCost is Number(value.toFixed(6)).

func Stringify

func Stringify(value any, indent string) []byte

Stringify is JSON.stringify(value, null, indent) for catalog values; indent is "" or the per-level indent.

func Strings

func Strings(values ...string) []any

Strings is the array of strings value.

func SupportsClaudeMidConvoEffort

func SupportsClaudeMidConvoEffort(modelID string) bool

SupportsClaudeMidConvoEffort reports models that accept per-message `output_config` effort changes.

func SupportsClaudeMidConvoSystemMessages

func SupportsClaudeMidConvoSystemMessages(modelID string) bool

SupportsClaudeMidConvoSystemMessages reports models that accept system messages and tool changes after the conversation starts.

func SupportsOpenAIXhigh

func SupportsOpenAIXhigh(modelID string) bool

SupportsOpenAIXhigh reports ids with the xhigh effort.

func WithInputLimits

func WithInputLimits(model ChatModel, limits *Obj)

WithInputLimits sets provider input limits for image-capable models. Limits the model already carries take precedence.

Types

type AiGatewayCatalog

type AiGatewayCatalog struct {
	Chat, Classifiers []*Obj
}

AiGatewayCatalog is the tool-capable chat models and the evaluation (classifier) models of the Vercel AI Gateway.

func BuildAiGatewayCatalog

func BuildAiGatewayCatalog(items []*Obj) AiGatewayCatalog

BuildAiGatewayCatalog converts the listing: an evaluation model is a classifier served through the TypeSafe-compatible System One endpoint, and any other model becomes a chat model when it carries the tool-use tag.

func FetchAiGatewayCatalog

func FetchAiGatewayCatalog() (AiGatewayCatalog, error)

FetchAiGatewayCatalog fetches tool-capable chat models and evaluation (classifier) models.

type ApiCompatDefaults

type ApiCompatDefaults map[string]CompatFunc

ApiCompatDefaults are compat defaults per API. They sit under each model's own compat, so model values win.

type CatalogSources

type CatalogSources struct {
	ModelsDev          *Obj
	ModelsDevDecisions map[string]ModelsDevDecisionMetadata
	OpenRouter         OpenRouterCatalog
	AIGateway          AiGatewayCatalog
	// NvidiaModelIDs are the live NVIDIA NIM ids, keyed by both the raw and the normalized id.
	NvidiaModelIDs map[string]string
	Radius         []*Obj
}

CatalogSources is everything fetched from upstream before the catalog is built.

func LoadCatalogSources

func LoadCatalogSources(strict bool) (*CatalogSources, error)

LoadCatalogSources fetches every upstream source. In strict mode any failure aborts generation; otherwise a failed source contributes nothing.

type ChatModel

type ChatModel = *Obj

ChatModel is a chat model entry: a pi `Model` object, member order as the catalog constructs it.

func AddMissing

func AddMissing(models, additions []ChatModel) []ChatModel

AddMissing adds models only when upstream has not listed them (yet).

func ModelsDevModels

func ModelsDevModels(ctx *ProviderContext, sourceProvider string, options ModelsDevOptions) ([]ChatModel, error)

ModelsDevModels maps one models.dev provider's tool-capable chat models onto pi models.

type CompatFunc

type CompatFunc func(model *Obj) *Obj

CompatFunc returns the compat defaults for one model of an API. A fixed default returns a fresh copy for every model.

func FixedCompat

func FixedCompat(compat *Obj) CompatFunc

FixedCompat is compat defaults that do not vary by model.

type ModelsDevAPI

type ModelsDevAPI struct {
	Protocol, BaseURL, AISDK string
}

ModelsDevAPI is one API a model is served on, in the order models.dev lists them.

type ModelsDevCost

type ModelsDevCost struct {
	Input, Output, CacheRead, CacheWrite *float64
	// Tiers are context-size tiers. Unlisted rates fall back to the base rates.
	Tiers []ModelsDevCostTier
}

ModelsDevCost is the prices as models.dev lists them. Missing prices stay nil.

type ModelsDevCostTier

type ModelsDevCostTier struct {
	Above                                float64
	Input, Output, CacheRead, CacheWrite *float64
}

ModelsDevCostTier is one context-size tier.

type ModelsDevDecisionMetadata

type ModelsDevDecisionMetadata struct {
	ID, Type, Name string
	// ContextLimit is limit.context, 0 when absent.
	ContextLimit float64
}

ModelsDevDecisionMetadata is provider-agnostic decision model metadata from models.dev.

type ModelsDevModel

type ModelsDevModel struct {
	ID, Name, Type, Status string
	ToolCall               bool
	StructuredOutput       bool
	Reasoning              bool
	// ReasoningOptions is empty when the model does not reason.
	ReasoningOptions []ModelsDevReasoningOption
	ImageInput       bool
	TextInput        bool
	TextOutput       bool
	// ContextWindow and MaxTokens are 0 when models.dev lists none.
	ContextWindow, MaxTokens float64
	Cost                     ModelsDevCost
	APIs                     []ModelsDevAPI
	// Source is the full v2 entry, for fields not normalized above.
	Source *Obj
}

ModelsDevModel is a models.dev model normalized for the catalog.

func ModelsDevChatModels

func ModelsDevChatModels(catalog *Obj, provider string) []*ModelsDevModel

ModelsDevChatModels returns the chat models of one models.dev provider. Specialized types (image, speech, realtime, decision, ...) only appear in v2 and are left out here.

func NormalizeModelsDevModel

func NormalizeModelsDevModel(model *Obj) *ModelsDevModel

NormalizeModelsDevModel reads the subset of a models.dev v2 model the catalog uses.

func (*ModelsDevModel) HasEffortOption

func (m *ModelsDevModel) HasEffortOption() bool

HasEffortOption is `reasoningOptions?.some((option) => option.type === "effort")`.

func (*ModelsDevModel) HasToggleOption

func (m *ModelsDevModel) HasToggleOption() bool

HasToggleOption is `reasoningOptions?.some((option) => option.type === "toggle")`.

type ModelsDevOptions

type ModelsDevOptions struct {
	API     string
	BaseURL string
	Compat  *Obj
	Headers *Obj
	// Protocol keeps only models models.dev lists on this API protocol (e.g. "responses").
	Protocol string
	// SkipDeprecated skips models models.dev marks deprecated.
	SkipDeprecated bool
	// NoRecordReasoning is `recordReasoning: false`: models.dev effort levels are not exposed through the shared rules.
	NoRecordReasoning bool
	// DefaultContextWindow and DefaultMaxTokens are fallback limits when models.dev has none; 4096 each when zero.
	DefaultContextWindow, DefaultMaxTokens float64
	// Include is an extra filter. Models without tool support are always skipped.
	Include func(source *ModelsDevModel) bool
	// Map adjusts or replaces the mapped model. Returning nil skips the model.
	Map func(model ChatModel, source *ModelsDevModel) (ChatModel, error)
}

ModelsDevOptions configures ModelsDevModels.

type ModelsDevReasoningOption

type ModelsDevReasoningOption struct {
	Type   string    `json:"type"`
	Values []*string `json:"values,omitempty"`
	Min    *float64  `json:"min,omitempty"`
	Max    *float64  `json:"max,omitempty"`
}

ModelsDevReasoningOption describes a raw models.dev reasoning control: a toggle, effort values (a value is null in JSON when models.dev lists no verified value) or a token budget.

type Obj

type Obj struct {
	// contains filtered or unexported fields
}

Obj is a JavaScript plain object: string keys in insertion order. Values are nil (JSON null), string, bool, float64, []any and *Obj; Set normalizes int and []string. An absent key is JavaScript's undefined.

func Claude55ThinkingLevels

func Claude55ThinkingLevels(modelID string) *Obj

Claude55ThinkingLevels: models.dev may list Opus 5.5, Sonnet 5.5, and Haiku 5.5 before their effort metadata is complete. Haiku 5.5 accepts disabled thinking; Opus 5.5 and Sonnet 5.5 reject it.

func CloneAll

func CloneAll(objects []*Obj) []*Obj

CloneAll clones every object of a list.

func DeepSeekCompat

func DeepSeekCompat() *Obj

DeepSeekCompat is the compat of DeepSeek V4 on its own API and on hosts that take DeepSeek's thinking format.

func DeepSeekV4FlashThinkingLevelMap

func DeepSeekV4FlashThinkingLevelMap() *Obj

DeepSeekV4FlashThinkingLevelMap is the V4 Flash level map: V4 Pro's with low.

func DeepSeekV4ThinkingLevelMap

func DeepSeekV4ThinkingLevelMap() *Obj

DeepSeekV4ThinkingLevelMap is the V4 Pro level map.

func GetAiGatewayCost

func GetAiGatewayCost(pricing *Obj) *Obj

GetAiGatewayCost converts AI Gateway pricing ($/token) to $/million tokens. Each rate lists its own prompt-length brackets; every bracket start above zero becomes a request-wide tier with the rates in effect there.

func GetEffortThinkingLevelMap

func GetEffortThinkingLevelMap(options []ModelsDevReasoningOption) *Obj

GetEffortThinkingLevelMap converts models.dev verified effort values into Pi's selectable thinking levels. Values without a Pi equivalent (`default` and JSON `null`) are intentionally omitted. The map is nil when no level is verified: toggle, budget, default and null values imply no selectable effort.

func GetOpenRouterThinkingLevelMap

func GetOpenRouterThinkingLevelMap(reasoning *OpenRouterReasoningMetadata) *Obj

GetOpenRouterThinkingLevelMap converts OpenRouter's reasoning metadata into Pi model capabilities; nil when it says nothing.

func GoogleThinkingLevels

func GoogleThinkingLevels(modelID string, reasoningOptions []ModelsDevReasoningOption) *Obj

GoogleThinkingLevels returns Gemini effort levels from models.dev, with a Gemma 4 fallback; nil when neither applies.

func KimiK3Cost

func KimiK3Cost() *Obj

KimiK3Cost is Kimi K3's price.

func KimiK3OpenAICompat

func KimiK3OpenAICompat() *Obj

KimiK3OpenAICompat: Kimi K3-style models take reasoning_effort and need earlier reasoning sent back.

func KimiOpenAICompat

func KimiOpenAICompat() *Obj

KimiOpenAICompat is the Kimi Chat Completions settings shared by Moonshot and Kimi Coding.

func ModelsDevToCost

func ModelsDevToCost(cost ModelsDevCost) *Obj

ModelsDevToCost converts models.dev prices to pi's cost shape. Missing rates are free.

func NewObj

func NewObj() *Obj

NewObj returns an empty object.

func O

func O(pairs ...any) *Obj

O builds an object from alternating keys and values: `{ key: value, ... }`.

func OpenAIStandardCost

func OpenAIStandardCost(id string) *Obj

OpenAIStandardCost is the standard price of an OpenAI model with long-context pricing.

func OpenRouterCost

func OpenRouterCost(pricing *Obj) *Obj

OpenRouterCost converts OpenRouter's $/token prices to pi's $/1M tokens. Missing, invalid and negative base prices are 0. Prompt-length overrides become request-wide tiers; a rate a tier does not list keeps the base price. Time-of-day overrides are skipped because ModelCost cannot express them.

func Spread

func Spread(parts ...*Obj) *Obj

Spread is `{ ...parts[0], ...parts[1], ... }`: a key keeps the position of its first appearance and takes the last value. A nil part contributes nothing, as spreading undefined does. Values are shared, not copied, as in JavaScript.

func WithOpenAILongContextPricing

func WithOpenAILongContextPricing(cost *Obj) *Obj

WithOpenAILongContextPricing: OpenAI bills prompts above 272K input tokens at 2x input and 1.5x output rates.

func (*Obj) Bool

func (o *Obj) Bool(key string) bool

Bool returns a boolean member, false when absent or not a boolean.

func (*Obj) Clone

func (o *Obj) Clone() *Obj

Clone is structuredClone: a deep copy.

func (*Obj) Delete

func (o *Obj) Delete(key string)

Delete removes a member: `delete object[key]`.

func (*Obj) Get

func (o *Obj) Get(key string) (any, bool)

Get reports the member and whether it is present.

func (*Obj) Has

func (o *Obj) Has(key string) bool

Has reports whether the key is present (`key in object`; an undefined value never occurs here).

func (*Obj) Includes

func (o *Obj) Includes(key, value string) bool

Includes is `array.includes(value)` for an array of strings.

func (*Obj) Keys

func (o *Obj) Keys() []string

Keys returns the keys in JavaScript enumeration order: canonical array indices ascending, then the others in insertion order.

func (*Obj) Len

func (o *Obj) Len() int

Len is the number of members.

func (*Obj) List

func (o *Obj) List(key string) []any

List returns an array member, nil when absent or not an array.

func (*Obj) MarshalJSON

func (o *Obj) MarshalJSON() ([]byte, error)

MarshalJSON is JSON.stringify(object).

func (*Obj) Num

func (o *Obj) Num(key string) float64

Num returns a number member, 0 when absent or not a number.

func (*Obj) Object

func (o *Obj) Object(key string) *Obj

Object returns an object member, nil when absent or not an object.

func (*Obj) Set

func (o *Obj) Set(key string, value any) *Obj

Set assigns a member: `object[key] = value`. An existing key keeps its position.

func (*Obj) Str

func (o *Obj) Str(key string) string

Str returns a string member, "" when absent or not a string.

func (*Obj) StringList

func (o *Obj) StringList(key string) []string

StringList returns the strings of an array member.

type OpenRouterCatalog

type OpenRouterCatalog struct {
	Chat, Images, Classifiers []*Obj
}

OpenRouterCatalog is the tool-capable chat, image and decision models of OpenRouter.

func BuildOpenRouterCatalog

func BuildOpenRouterCatalog(listed, imageListed, decisionListed []*Obj) OpenRouterCatalog

BuildOpenRouterCatalog builds the OpenRouter catalog from the default listing and the `output_modalities=image` and `output_modalities=decisions` listings. The default listing omits image-only and decision models, so those come from the other listings. An upstream model may appear in several results; it then gets separate entries per operation.

func FetchOpenRouterCatalog

func FetchOpenRouterCatalog() (OpenRouterCatalog, error)

FetchOpenRouterCatalog fetches the tool-capable chat, image, and decision listings.

type OpenRouterReasoningMetadata

type OpenRouterReasoningMetadata struct {
	Mandatory        bool      `json:"mandatory,omitempty"`
	DefaultEnabled   bool      `json:"default_enabled,omitempty"`
	SupportedEfforts []*string `json:"supported_efforts,omitempty"`
	DefaultEffort    *string   `json:"default_effort,omitempty"`
}

OpenRouterReasoningMetadata is OpenRouter's reasoning metadata of a model.

type ProviderCatalog

type ProviderCatalog struct {
	ID         string
	Chat       []*Obj
	Image      []*Obj
	Classifier []*Obj
}

ProviderCatalog is one provider's built models by type. Chat entries carry `type: "chat"` last.

func BuildCatalog

func BuildCatalog(definitions []ProviderDefinition, sources *CatalogSources, strict bool) ([]ProviderCatalog, error)

BuildCatalog runs every provider's definition, in the order given, against the fetched sources.

type ProviderContext

type ProviderContext struct {
	// ProviderID is the provider being built.
	ProviderID string
	Sources    *CatalogSources
	// Strict fails instead of degrading when upstream data is unexpected.
	Strict bool
	// contains filtered or unexported fields
}

ProviderContext is passed to every provider hook.

func (*ProviderContext) ModelsDevSource

func (c *ProviderContext) ModelsDevSource(model ChatModel) *ModelsDevModel

ModelsDevSource returns the models.dev entry a model was built from, if it was recorded.

func (*ProviderContext) ProviderModels

func (c *ProviderContext) ProviderModels(providerID string) ([]ChatModel, error)

ProviderModels returns copies of another provider's chat models before shared rules run.

func (*ProviderContext) RecordModelsDevSource

func (c *ProviderContext) RecordModelsDevSource(model ChatModel, source *ModelsDevModel)

RecordModelsDevSource records the models.dev entry so shared rules can use its reasoning metadata.

type ProviderDefinition

type ProviderDefinition struct {
	ID          string
	Models      func(ctx *ProviderContext) ([]ChatModel, error)
	Images      func(ctx *ProviderContext) ([]*Obj, error)
	Classifiers func(ctx *ProviderContext) ([]*Obj, error)
	Compat      ApiCompatDefaults
	Finalize    func(model ChatModel, ctx *ProviderContext)
	FinalizeAll func(models []ChatModel, ctx *ProviderContext)
}

ProviderDefinition is one built-in provider's catalog. The build runs, in order:

  1. Models: upstream models plus authored ones, with data corrections.
  2. Compat defaults and the shared model-family rules in the families files.
  3. Finalize: provider-specific behavior that must win over shared rules.
  4. Shared normalization (image input limits), then FinalizeAll.

Directories

Path Synopsis
Package providers holds every built-in provider catalog: one file per provider of packages/ai/catalog/providers, registered in All in the order of providers/index.ts.
Package providers holds every built-in provider catalog: one file per provider of packages/ai/catalog/providers, registered in All in the order of providers/index.ts.

Jump to

Keyboard shortcuts

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