Skip to main content

get_model_entry

Function get_model_entry 

Source
pub fn get_model_entry(provider: &str, id: &str) -> Option<&'static ModelEntry>
Expand description

Look up a specific model entry by provider and model ID.

Uses an O(1) index internally. Falls back gracefully if not found.

§Arguments

  • provider - The provider name (e.g., “anthropic”, “openai”)
  • id - The model ID (e.g., “claude-sonnet-4-20250514”)

§Returns

Some(&ModelEntry) if found, None otherwise.

§Example

use oxicode_ai::model_db::get_model_entry;
let m = get_model_entry("openai", "gpt-4o").unwrap();
assert_eq!(m.name, "GPT-4o");