fix(agent): update error message for unsupported Anthropic API endpoints to clarify usage of OpenRouter
This commit is contained in:
@@ -202,9 +202,10 @@ class MiniSWERunner:
|
||||
|
||||
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."
|
||||
"Anthropic's native /v1/messages API is not supported yet (planned for a future release). "
|
||||
"Hermes currently requires OpenAI-compatible /chat/completions endpoints. "
|
||||
"To use Claude models now, route through OpenRouter (OPENROUTER_API_KEY) "
|
||||
"or any OpenAI-compatible proxy that wraps the Anthropic API."
|
||||
)
|
||||
|
||||
# Handle API key - OpenRouter is the primary provider
|
||||
|
||||
@@ -185,9 +185,10 @@ class AIAgent:
|
||||
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."
|
||||
"Anthropic's native /v1/messages API is not supported yet (planned for a future release). "
|
||||
"Hermes currently requires OpenAI-compatible /chat/completions endpoints. "
|
||||
"To use Claude models now, route through OpenRouter (OPENROUTER_API_KEY) "
|
||||
"or any OpenAI-compatible proxy that wraps the Anthropic API."
|
||||
)
|
||||
self.tool_progress_callback = tool_progress_callback
|
||||
self.clarify_callback = clarify_callback
|
||||
|
||||
@@ -285,7 +285,7 @@ class TestInit:
|
||||
patch("run_agent.check_toolset_requirements", return_value={}),
|
||||
patch("run_agent.OpenAI") as mock_openai,
|
||||
):
|
||||
with pytest.raises(ValueError, match="Anthropic /v1/messages is not supported yet"):
|
||||
with pytest.raises(ValueError, match="not supported yet"):
|
||||
AIAgent(
|
||||
api_key="test-key-1234567890",
|
||||
base_url="https://api.anthropic.com/v1/messages",
|
||||
|
||||
Reference in New Issue
Block a user