Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Disable image generation for Free-plan accounts (#34850)

Won Park0a0a9b6c8f21
diff --git a/codex-rs/core/src/tools/spec_plan.rs b/codex-rs/core/src/tools/spec_plan.rs
index e7bbeaaace..0705ee5631 100644
--- a/codex-rs/core/src/tools/spec_plan.rs
+++ b/codex-rs/core/src/tools/spec_plan.rs
@@ -60,6 +60,7 @@ use crate::tools::router::ToolRouter;
use crate::tools::router::ToolRouterParams;
use codex_features::Feature;
use codex_login::AuthManager;
+use codex_protocol::account::PlanType;
use codex_protocol::config_types::WebSearchMode;
use codex_protocol::dynamic_tools::DynamicToolNamespaceTool;
use codex_protocol::dynamic_tools::DynamicToolSpec;
@@ -366,6 +367,16 @@ fn image_generation_available(turn_context: &TurnContext) -> bool {
return false;
}
+ if turn_context
+ .auth_manager
+ .as_deref()
+ .and_then(AuthManager::auth_cached)
+ .and_then(|auth| auth.account_plan_type())
+ == Some(PlanType::Free)
+ {
+ return false;
+ }
+
let capabilities = turn_context.provider.capabilities();
if !capabilities.image_generation || !capabilities.namespace_tools {
return false;