From b507d69b2a71a446d5b5fcf5df468fab512e057d Mon Sep 17 00:00:00 2001 From: wyenox <227889946+wyenox@users.noreply.github.com> Date: Mon, 9 Feb 2026 19:29:59 -0300 Subject: [PATCH 1/2] extract model name if available --- src/utils/openai.rs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/utils/openai.rs b/src/utils/openai.rs index 3f8b7d1..6550853 100644 --- a/src/utils/openai.rs +++ b/src/utils/openai.rs @@ -1,4 +1,4 @@ -//! Shared definitions and utilities for the OpenAI spec. +//! Shared definitions and utilities for the OpenAI spec (and extensions). use crate::protocol::*; use serde::Deserialize; @@ -7,6 +7,10 @@ use serde::Deserialize; #[derive(Clone, Debug, Deserialize, PartialEq)] pub(crate) struct Model { pub id: String, + /// OpenRouter human readable name. + pub name: Option, + /// Anthropic human readable name. + pub display_name: Option, } /// Response from the models endpoint. @@ -77,12 +81,21 @@ pub(crate) async fn get_bots( let bots: Vec = models .iter() - .map(|m| Bot { - id: BotId::new(&m.id), - name: m.id.clone(), - avatar: EntityAvatar::from_first_grapheme(&m.id.to_uppercase()) - .unwrap_or_else(|| EntityAvatar::Text("?".into())), - capabilities: capabilities.clone(), + .map(|m| { + let name = m + .name + .as_ref() + .or(m.display_name.as_ref()) + .cloned() + .unwrap_or_else(|| m.id.clone()); + + Bot { + id: BotId::new(&m.id), + name, + avatar: EntityAvatar::from_first_grapheme(&m.id.to_uppercase()) + .unwrap_or_else(|| EntityAvatar::Text("?".into())), + capabilities: capabilities.clone(), + } }) .collect(); From 5ad511b8cd4318ebd33513e9dd4cb282a36d1819 Mon Sep 17 00:00:00 2001 From: wyenox <227889946+wyenox@users.noreply.github.com> Date: Mon, 9 Feb 2026 20:00:12 -0300 Subject: [PATCH 2/2] move openai util cfg out --- src/utils.rs | 1 + src/utils/openai.rs | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index 973fa70..b3937f7 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -3,6 +3,7 @@ pub mod asynchronous; #[cfg(feature = "http")] pub mod http; +#[cfg(feature = "api-clients")] pub(crate) mod openai; pub(crate) mod platform; pub(crate) mod serde; diff --git a/src/utils/openai.rs b/src/utils/openai.rs index 6550853..7d86f8d 100644 --- a/src/utils/openai.rs +++ b/src/utils/openai.rs @@ -19,7 +19,6 @@ pub(crate) struct Models { pub data: Vec, } -#[cfg(feature = "api-clients")] pub(crate) async fn get_models( client: &reqwest::Client, url: &str, @@ -70,7 +69,6 @@ pub(crate) async fn get_models( Ok(models.data) } -#[cfg(feature = "api-clients")] pub(crate) async fn get_bots( client: &reqwest::Client, url: &str,