diff --git a/agent/anthropic_adapter.py b/agent/anthropic_adapter.py index 05449e2a7..7a37fc414 100644 --- a/agent/anthropic_adapter.py +++ b/agent/anthropic_adapter.py @@ -277,8 +277,9 @@ def _is_oauth_token(key: str) -> bool: Positively identifies Anthropic OAuth tokens by their key format: - ``sk-ant-`` prefix (but NOT ``sk-ant-api``) → setup tokens, managed keys - ``eyJ`` prefix → JWTs from the Anthropic OAuth flow + - ``cc-`` prefix → Claude Code OAuth access tokens (from CLAUDE_CODE_OAUTH_TOKEN) - Non-Anthropic keys (MiniMax, Alibaba, etc.) don't match either pattern + Non-Anthropic keys (MiniMax, Alibaba, etc.) don't match any pattern and correctly return False. """ if not key: @@ -292,6 +293,9 @@ def _is_oauth_token(key: str) -> bool: # JWTs from Anthropic OAuth flow if key.startswith("eyJ"): return True + # Claude Code OAuth access tokens (opaque, from CLAUDE_CODE_OAUTH_TOKEN) + if key.startswith("cc-"): + return True return False