fix(providers): support anthropic proxy v1 endpoints

This commit is contained in:
helix4u
2026-06-14 02:09:16 -07:00
committed by Teknium
parent 81e42335a1
commit 85e6232a07
8 changed files with 133 additions and 14 deletions
+3 -1
View File
@@ -5,6 +5,7 @@ from __future__ import annotations
import logging
import os
import re
from urllib.parse import urlparse
from typing import Any, Dict, Optional
logger = logging.getLogger(__name__)
@@ -93,7 +94,8 @@ def _detect_api_mode_for_url(base_url: str) -> Optional[str]:
return "codex_responses"
if hostname == "api.openai.com":
return "codex_responses"
if normalized.endswith("/anthropic"):
path = urlparse(normalized).path.rstrip("/")
if path.endswith("/anthropic") or path.endswith("/anthropic/v1"):
return "anthropic_messages"
if hostname == "api.kimi.com" and "/coding" in normalized:
return "anthropic_messages"