Soporte base_url custom en OpenAI adapter (MiniMax, DeepInfra, etc.)

Nueva variable AGENTIC_OPENAI_BASE_URL para proveedores compatibles
con OpenAI API (MiniMax, DeepInfra, Together, etc.).

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

View File

@@ -17,10 +17,14 @@ logger = logging.getLogger(__name__)
class OpenAIAdapter(ModelAdapter):
"""Adapter for the OpenAI API (GPT-4o, o1, etc.)."""
def __init__(self, api_key: str | None = None) -> None:
self._client = AsyncOpenAI(
api_key=api_key or settings.openai_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.openai_api_key,
}
url = base_url or settings.openai_base_url
if url:
kwargs["base_url"] = url
self._client = AsyncOpenAI(**kwargs)
# ------------------------------------------------------------------
# Streaming

View File

@@ -30,6 +30,7 @@ class Settings(BaseSettings):
# --- Model providers ---
anthropic_api_key: str = ""
openai_api_key: str = ""
openai_base_url: str = "" # Custom base URL (for MiniMax, DeepInfra, etc.)
default_model_provider: str = "claude"
default_model_id: str = "claude-sonnet-4-20250514"
max_tokens: int = 4096