Skip to main content

vtcode_config/models/model_id/
display.rs

1use std::borrow::Cow;
2
3use super::ModelId;
4
5impl ModelId {
6    /// Get the display name for the model (human-readable).
7    ///
8    /// Returns `Cow<'static, str>` because custom user-defined models
9    /// carry runtime strings that may not be `'static`.
10    pub fn display_name(&self) -> Cow<'static, str> {
11        if let Some(meta) = self.openrouter_metadata() {
12            return Cow::Borrowed(meta.display);
13        }
14        if let Some(display) = self.table_display() {
15            return Cow::Borrowed(display);
16        }
17        match self {
18            // OpenRouter models without generated metadata
19            ModelId::OpenRouterMoonshotaiKimiK3 => Cow::Borrowed("Kimi K3 (OpenRouter)"),
20            // Custom user-defined models
21            ModelId::Custom(_, model) => Cow::Owned(model.clone()),
22            // OpenRouter models
23            model => Cow::Borrowed(
24                model
25                    .openrouter_metadata()
26                    .expect("generated OpenRouter model should have metadata")
27                    .display,
28            ),
29        }
30    }
31}