pub struct ModelsDevCatalog {
pub models: BTreeMap<String, ModelsDevModel>,
pub providers: BTreeMap<String, ModelsDevProvider>,
}Expand description
Combined Models.dev catalog payload.
Fields§
§models: BTreeMap<String, ModelsDevModel>Provider-agnostic model facts, keyed by canonical model id.
providers: BTreeMap<String, ModelsDevProvider>Provider-scoped catalogs, keyed by provider id.
Implementations§
Source§impl ModelsDevCatalog
impl ModelsDevCatalog
Sourcepub fn parse_json(raw: &str) -> Result<Self>
pub fn parse_json(raw: &str) -> Result<Self>
Parse a Models.dev combined catalog JSON payload.
§Errors
Returns a serde error when the input is not valid Models.dev JSON.
Sourcepub fn model(&self, model_id: &str) -> Option<&ModelsDevModel>
pub fn model(&self, model_id: &str) -> Option<&ModelsDevModel>
Look up provider-agnostic model facts by canonical model id.
Sourcepub fn provider(&self, provider_id: &str) -> Option<&ModelsDevProvider>
pub fn provider(&self, provider_id: &str) -> Option<&ModelsDevProvider>
Look up a provider catalog by provider id.
Sourcepub fn provider_model(
&self,
provider_id: &str,
wire_model_id: &str,
) -> Option<&ModelsDevProviderModel>
pub fn provider_model( &self, provider_id: &str, wire_model_id: &str, ) -> Option<&ModelsDevProviderModel>
Look up a provider-scoped wire model row.
Sourcepub fn provider_offering(
&self,
provider_id: &str,
wire_model_id: &str,
) -> Option<ProviderModelOffering>
pub fn provider_offering( &self, provider_id: &str, wire_model_id: &str, ) -> Option<ProviderModelOffering>
Build a route offering from a provider-scoped Models.dev row.
The canonical model is set only when the row carries an explicit
base_model id. Generated Models.dev JSON often inlines inherited facts
without that link, so callers must not guess one from a prefix.
Sourcepub fn provider_offerings(
&self,
provider_id: &str,
) -> Option<Vec<ProviderModelOffering>>
pub fn provider_offerings( &self, provider_id: &str, ) -> Option<Vec<ProviderModelOffering>>
Build route offerings for every normal text-chat model served by a provider.
Non-chat rows (for example TTS/audio-only offerings) stay in the parsed catalog but are excluded from route resolution lists.
Trait Implementations§
Source§impl Clone for ModelsDevCatalog
impl Clone for ModelsDevCatalog
Source§fn clone(&self) -> ModelsDevCatalog
fn clone(&self) -> ModelsDevCatalog
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelsDevCatalog
impl Debug for ModelsDevCatalog
Source§impl Default for ModelsDevCatalog
impl Default for ModelsDevCatalog
Source§fn default() -> ModelsDevCatalog
fn default() -> ModelsDevCatalog
Source§impl<'de> Deserialize<'de> for ModelsDevCatalog
impl<'de> Deserialize<'de> for ModelsDevCatalog
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ModelsDevCatalog
impl PartialEq for ModelsDevCatalog
Source§fn eq(&self, other: &ModelsDevCatalog) -> bool
fn eq(&self, other: &ModelsDevCatalog) -> bool
self and other values to be equal, and is used by ==.