Model metadata
Data source
The switchboard ships with a bundled snapshot of model metadata from models.dev — an open-source TOML registry that separates provider-agnostic model facts from provider-specific pricing. The snapshot is vendored at build time by the agentkit-models crate (a separate workspace crate with a build.rs that fetches and converts the models.dev data to JSON).
Two layers of data:
- Provider-agnostic model facts (
models/<lab>/<model>.toml): context window, max output, capabilities, modalities, knowledge cutoff, release date. - Provider-specific pricing (
providers/<provider>/models/<model>.toml): per-million-token costs. Inherits frombase_modelwith overrides.
Merge order
Model metadata is resolved in this precedence order (highest wins):
- Per-provider TOML
[providers.model_overrides.*]in the user's switchboard config file. - Bundled models.dev snapshot (provider pricing merged on top of model-agnostic facts).
- Built-in defaults (empty — every model fact must come from a source above).
The merge is field-level: if the user's TOML override only specifies context_window, only that field is replaced. All other fields from the bundled snapshot are preserved. Overrides apply only to the provider that declares them; they do not affect the same model ID at another provider. An override key also adds the model to that provider's served list.
Catalogue shape
Every configured (provider, model) pair is exposed under a provider-qualified
id: identity/model-id. That id can be sent in a request; Switchboard strips
the qualifier, pins routing to that provider, and rewrites the upstream
model field back to the bare id.
A bare model id is also exposed as an alias when the model has exactly one shape group:
- one provider, or
- several providers whose complete shape fingerprints are identical.
A shape fingerprint covers every exposed property. If any property is unknown
(null/absent), the instance remains a singleton provider-qualified row and
is never merged. Two unknown instances are not assumed to match. When a model
id has multiple shape groups, no bare alias exists; clients must use a
qualified id.
Model lookup
Used by the routing algorithm to:
- Verify the requested model is known (unknown -> 503).
- Determine provider pricing for cost comparison during ranking.
- Assemble the
GET /openai/v1/modelsresponse.
fn lookup(id: &str) -> Option<EnrichedModel>;
fn lookup_for(provider_identity: &str, model: &str) -> Option<EnrichedModel>;
fn has_alias(model: &str) -> bool;
Pricing overlay
Each provider in the TOML config specifies base pricing (input_per_mtok, output_per_mtok) with optional per-model overrides:
[providers.pricing]
input_per_mtok = 2.50
output_per_mtok = 10.00
[providers.pricing.models."gpt-4o-mini"]
input_per_mtok = 0.15
output_per_mtok = 0.60
When a model has no per-model override, the provider's base pricing is used. The pricing feeds into the routing cost comparison: est_tokens * price_per_token.
Refresh cadence
The models.dev snapshot is regenerated in CI on each release. A future improvement may add periodic refresh at runtime (e.g., weekly check for updated pricing). Between releases, users can override any field via [providers.model_overrides.*] TOML in their config file.