pub enum Model {
Opus46,
Opus45,
Sonnet45,
Sonnet4,
Haiku45,
Haiku35,
Sonnet35V2,
Unknown,
}Expand description
Model identifier.
Parsed from status line JSON: model.id field.
Uses prefix matching for forward compatibility with new date variants.
Variants§
Opus46
Claude Opus 4.6 (claude-opus-4-6-*)
Opus45
Claude Opus 4.5 (claude-opus-4-5-*)
Sonnet45
Claude Sonnet 4.5 (claude-sonnet-4-5-*)
Sonnet4
Claude Sonnet 4 (claude-sonnet-4-*)
Haiku45
Claude Haiku 4.5 (claude-haiku-4-5-*)
Haiku35
Claude Haiku 3.5 (claude-3-5-haiku-*)
Sonnet35V2
Claude Sonnet 3.5 v2 (claude-3-5-sonnet-*)
Unknown
Unknown or non-Anthropic model
Implementations§
Source§impl Model
impl Model
Sourcepub fn display_name(&self) -> &'static str
pub fn display_name(&self) -> &'static str
Returns a human-readable display name for known models.
For Unknown models, callers should use derive_display_name
with the raw model ID for a better fallback.
Sourcepub fn context_window_size(&self) -> u32
pub fn context_window_size(&self) -> u32
Returns the context window size for this model.
Sourcepub fn input_cost_per_million(&self) -> f64
pub fn input_cost_per_million(&self) -> f64
Returns approximate cost per million input tokens (USD).
Sourcepub fn output_cost_per_million(&self) -> f64
pub fn output_cost_per_million(&self) -> f64
Returns approximate cost per million output tokens (USD).
Sourcepub fn from_id(id: &str) -> Self
pub fn from_id(id: &str) -> Self
Parses a model from its string ID using prefix matching.
More specific prefixes are checked first to avoid false matches (e.g., “claude-sonnet-4-5” before “claude-sonnet-4-”).
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Returns true if this is an unknown/unrecognized model.