Skip to main content

ModelEntry

Struct ModelEntry 

Source
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

Source

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.

Source

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.comdeepseek), 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.

Source

pub fn is_priced(&self) -> bool

Whether this entry carries any rate at all.

Source

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.

Source

pub fn price_age(&self, now: DateTime<Utc>) -> Option<TimeDelta>

How long ago the rates were recorded, or None when unstamped.

Trait Implementations§

Source§

impl Clone for ModelEntry

Source§

fn clone(&self) -> ModelEntry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ModelEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModelEntry

Source§

fn default() -> ModelEntry

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ModelEntry

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ModelEntry

Source§

fn eq(&self, other: &ModelEntry) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ModelEntry

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ModelEntry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more