diff --git a/agent/anthropic_adapter.py b/agent/anthropic_adapter.py index e7e1a8acb6..469b0fc9bb 100644 --- a/agent/anthropic_adapter.py +++ b/agent/anthropic_adapter.py @@ -471,14 +471,18 @@ def _requires_bearer_auth(base_url: str | None) -> bool: """Return True for Anthropic-compatible providers that require Bearer auth. Some third-party /anthropic endpoints implement Anthropic's Messages API but - require Authorization: Bearer *** of Anthropic's native x-api-key header. - MiniMax's global and China Anthropic-compatible endpoints follow this pattern. + require Authorization: Bearer instead of Anthropic's native x-api-key header. + MiniMax's global and China Anthropic-compatible endpoints, and Azure AI + Foundry's Anthropic-style endpoint follow this pattern. """ normalized = _normalize_base_url_text(base_url) if not normalized: return False normalized = normalized.rstrip("/").lower() - return normalized.startswith(("https://api.minimax.io/anthropic", "https://api.minimaxi.com/anthropic")) + return ( + normalized.startswith(("https://api.minimax.io/anthropic", "https://api.minimaxi.com/anthropic")) + or "azure.com" in normalized + ) def _base_url_needs_context_1m_beta(base_url: str | None) -> bool: