Skip to main content

vtcode_config/models/model_id/
capabilities.rs

1use crate::models::{Provider, ProviderModelSupport};
2
3use super::ModelId;
4
5mod capability_generated {
6    include!(concat!(env!("OUT_DIR"), "/model_capabilities.rs"));
7}
8
9/// Catalog metadata generated from `docs/models.json`.
10#[derive(Clone, Copy, Debug, PartialEq)]
11pub struct ModelPricing {
12    pub input: Option<f64>,
13    pub output: Option<f64>,
14    pub cache_read: Option<f64>,
15    pub cache_write: Option<f64>,
16}
17
18#[derive(Clone, Copy, Debug, PartialEq)]
19pub struct ModelCatalogEntry {
20    pub(crate) provider: &'static str,
21    id: &'static str,
22    pub display_name: &'static str,
23    pub description: &'static str,
24    pub context_window: usize,
25    max_output_tokens: Option<usize>,
26    pub reasoning: bool,
27    pub reasoning_efforts: &'static [&'static str],
28    pub is_pro: bool,
29    pub lightweight_model: Option<&'static str>,
30    pub tool_call: bool,
31    pub vision: bool,
32    pub input_modalities: &'static [&'static str],
33    pub caching: bool,
34    pub structured_output: bool,
35    pub supports_sampling: bool,
36    pub supports_logprobs: bool,
37    pub prompt_cache_ttl: Option<&'static str>,
38    pub prompt_contract: Option<&'static str>,
39    pub pricing: ModelPricing,
40}
41
42fn catalog_provider_key(provider: &str) -> &str {
43    if provider.eq_ignore_ascii_case("google") || provider.eq_ignore_ascii_case("gemini") {
44        "gemini"
45    } else if provider.eq_ignore_ascii_case("openai") {
46        "openai"
47    } else if provider.eq_ignore_ascii_case("anthropic") {
48        "anthropic"
49    } else if provider.eq_ignore_ascii_case("deepseek") {
50        "deepseek"
51    } else if provider.eq_ignore_ascii_case("meta") || provider.eq_ignore_ascii_case("meta-ai") {
52        "meta"
53    } else if provider.eq_ignore_ascii_case("openrouter") {
54        "openrouter"
55    } else if provider.eq_ignore_ascii_case("ollama") {
56        "ollama"
57    } else if provider.eq_ignore_ascii_case("lmstudio") {
58        "lmstudio"
59    } else if provider.eq_ignore_ascii_case("llamacpp") || provider.eq_ignore_ascii_case("llama.cpp") {
60        "llamacpp"
61    } else if provider.eq_ignore_ascii_case("moonshot") {
62        "moonshot"
63    } else if provider.eq_ignore_ascii_case("zai") {
64        "zai"
65    } else if provider.eq_ignore_ascii_case("minimax") {
66        "minimax"
67    } else if provider.eq_ignore_ascii_case("huggingface") {
68        "huggingface"
69    } else if provider.eq_ignore_ascii_case("stepfun") {
70        "stepfun"
71    } else if provider.eq_ignore_ascii_case("evolink") {
72        "evolink"
73    } else if provider.eq_ignore_ascii_case("poolside") {
74        "poolside"
75    } else if provider.eq_ignore_ascii_case("xai") {
76        "xai"
77    } else if provider.eq_ignore_ascii_case("nvidia") {
78        "nvidia"
79    } else if provider.eq_ignore_ascii_case("merge-gateway") {
80        "merge-gateway"
81    } else if provider.eq_ignore_ascii_case("vercel") || provider.eq_ignore_ascii_case("vercel-ai-gateway") {
82        "vercel"
83    } else {
84        provider
85    }
86}
87
88fn capability_provider_key(provider: Provider) -> &'static str {
89    match provider {
90        Provider::Gemini => "gemini",
91        Provider::OpenAI => "openai",
92        Provider::Anthropic => "anthropic",
93        Provider::Copilot => "copilot",
94        Provider::DeepSeek => "deepseek",
95        Provider::Meta => "meta",
96        Provider::OpenRouter => "openrouter",
97        Provider::Ollama => "ollama",
98        Provider::OllamaCloud => "ollama-cloud",
99        Provider::LmStudio => "lmstudio",
100        Provider::LlamaCpp => "llamacpp",
101        Provider::Moonshot => "moonshot",
102        Provider::ZAI => "zai",
103        Provider::Minimax => "minimax",
104        Provider::MiMo => "mimo",
105        Provider::Mistral => "mistral",
106        Provider::HuggingFace => "huggingface",
107        Provider::OpenCodeZen => "opencode-zen",
108        Provider::OpenCodeGo => "opencode-go",
109        Provider::Qwen => "qwen",
110        Provider::StepFun => "stepfun",
111        Provider::Evolink => "evolink",
112        Provider::Poolside => "poolside",
113        Provider::XAI => "xai",
114        Provider::NVIDIA => "nvidia",
115        Provider::MergeGateway => "merge-gateway",
116        Provider::Vercel => "vercel",
117    }
118}
119
120fn catalog_lookup_id<'a>(provider: &str, id: &'a str) -> &'a str {
121    let provider_key = catalog_provider_key(provider);
122    if provider_key == "evolink"
123        && let Some((prefix, model_id)) = id.split_once('/')
124        && prefix.eq_ignore_ascii_case(provider_key)
125    {
126        // Evolink namespaces its ModelId values to avoid collisions with
127        // first-class providers, while its catalog stores the upstream model
128        // id that the gateway receives (for example, `deepseek-v4-pro`).
129        return model_id;
130    }
131    id
132}
133
134fn generated_catalog_entry(provider: &str, id: &str) -> Option<ModelCatalogEntry> {
135    let provider_key = catalog_provider_key(provider);
136    let lookup_id = catalog_lookup_id(provider_key, id);
137    // Exact match wins so gateway providers that store prefixed IDs
138    // (`merge-gateway`/`vercel` keep `openai/gpt-5.6-luna`) keep working.
139    // Fall back to stripping a provider-prefixed request model
140    // (`openai/gpt-5.6-luna` on provider `openai` stores `gpt-5.6-luna`).
141    // The strip is provider-scoped (prefix must equal the provider key) so an
142    // unrelated prefix (`other-org/gpt-5.6-luna`) does not resolve to the bare
143    // model's capabilities. Without this, reasoning-effort and context
144    // lookups miss and the harness omits the effort with an empty
145    // `supported:` diagnostic.
146    let entry = capability_generated::metadata_for(provider_key, lookup_id).or_else(|| {
147        lookup_id
148            .split_once('/')
149            .filter(|(prefix, _)| prefix.eq_ignore_ascii_case(provider_key))
150            .and_then(|(_, rest)| capability_generated::metadata_for(provider_key, rest))
151    });
152    entry.map(|entry| ModelCatalogEntry {
153        provider: entry.provider,
154        id: entry.id,
155        display_name: entry.display_name,
156        description: entry.description,
157        context_window: entry.context_window,
158        max_output_tokens: entry.max_output_tokens,
159        reasoning: entry.reasoning,
160        reasoning_efforts: entry.reasoning_efforts,
161        is_pro: entry.is_pro,
162        lightweight_model: entry.lightweight_model,
163        tool_call: entry.tool_call,
164        vision: entry.vision,
165        input_modalities: entry.input_modalities,
166        caching: entry.caching,
167        structured_output: entry.structured_output,
168        supports_sampling: entry.supports_sampling,
169        supports_logprobs: entry.supports_logprobs,
170        prompt_cache_ttl: entry.prompt_cache_ttl,
171        prompt_contract: entry.prompt_contract,
172        pricing: ModelPricing {
173            input: entry.pricing.input,
174            output: entry.pricing.output,
175            cache_read: entry.pricing.cache_read,
176            cache_write: entry.pricing.cache_write,
177        },
178    })
179}
180
181pub fn model_catalog_entry(provider: &str, id: &str) -> Option<ModelCatalogEntry> {
182    generated_catalog_entry(provider, id)
183}
184
185pub fn supported_models_for_provider(provider: &str) -> Option<&'static [&'static str]> {
186    capability_generated::models_for_provider(catalog_provider_key(provider))
187}
188
189pub fn catalog_provider_keys() -> &'static [&'static str] {
190    capability_generated::PROVIDERS
191}
192
193impl ModelId {
194    fn generated_capabilities(&self) -> Option<ModelCatalogEntry> {
195        generated_catalog_entry(capability_provider_key(self.provider()), &self.as_str())
196    }
197
198    /// Preferred built-in lightweight sibling or lower-tier fallback for this model.
199    pub fn preferred_lightweight_variant(&self) -> Option<Self> {
200        let target_id = self.generated_capabilities()?.lightweight_model?;
201        Self::all_models().into_iter().find(|candidate| {
202            candidate != self && candidate.provider() == self.provider() && candidate.as_str() == target_id
203        })
204    }
205
206    /// Attempt to find a non-reasoning variant for this model.
207    pub fn non_reasoning_variant(&self) -> Option<Self> {
208        if let Some(meta) = self.openrouter_metadata() {
209            if !meta.reasoning {
210                return None;
211            }
212
213            let vendor = meta.vendor;
214            let mut candidates: Vec<Self> = Self::openrouter_vendor_groups()
215                .into_iter()
216                .find(|(candidate_vendor, _)| *candidate_vendor == vendor)
217                .map(|(_, models)| {
218                    models
219                        .iter()
220                        .filter(|&candidate| candidate != self)
221                        .filter(|&candidate| {
222                            candidate.openrouter_metadata().map(|other| !other.reasoning).unwrap_or(false)
223                        })
224                        .cloned()
225                        .collect()
226                })
227                .unwrap_or_default();
228
229            if candidates.is_empty() {
230                return None;
231            }
232
233            candidates.sort_by_key(|candidate| {
234                candidate
235                    .openrouter_metadata()
236                    .map(|data| (!data.efficient, data.display))
237                    .unwrap_or((true, ""))
238            });
239
240            return candidates.into_iter().next();
241        }
242
243        self.preferred_lightweight_variant()
244            .filter(|candidate| !candidate.is_reasoning_variant())
245    }
246
247    /// Check if this is a "flash" variant (optimized for speed)
248    pub fn is_flash_variant(&self) -> bool {
249        matches!(
250            self,
251            ModelId::Gemini38Flash
252                | ModelId::MergeGatewayGoogleGemini38Flash
253                | ModelId::VercelGoogleGemini38Flash
254                | ModelId::VercelDeepseekFlash
255                | ModelId::VercelOpenAiGpt56Luna
256                | ModelId::VercelAnthropicClaudeHaiku45
257                | ModelId::ClaudeHaiku55
258                | ModelId::MergeGatewayAnthropicClaudeHaiku4520251001
259                | ModelId::MergeGatewayAnthropicClaudeHaiku55
260                | ModelId::StepFun37Flash
261                | ModelId::MergeGatewayDeepseekFlash
262                | ModelId::DeepSeekFlash
263                | ModelId::OllamaDeepSeekV41FlashCloud
264                | ModelId::ZaiGlm53Flash
265                | ModelId::ZaiGlm53Flashx
266                | ModelId::OllamaGlm53FlashCloud
267                | ModelId::MergeGatewayZaiGlm53Flash
268                | ModelId::MergeGatewayZaiGlm53Flashx
269                | ModelId::HuggingFaceGlm53FlashTogether
270                | ModelId::MiMoV26Flash
271                | ModelId::MergeGatewayXiaomimimoMimoV26Flash
272                | ModelId::MinimaxM31Flash
273                | ModelId::MergeGatewayMinimaxM31Flash
274                | ModelId::OpenRouterMinimaxM31FlashFree
275        )
276    }
277
278    /// Check if this is a "pro" variant (optimized for capability)
279    pub fn is_pro_variant(&self) -> bool {
280        self.generated_capabilities().is_some_and(|entry| entry.is_pro)
281    }
282
283    /// Check if this is an optimized/efficient variant
284    pub fn is_efficient_variant(&self) -> bool {
285        if let Some(meta) = self.openrouter_metadata() {
286            return meta.efficient;
287        }
288        matches!(
289            self,
290            ModelId::Gemini38Flash
291                | ModelId::MergeGatewayGoogleGemini38Flash
292                | ModelId::GPT56Luna
293                | ModelId::GPT6Luna
294                | ModelId::MergeGatewayOpenAIGpt56Luna
295                | ModelId::MergeGatewayOpenAIGpt6Luna
296                | ModelId::CopilotGPT54Mini
297                | ModelId::ClaudeHaiku55
298                | ModelId::MergeGatewayAnthropicClaudeHaiku55
299                | ModelId::DeepSeekFlash
300                | ModelId::OllamaDeepSeekV41FlashCloud
301                | ModelId::MergeGatewayDeepseekFlash
302                | ModelId::MetaMuseSpark11
303                | ModelId::MergeGatewayMinimaxH3
304                | ModelId::MiMoV26Flash
305                | ModelId::ZaiGlm53Flash
306                | ModelId::ZaiGlm53Flashx
307                | ModelId::OllamaGlm53FlashCloud
308                | ModelId::MergeGatewayZaiGlm53Flash
309                | ModelId::MergeGatewayZaiGlm53Flashx
310                | ModelId::HuggingFaceGlm53FlashTogether
311                | ModelId::VercelDeepseekFlash
312                | ModelId::MergeGatewayXiaomimimoMimoV26Flash
313                | ModelId::MinimaxM31Flash
314                | ModelId::MergeGatewayMinimaxM31Flash
315                | ModelId::OpenRouterMinimaxM31FlashFree
316        )
317    }
318
319    /// Check if this is a top-tier model
320    pub fn is_top_tier(&self) -> bool {
321        if let Some(meta) = self.openrouter_metadata() {
322            return meta.top_tier;
323        }
324        matches!(
325            self,
326            ModelId::Gemini38Flash
327                | ModelId::MergeGatewayGoogleGemini38Flash
328                | ModelId::Gemini4Argon
329                | ModelId::MergeGatewayGoogleGemini4Argon
330                | ModelId::GPT6Astra
331                | ModelId::GPT6Sol
332                | ModelId::GPT61Sol
333                | ModelId::GPT56Sol
334                | ModelId::MergeGatewayOpenAIGpt56Sol
335                | ModelId::MergeGatewayOpenAIGpt56Terra
336                | ModelId::MergeGatewayOpenAIGpt56Luna
337                | ModelId::MergeGatewayOpenAIGpt6Astra
338                | ModelId::MergeGatewayOpenAIGpt6Sol
339                | ModelId::MergeGatewayOpenAIGpt61Sol
340                | ModelId::MergeGatewayOpenAIGpt6Luna
341                | ModelId::ClaudeSonnet5
342                | ModelId::ClaudeSonnet55
343                | ModelId::ClaudeFable5
344                | ModelId::ClaudeFable51
345                | ModelId::ClaudeOpus5
346                | ModelId::ClaudeOpus55
347                | ModelId::MistralLarge4
348                | ModelId::OpenCodeGoGlm53
349                | ModelId::MiMoV26Pro
350                | ModelId::MiMoV26ProUltraspeed
351                | ModelId::OpenCodeGoMinimaxM3
352                | ModelId::MergeGatewayDeepseekFlash
353                | ModelId::VercelDeepseekFlash
354                | ModelId::MetaMuseSpark13
355                | ModelId::MetaMuseSpark13Contributor
356                | ModelId::MetaMuseWonder10
357                | ModelId::MetaMuseWonderFull10
358                | ModelId::ZaiGlm53
359                | ModelId::ZaiGlm53Flash
360                | ModelId::ZaiGlm53Flashx
361                | ModelId::MergeGatewayZaiGlm53Flash
362                | ModelId::MergeGatewayZaiGlm53Flashx
363                | ModelId::HuggingFaceGlm53FlashTogether
364                | ModelId::HuggingFaceGlm53Together
365                | ModelId::HuggingFaceMinimaxM3Novita
366                | ModelId::StepFun5Preview
367                | ModelId::OpenRouterMoonshotaiKimiK3
368                | ModelId::MoonshotKimiK3
369                | ModelId::MergeGatewayMoonshotKimiK3
370                | ModelId::OllamaGlm53Cloud
371                | ModelId::OllamaGlm53FlashCloud
372                | ModelId::OllamaDeepSeekV41FlashCloud
373                | ModelId::OllamaMistralLarge4Cloud
374                | ModelId::OllamaMuseSparkOpenCloud
375                | ModelId::XaiGrok46
376                | ModelId::XaiGrok47
377                | ModelId::MergeGatewayXaiGrok46
378                | ModelId::MergeGatewayXaiGrok47
379                | ModelId::VercelSpacexaiGrok47
380                | ModelId::MergeGatewayXiaomimimoMimoV26Pro
381                | ModelId::MergeGatewayXiaomimimoMimoV26Flash
382                | ModelId::MergeGatewayMistralLarge4
383                | ModelId::MergeGatewayMetaMuseSparkOpen
384                | ModelId::HuggingFaceMuseSparkOpenBaseten
385        )
386    }
387
388    /// Determine whether the model is a reasoning-capable variant
389    pub fn is_reasoning_variant(&self) -> bool {
390        if let Some(meta) = self.openrouter_metadata() {
391            return meta.reasoning;
392        }
393        self.provider().supports_reasoning(&self.as_str())
394    }
395
396    /// Determine whether the model supports tool calls/function execution
397    pub fn supports_tool_calls(&self) -> bool {
398        if let Some(meta) = self.generated_capabilities() {
399            return meta.tool_call;
400        }
401        if let Some(meta) = self.openrouter_metadata() {
402            return meta.tool_call;
403        }
404        true
405    }
406
407    /// Ordered list of supported input modalities when VT Code has metadata for this model.
408    pub fn input_modalities(&self) -> &'static [&'static str] {
409        self.generated_capabilities().map(|meta| meta.input_modalities).unwrap_or(&[])
410    }
411
412    /// Get the generation/version string for this model
413    pub fn generation(&self) -> &'static str {
414        if let Some(meta) = self.openrouter_metadata() {
415            return meta.generation;
416        }
417        match self {
418            // Gemini generations
419            // OpenAI generations
420            ModelId::GPT6Astra | ModelId::GPT6Sol | ModelId::GPT6Luna => "6",
421            ModelId::GPT61Sol => "6.1",
422            ModelId::GPT56Sol | ModelId::GPT56Terra | ModelId::GPT56Luna => "5.6",
423            ModelId::OpenAIGptOss20b | ModelId::OpenAIGptOss120b => "5",
424            // Anthropic generations
425            ModelId::ClaudeSonnet5 => "5",
426            ModelId::ClaudeSonnet55 => "5.5",
427            ModelId::ClaudeHaiku55 => "5.5",
428            ModelId::ClaudeFable5 => "5",
429            ModelId::ClaudeFable51 => "5.1",
430            ModelId::ClaudeOpus5 => "5",
431            ModelId::ClaudeOpus55 => "5.5",
432            // DeepSeek generations
433            ModelId::DeepSeekFlash => "4",
434            ModelId::OllamaDeepSeekV41FlashCloud => "4.1",
435            // Mistral generations
436            ModelId::MistralLarge3 => "3",
437            ModelId::MistralLarge4 => "4",
438            ModelId::OllamaMistralLarge4Cloud => "4",
439            ModelId::MergeGatewayDeepseekFlash => "4.1",
440            ModelId::MetaMuseSpark11 => "Muse-Spark-1.1",
441            ModelId::MetaMuseSpark13 | ModelId::MetaMuseSpark13Contributor => "Muse-Spark-1.3",
442            ModelId::MergeGatewayMetaMuseSparkOpen | ModelId::HuggingFaceMuseSparkOpenBaseten => "Muse-Spark-Open",
443            ModelId::OllamaMuseSparkOpenCloud => "Muse-Spark-Open",
444            ModelId::MetaMuseWonder10 => "Muse-Wonder-1.0",
445            ModelId::MetaMuseWonderFull10 => "Muse-Wonder-Full-1.0",
446            // Z.AI generations
447            ModelId::ZaiGlm53
448            | ModelId::ZaiGlm53Flash
449            | ModelId::ZaiGlm53Flashx
450            | ModelId::MergeGatewayZaiGlm53Flash
451            | ModelId::MergeGatewayZaiGlm53Flashx => "5.3",
452            ModelId::OllamaGlm53FlashCloud => "5.3",
453            ModelId::Gemini38Flash => "3.8",
454            ModelId::MergeGatewayGoogleGemini38Flash => "3.8",
455            ModelId::Gemini4Argon => "4",
456            ModelId::MergeGatewayGoogleGemini4Argon => "4",
457            ModelId::OpenCodeGoGlm53 => "5.3",
458            ModelId::OpenCodeGoGpt56Luna => "5.6-luna",
459            ModelId::OpenCodeGoKimiK3 => "k3",
460            ModelId::MiMoV26Pro | ModelId::MiMoV26Flash | ModelId::MiMoV26ProUltraspeed => "v2.6",
461            ModelId::MergeGatewayXiaomimimoMimoV26Pro | ModelId::MergeGatewayXiaomimimoMimoV26Flash => "v2.6",
462            ModelId::MergeGatewayMistralLarge4 => "4",
463            ModelId::OpenCodeGoMinimaxM3 => "m3",
464            ModelId::OllamaGptOss20b => "oss",
465            ModelId::OllamaGptOss20bCloud => "oss-cloud",
466            ModelId::OllamaGptOss120bCloud => "oss-cloud",
467            ModelId::OllamaMinimaxM3Cloud => "minimax-m3",
468            ModelId::OllamaGlm53Cloud => "glm-5.3",
469            ModelId::OllamaGemma4 => "gemma-4",
470            ModelId::LlamaCppGemma426bA4b => "4",
471            ModelId::LlamaCppGemma4E4b => "4",
472            ModelId::LlamaCppGptOss20b => "oss",
473            // MiniMax models
474            ModelId::MinimaxM3 => "M3",
475            ModelId::MinimaxM31Flash | ModelId::MergeGatewayMinimaxM31Flash => "M3.1",
476            // StepFun models
477            ModelId::StepFun37Flash => "3.7",
478            ModelId::StepFun5Preview => "5",
479            // Moonshot models
480            ModelId::MoonshotKimiK3 => "k3",
481            ModelId::MergeGatewayMoonshotKimiK3 => "k3",
482            // Hugging Face generations
483            ModelId::HuggingFaceOpenAIGptOss20b => "oss",
484            ModelId::HuggingFaceOpenAIGptOss120b => "oss",
485            ModelId::HuggingFaceMinimaxM3Novita => "m3",
486            ModelId::HuggingFaceGlm53FlashTogether => "5.3",
487            ModelId::HuggingFaceGlm53Together => "5.3",
488            // xAI models
489            ModelId::XaiGrok46 => "4.6",
490            ModelId::XaiGrok47 => "4.7",
491            ModelId::MergeGatewayXaiGrok46 => "4.6",
492            ModelId::MergeGatewayXaiGrok47 => "4.7",
493            // Qwen models
494            ModelId::MergeGatewayDefaultRouting => "routing",
495            ModelId::MergeGatewayAnthropicClaudeOpus5 => "5",
496            ModelId::MergeGatewayAnthropicClaudeOpus55 => "5.5",
497            ModelId::MergeGatewayAnthropicClaudeSonnet5 => "5",
498            ModelId::MergeGatewayAnthropicClaudeSonnet55 => "5.5",
499            ModelId::MergeGatewayAnthropicClaudeHaiku55 => "5.5",
500            ModelId::MergeGatewayAnthropicClaudeFable51 => "5.1",
501            ModelId::MergeGatewayAnthropicClaudeHaiku4520251001 => "4.5",
502            ModelId::MergeGatewayMinimaxH3 => "H3",
503            ModelId::MergeGatewayThinkingMachinesInkling => "Inkling",
504            ModelId::MergeGatewayOpenAIGpt56Luna
505            | ModelId::MergeGatewayOpenAIGpt56Sol
506            | ModelId::MergeGatewayOpenAIGpt56Terra => "5.6",
507            ModelId::MergeGatewayOpenAIGpt6Astra
508            | ModelId::MergeGatewayOpenAIGpt6Sol
509            | ModelId::MergeGatewayOpenAIGpt6Luna => "6",
510            ModelId::MergeGatewayOpenAIGpt61Sol => "6.1",
511            // Vercel AI Gateway models
512            ModelId::VercelAnthropicClaudeSonnet5 => "5",
513            ModelId::VercelAnthropicClaudeOpus5 => "5",
514            ModelId::VercelAnthropicClaudeOpus55 => "5.5",
515            ModelId::VercelAnthropicClaudeHaiku45 => "4.5",
516            ModelId::VercelOpenAiGpt56Sol | ModelId::VercelOpenAiGpt56Luna => "5.6",
517            ModelId::VercelOpenAiGpt6Sol | ModelId::VercelOpenAiGpt6Luna => "6",
518            ModelId::VercelOpenAiGpt6Astra => "6",
519            ModelId::VercelGoogleGemini38Flash => "3.8",
520            ModelId::VercelDeepseekFlash => "4.1",
521            ModelId::VercelMoonshotaiKimiK3 => "k3",
522            ModelId::VercelMinimaxM3 => "M3",
523            ModelId::VercelSpacexaiGrok47 => "4.7",
524            _ => "unknown",
525        }
526    }
527
528    /// Determine if this model supports GPT-5.1+/5.2+/5.3+ shell tool type
529    pub(crate) fn supports_shell_tool(&self) -> bool {
530        matches!(
531            self,
532            ModelId::GPT6Astra
533                | ModelId::GPT6Sol
534                | ModelId::GPT61Sol
535                | ModelId::GPT6Luna
536                | ModelId::GPT56Sol
537                | ModelId::GPT56Terra
538                | ModelId::GPT56Luna
539        )
540    }
541
542    /// Determine if this model supports optimized apply_patch tool
543    pub fn supports_apply_patch_tool(&self) -> bool {
544        false
545    }
546}
547
548#[cfg(test)]
549mod tests {
550    use super::*;
551
552    #[test]
553    fn prefixed_request_model_resolves_on_bare_provider() {
554        // Regression for `openai/gpt-5.6-luna` on provider `openai` resolving
555        // to empty `supported:` and omitting reasoning effort: exact bare hit
556        // and prefixed fallback must agree, while gateway prefixed entries
557        // keep their exact match.
558        let bare = model_catalog_entry("openai", "gpt-5.6-luna").expect("bare openai entry exists");
559        let prefixed = model_catalog_entry("openai", "openai/gpt-5.6-luna").expect("prefixed fallback must resolve");
560        assert_eq!(bare.reasoning_efforts, prefixed.reasoning_efforts);
561        assert!(!prefixed.reasoning_efforts.is_empty());
562
563        let gateway =
564            model_catalog_entry("merge-gateway", "openai/gpt-5.6-luna").expect("gateway prefixed entry exists");
565        assert!(!gateway.reasoning_efforts.is_empty());
566
567        // Asymmetric boundary: unknown model stays missing on both shapes,
568        // and an unrelated prefix must not resolve to the bare model.
569        assert!(model_catalog_entry("openai", "no-such-model-xyz").is_none());
570        assert!(model_catalog_entry("openai", "openai/no-such-model-xyz").is_none());
571        assert!(model_catalog_entry("openai", "other-org/gpt-5.6-luna").is_none());
572    }
573}