From 713eb0dbf0daa529938230479545b1d028e3d2dc Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Wed, 6 Aug 2025 16:19:18 -0700 Subject: [PATCH] chore: introduce ModelFamily.requires_chatgpt_auth --- codex-rs/core/src/client.rs | 9 +++++---- codex-rs/core/src/config.rs | 1 + codex-rs/core/src/model_family.rs | 5 +++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/codex-rs/core/src/client.rs b/codex-rs/core/src/client.rs index 0fa143fdb7..bdb14f46ff 100644 --- a/codex-rs/core/src/client.rs +++ b/codex-rs/core/src/client.rs @@ -127,12 +127,13 @@ impl ModelClient { let auth_mode = auth.as_ref().map(|a| a.mode); - if self.config.model_family.family == "2025-08-06-model" - && auth_mode != Some(AuthMode::ChatGPT) - { + if self.config.model_family.requires_chatgpt_auth && auth_mode != Some(AuthMode::ChatGPT) { return Err(CodexErr::UnexpectedStatus( StatusCode::BAD_REQUEST, - "2025-08-06-model is only supported with ChatGPT auth, run `codex login status` to check your auth status and `codex login` to login with ChatGPT".to_string(), + format!( + "{slug} is only supported with ChatGPT auth, run `codex login status` to check your auth status and `codex login` to login with ChatGPT", + slug = self.config.model_family.slug + ), )); } diff --git a/codex-rs/core/src/config.rs b/codex-rs/core/src/config.rs index 63a2e5949f..0d9fe03998 100644 --- a/codex-rs/core/src/config.rs +++ b/codex-rs/core/src/config.rs @@ -486,6 +486,7 @@ impl Config { needs_special_apply_patch_instructions: false, supports_reasoning_summaries, uses_local_shell_tool: false, + requires_chatgpt_auth: false, } }); diff --git a/codex-rs/core/src/model_family.rs b/codex-rs/core/src/model_family.rs index cadbceca1e..d61f0cc089 100644 --- a/codex-rs/core/src/model_family.rs +++ b/codex-rs/core/src/model_family.rs @@ -23,6 +23,8 @@ pub struct ModelFamily { // the model such that its description can be omitted. // See https://platform.openai.com/docs/guides/tools-local-shell pub uses_local_shell_tool: bool, + + pub requires_chatgpt_auth: bool, } macro_rules! model_family { @@ -36,6 +38,7 @@ macro_rules! model_family { needs_special_apply_patch_instructions: false, supports_reasoning_summaries: false, uses_local_shell_tool: false, + requires_chatgpt_auth: false, }; // apply overrides $( @@ -55,6 +58,7 @@ macro_rules! simple_model_family { needs_special_apply_patch_instructions: false, supports_reasoning_summaries: false, uses_local_shell_tool: false, + requires_chatgpt_auth: false, }) }}; } @@ -93,6 +97,7 @@ pub fn find_family_for_model(slug: &str) -> Option { model_family!( slug, "2025-08-06-model", supports_reasoning_summaries: true, + requires_chatgpt_auth: true, ) } else { None