diff --git a/codex-rs/core/src/client.rs b/codex-rs/core/src/client.rs index cc40ef42..a947e342 100644 --- a/codex-rs/core/src/client.rs +++ b/codex-rs/core/src/client.rs @@ -223,18 +223,14 @@ impl ModelClient { let input_with_instructions = prompt.get_formatted_input(); - let verbosity = match &self.config.model_family.family { - family if family == "gpt-5" => self.config.model_verbosity, - _ => { - if self.config.model_verbosity.is_some() { - warn!( - "model_verbosity is set but ignored for non-gpt-5 model family: {}", - self.config.model_family.family - ); - } - - None - } + let verbosity = if self.config.model_family.support_verbosity { + self.config.model_verbosity + } else { + warn!( + "model_verbosity is set but ignored as the model does not support verbosity: {}", + self.config.model_family.family + ); + None }; // Only include `text.verbosity` for GPT-5 family models diff --git a/codex-rs/core/src/model_family.rs b/codex-rs/core/src/model_family.rs index e6e5fbfd..76ed81b0 100644 --- a/codex-rs/core/src/model_family.rs +++ b/codex-rs/core/src/model_family.rs @@ -54,6 +54,9 @@ pub struct ModelFamily { /// This is applied when computing the effective context window seen by /// consumers. pub effective_context_window_percent: i64, + + /// If the model family supports setting the verbosity level when using Responses API. + pub support_verbosity: bool, } macro_rules! model_family { @@ -73,6 +76,7 @@ macro_rules! model_family { base_instructions: BASE_INSTRUCTIONS.to_string(), experimental_supported_tools: Vec::new(), effective_context_window_percent: 95, + support_verbosity: false, }; // apply overrides $( @@ -128,6 +132,7 @@ pub fn find_family_for_model(slug: &str) -> Option { "test_sync_tool".to_string(), ], supports_parallel_tool_calls: true, + support_verbosity: true, ) // Internal models. @@ -144,6 +149,7 @@ pub fn find_family_for_model(slug: &str) -> Option { "read_file".to_string(), ], supports_parallel_tool_calls: true, + support_verbosity: true, ) // Production models. @@ -154,12 +160,14 @@ pub fn find_family_for_model(slug: &str) -> Option { reasoning_summary_format: ReasoningSummaryFormat::Experimental, base_instructions: GPT_5_CODEX_INSTRUCTIONS.to_string(), apply_patch_tool_type: Some(ApplyPatchToolType::Freeform), + support_verbosity: true, ) } else if slug.starts_with("gpt-5") { model_family!( slug, "gpt-5", supports_reasoning_summaries: true, needs_special_apply_patch_instructions: true, + support_verbosity: true, ) } else { None @@ -179,5 +187,6 @@ pub fn derive_default_model_family(model: &str) -> ModelFamily { base_instructions: BASE_INSTRUCTIONS.to_string(), experimental_supported_tools: Vec::new(), effective_context_window_percent: 95, + support_verbosity: false, } }