pub struct ModelEntry {Show 13 fields
pub provider: String,
pub vendor: Option<String>,
pub model: String,
pub base_url: Option<String>,
pub secret: Option<SecretRef>,
pub capabilities: Vec<String>,
pub params: Value,
pub tier: Option<RouteTier>,
pub cost_per_1k_tokens: Option<f64>,
pub input_cost_per_1k: Option<f64>,
pub output_cost_per_1k: Option<f64>,
pub context_window: Option<u64>,
pub priced_at: Option<DateTime<Utc>>,
}Fields§
§provider: String§vendor: Option<String>Who makes this model — the models.dev catalog vendor (deepseek,
groq, mistral, …).
Distinct from provider, which is the wire protocol MUR dials: a
DeepSeek entry is provider: openai + vendor: deepseek, because the
runtime reaches it over the OpenAI protocol while the catalog files it
under DeepSeek. Only recorded when the two differ — for Anthropic,
OpenAI and Ollama the protocol already names the vendor.
None on entries written before this field existed; readers should go
through ModelEntry::vendor_candidates rather than reading it raw.
model: String§base_url: Option<String>§secret: Option<SecretRef>§capabilities: Vec<String>§params: Value§tier: Option<RouteTier>Routing tier: cheap/local vs frontier/expensive. When absent, the router infers based on provider.
cost_per_1k_tokens: Option<f64>Estimated USD cost per 1000 output tokens. Used for ledger cost estimates.
input_cost_per_1k: Option<f64>Estimated USD cost per 1000 input tokens. New field for split input/output cost tracking.
output_cost_per_1k: Option<f64>Estimated USD cost per 1000 output tokens. New field for split input/output cost tracking.
context_window: Option<u64>Model context window size in tokens.
priced_at: Option<DateTime<Utc>>When the rates above were recorded.
Vendors move prices; a rate written months ago is a guess wearing the
costume of a fact, and nothing else on this struct can tell the two
apart. None means unknown — entries predating this field, or hand-
written ones — which is honest rather than defaulting to “fresh”.
Implementations§
Source§impl ModelEntry
impl ModelEntry
Sourcepub fn effective_costs(&self) -> (Option<f64>, Option<f64>)
pub fn effective_costs(&self) -> (Option<f64>, Option<f64>)
Resolve effective per-1k rates as (input, output).
The deprecated cost_per_1k_tokens is treated as the output rate and
also as the input fallback, so legacy single-rate entries keep working.
Sourcepub fn vendor_candidates(&self) -> Vec<String>
pub fn vendor_candidates(&self) -> Vec<String>
Catalog vendor names to try for this entry, most specific first.
The recorded vendor wins. Failing that — legacy entries, or anything
written by hand — the host of base_url is tried
(https://api.deepseek.com → deepseek), then provider, which names
the vendor only when the vendor happens to have its own client.
Every caller that asks an external catalog about an entry must go
through this. Asking with provider alone reports every
OpenAI-compatible third party as unknown.
Sourcepub fn stamp_priced_at(&mut self, now: DateTime<Utc>)
pub fn stamp_priced_at(&mut self, now: DateTime<Utc>)
Stamp priced_at with now, but only if a rate is actually present —
a date on an unpriced entry would claim a freshness it does not have.
Never overwrites an existing stamp with an older one.
Trait Implementations§
Source§impl Clone for ModelEntry
impl Clone for ModelEntry
Source§fn clone(&self) -> ModelEntry
fn clone(&self) -> ModelEntry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more