From 9ad6c7c02a7802948b6d6b0eb40d95e70697de75 Mon Sep 17 00:00:00 2001 From: EmreCelenli <88101154+EmreCelenli@users.noreply.github.com> Date: Thu, 14 May 2026 13:33:23 +0200 Subject: [PATCH] fix: recognize OPENAI_API_KEY as valid auth for OpenAI-compatible endpoints Previously, claw doctor would warn 'no supported auth env vars were found' even when OPENAI_API_KEY was set, because only ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN were checked. This caused auth failures when using local models via Ollama or other OpenAI-compatible endpoints. Tested on Apple M1 MacBook Pro 16GB with Ollama + qwen3:8b. --- rust/crates/rusty-claude-cli/src/main.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs index 853b97a904..dafde1ac84 100644 --- a/rust/crates/rusty-claude-cli/src/main.rs +++ b/rust/crates/rusty-claude-cli/src/main.rs @@ -2111,25 +2111,26 @@ fn check_auth_health() -> DiagnosticCheck { let auth_token_present = env::var("ANTHROPIC_AUTH_TOKEN") .ok() .is_some_and(|value| !value.trim().is_empty()); + let openai_key_present = env::var("OPENAI_API_KEY") + .ok() + .is_some_and(|value| !value.trim().is_empty()); + let any_auth_present = api_key_present || auth_token_present || openai_key_present; let env_details = format!( - "Environment api_key={} auth_token={}", + "Environment api_key={} auth_token={} openai_key={}", if api_key_present { "present" } else { "absent" }, - if auth_token_present { - "present" - } else { - "absent" - } + if auth_token_present { "present" } else { "absent" }, + if openai_key_present { "present" } else { "absent" } ); match load_oauth_credentials() { Ok(Some(token_set)) => DiagnosticCheck::new( "Auth", - if api_key_present || auth_token_present { + if any_auth_present { DiagnosticLevel::Ok } else { DiagnosticLevel::Warn }, - if api_key_present || auth_token_present { + if any_auth_present { "supported auth env vars are configured; legacy saved OAuth is ignored" } else { "legacy saved OAuth credentials are present but unsupported" @@ -2172,12 +2173,12 @@ fn check_auth_health() -> DiagnosticCheck { ])), Ok(None) => DiagnosticCheck::new( "Auth", - if api_key_present || auth_token_present { + if any_auth_present { DiagnosticLevel::Ok } else { DiagnosticLevel::Warn }, - if api_key_present || auth_token_present { + if any_auth_present { "supported auth env vars are configured" } else { "no supported auth env vars were found"