pub struct ModelEntry {
pub provider: 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§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 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