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 more