Merge pull request #173 from adavyas/fix/anthropic-base-url-guard

fix(agent): fail fast on Anthropic native base URLs
This commit is contained in:
Teknium 2026-02-27 23:22:01 -08:00 committed by GitHub
commit 2bc9508b7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 0 deletions

View file

@ -183,6 +183,12 @@ class AIAgent:
# Store effective base URL for feature detection (prompt caching, reasoning, etc.)
# When no base_url is provided, the client defaults to OpenRouter, so reflect that here.
self.base_url = base_url or OPENROUTER_BASE_URL
if base_url and "api.anthropic.com" in base_url.strip().lower():
raise ValueError(
"Anthropic /v1/messages is not supported yet. "
"Hermes uses OpenAI-compatible /chat/completions. "
"Use OpenRouter or leave base_url unset."
)
self.tool_progress_callback = tool_progress_callback
self.clarify_callback = clarify_callback
self._last_reported_tool = None # Track for "new tool" mode