Soporte base_url custom en Claude adapter (MiniMax Anthropic-compatible)

MiniMax tiene endpoint compatible con Anthropic API en
https://api.minimax.io/anthropic/v1. Nueva variable
AGENTIC_ANTHROPIC_BASE_URL para usarlo.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jordan Diaz
2026-04-04 10:42:40 +00:00
parent 00c41fedb2
commit 72da3b7659
2 changed files with 9 additions and 4 deletions

View File

@@ -17,10 +17,14 @@ logger = logging.getLogger(__name__)
class ClaudeAdapter(ModelAdapter):
"""Adapter for the Anthropic Claude API."""
def __init__(self, api_key: str | None = None) -> None:
self._client = anthropic.AsyncAnthropic(
api_key=api_key or settings.anthropic_api_key,
)
def __init__(self, api_key: str | None = None, base_url: str | None = None) -> None:
kwargs: dict[str, Any] = {
"api_key": api_key or settings.anthropic_api_key,
}
url = base_url or settings.anthropic_base_url
if url:
kwargs["base_url"] = url
self._client = anthropic.AsyncAnthropic(**kwargs)
# ------------------------------------------------------------------
# Streaming