pub struct ModelRegistry { /* private fields */ }Expand description
A searchable collection of model entries.
Implementations§
Source§impl ModelRegistry
impl ModelRegistry
Sourcepub fn from_litellm_json(json: &[u8]) -> Self
pub fn from_litellm_json(json: &[u8]) -> Self
Build a registry from parsed LiteLLM JSON bytes.
Sourcepub fn tier(&self, model_id: &str) -> ModelTier
pub fn tier(&self, model_id: &str) -> ModelTier
Capability/cost tier of a model, classified against this registry’s
chat-model price distribution. Unknown models classify as
ModelTier::Balanced.
Sourcepub fn tier_of(&self, entry: &ModelEntry) -> ModelTier
pub fn tier_of(&self, entry: &ModelEntry) -> ModelTier
Capability/cost tier of a specific registry entry.
Sourcepub fn lookup(&self, model_id: &str) -> Option<&ModelEntry>
pub fn lookup(&self, model_id: &str) -> Option<&ModelEntry>
Exact match on the LiteLLM key, then version-suffix normalization.
Normalization strips trailing -vN[:M], -YYYYMMDD, -YYYY-MM-DD,
and @YYYYMMDD suffixes, so dated or versioned aliases resolve to
the base model’s record. It never binds a bare query to a
provider-scoped key (github_copilot/claude-sonnet-4 only answers
github_copilot/ lookups) and never changes the model family: an
unknown or retired ID returns None.
Sourcepub fn models_for_provider(
&self,
provider: &Provider,
) -> impl Iterator<Item = &ModelEntry>
pub fn models_for_provider( &self, provider: &Provider, ) -> impl Iterator<Item = &ModelEntry>
All models from a given provider.
Sourcepub fn models_by_mode(
&self,
mode: ModelMode,
) -> impl Iterator<Item = &ModelEntry>
pub fn models_by_mode( &self, mode: ModelMode, ) -> impl Iterator<Item = &ModelEntry>
All models matching a given mode.
Sourcepub fn models_with_ability(
&self,
ability: Ability,
) -> impl Iterator<Item = &ModelEntry>
pub fn models_with_ability( &self, ability: Ability, ) -> impl Iterator<Item = &ModelEntry>
All models with a specific ability.
Sourcepub fn all(&self) -> impl Iterator<Item = &ModelEntry>
pub fn all(&self) -> impl Iterator<Item = &ModelEntry>
Iterate over all entries.