Skip to content

CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.

feat(anthropic): accept base_url for OpenAI-compat proxies

xf gongc82a318ee1b3
diff --git a/cubepi/providers/anthropic.py b/cubepi/providers/anthropic.py
index 68ce6c8..4f3bb14 100644
--- a/cubepi/providers/anthropic.py
+++ b/cubepi/providers/anthropic.py
@@ -62,12 +62,16 @@ class AnthropicProvider:
self,
*,
api_key: str | None = None,
+ base_url: str | None = None,
cache_retention: CacheRetention = "short",
cache_policy: CacheMarkerPolicy | None = None,
) -> None:
import anthropic
- self._client = anthropic.AsyncAnthropic(api_key=api_key)
+ kwargs: dict[str, Any] = {"api_key": api_key}
+ if base_url is not None:
+ kwargs["base_url"] = base_url
+ self._client = anthropic.AsyncAnthropic(**kwargs)
self._cache_retention = cache_retention
self._cache_policy: CacheMarkerPolicy = (
cache_policy or DefaultCacheMarkerPolicy()