pub struct ModelEntry {
pub id: &'static str,
pub name: &'static str,
pub api: Api,
pub provider: &'static str,
pub reasoning: bool,
pub input: &'static [InputModality],
pub cost_input: f64,
pub cost_output: f64,
pub cost_cache_read: f64,
pub cost_cache_write: f64,
pub context_window: u32,
pub max_tokens: u32,
}Expand description
Returns true if a provider id came from the openclaw port AND has unverified pricing.
These are the providers whose 0.0 cost values in the openclaw
upstream are placeholder, not verified-free. The runtime sentinel
transformation (0.0 → -1.0) applies to them.
Providers with verified prices (venice, novita) are NOT in this set — their values are backfilled and treated as known.
See data/catalog/README.md for the data-quality breakdown.
A static model entry in the database.
Uses &'static str references for zero-allocation lookups.
Fields§
§id: &'static strModel identifier (e.g., “claude-sonnet-4-20250514”)
name: &'static strHuman-readable model name (e.g., “Claude Sonnet 4”)
api: ApiAPI protocol to use
provider: &'static strProvider name (e.g., “anthropic”, “openai”)
reasoning: boolWhether this model supports reasoning/thinking
input: &'static [InputModality]Supported input modalities
cost_input: f64Cost per million input tokens (USD)
cost_output: f64Cost per million output tokens (USD)
cost_cache_read: f64Cost per million cached read tokens (USD)
cost_cache_write: f64Cost per million cached write tokens (USD)
context_window: u32Maximum context window in tokens
max_tokens: u32Maximum output tokens
Implementations§
Source§impl ModelEntry
impl ModelEntry
Sourcepub fn supports_vision(&self) -> bool
pub fn supports_vision(&self) -> bool
Check if this model supports image/vision input
Sourcepub fn supports_reasoning(&self) -> bool
pub fn supports_reasoning(&self) -> bool
Check if this model supports reasoning/thinking
Sourcepub fn calculate_cost(
&self,
input_tokens: u64,
output_tokens: u64,
cache_read: u64,
cache_write: u64,
) -> f64
pub fn calculate_cost( &self, input_tokens: u64, output_tokens: u64, cache_read: u64, cache_write: u64, ) -> f64
Calculate the cost for a given token usage.
Returns 0.0 for any field that is the unverified sentinel
(UNVERIFIED_PRICE, i.e. negative). Callers that care about
unverified prices should check ModelEntry::pricing_unverified
first and warn the user.
Sourcepub fn pricing_verified(&self) -> bool
pub fn pricing_verified(&self) -> bool
Sentinel value indicating “price unknown” / “not verified”.
Distinguishes upstream-supplied zero (e.g. a free local model) from “we don’t have the price yet, use with caution”. The convention is:
cost_input = -1.0(or any negative) means: price is unverified. UIs should warn the user. Cost calculations may return 0 or refuse.cost_input = 0.0means: price is verified as zero (truly free).cost_input > 0.0means: verified price per million tokens.
The BuiltinModelEntry → ModelEntry converter applies this
transformation: upstream 0.0 for a known paid provider becomes -1.0
here. The pricing_verified method lets callers check.
Sourcepub fn pricing_unverified(&self) -> bool
pub fn pricing_unverified(&self) -> bool
Returns true if either cost field is the unverified sentinel.
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 moreimpl Copy for ModelEntry
Source§impl Debug for ModelEntry
impl Debug for ModelEntry
Source§impl From<&BuiltinModelEntry> for ModelEntry
impl From<&BuiltinModelEntry> for ModelEntry
Source§fn from(e: &BuiltinModelEntry) -> ModelEntry
fn from(e: &BuiltinModelEntry) -> ModelEntry
Source§impl PartialEq for ModelEntry
impl PartialEq for ModelEntry
impl StructuralPartialEq for ModelEntry
Auto Trait Implementations§
impl Freeze for ModelEntry
impl RefUnwindSafe for ModelEntry
impl Send for ModelEntry
impl Sync for ModelEntry
impl Unpin for ModelEntry
impl UnsafeUnpin for ModelEntry
impl UnwindSafe for ModelEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.