fix(providers): route agentrouter through anthropic endpoint headers

Update the AgentRouter provider registry to use the Claude-compatible
messages API and required Anthropic-style authentication headers. This
bypasses unauthorized_client_error responses and exposes the supported
model list through passthrough configuration.

Also update the changelog and release PR notes to document the fix for
#1921
This commit is contained in:
diegosouzapw
2026-05-04 01:08:14 -03:00
parent d3c1abc6e1
commit f6fdfea3ae
3 changed files with 30 additions and 6 deletions

View File

@@ -21,6 +21,7 @@
### 🐛 Bug Fixes
- **fix(providers):** allow local OpenAI-compatible endpoints (like Ollama) to be added without an API key (fixes #1893)
- **fix(providers):** bypass AgentRouter unauthorized_client_error by spoofing Claude CLI headers via Anthropic endpoints (fixes #1921)
- **fix(copilot):** emit compatible reasoning text deltas (#1919 — thanks @ivan-mezentsev)
- **fix(api-manager):** show validation errors inline in modals, not behind (#1920 — thanks @andrewmunsell)
- **fix(compression):** align seeded standard savings combo with stacked default, preserve stacked defaults, and secure metadata routes.

View File

@@ -672,17 +672,39 @@ export const REGISTRY: Record<string, RegistryEntry> = {
agentrouter: {
id: "agentrouter",
alias: "agentrouter",
format: "openai",
format: "claude",
executor: "default",
baseUrl: "https://agentrouter.org/v1/chat/completions",
baseUrl: "https://agentrouter.org/v1/messages",
authType: "apikey",
authHeader: "bearer",
authHeader: "x-api-key",
defaultContextLength: 128000,
headers: {
"HTTP-Referer": "https://endpoint-proxy.local",
"X-Title": "OmniRoute",
"Anthropic-Version": ANTHROPIC_VERSION_HEADER,
"Anthropic-Beta": ANTHROPIC_BETA_CLAUDE_OAUTH,
"Anthropic-Dangerous-Direct-Browser-Access": "true",
"User-Agent": CLAUDE_CLI_USER_AGENT,
"X-App": "cli",
"X-Stainless-Helper-Method": "stream",
"X-Stainless-Retry-Count": "0",
"X-Stainless-Runtime-Version": CLAUDE_CLI_STAINLESS_RUNTIME_VERSION,
"X-Stainless-Package-Version": CLAUDE_CLI_STAINLESS_PACKAGE_VERSION,
"X-Stainless-Runtime": "node",
"X-Stainless-Lang": "js",
"X-Stainless-Arch": mapStainlessArch(),
"X-Stainless-Os": mapStainlessOs(),
"X-Stainless-Timeout": "600",
},
models: [{ id: "auto", name: "Auto (Best Available)" }],
models: [
{ id: "claude-haiku-4-5-20251001", name: "Claude 4.5 Haiku" },
{ id: "claude-opus-4-6", name: "Claude 4.6 Opus" },
{ id: "deepseek-r1-0528", name: "DeepSeek R1 0528" },
{ id: "deepseek-v3.1", name: "DeepSeek V3.1" },
{ id: "deepseek-v3.2", name: "DeepSeek V3.2" },
{ id: "glm-4.5", name: "GLM 4.5" },
{ id: "glm-4.6", name: "GLM 4.6" },
{ id: "glm-5.1", name: "GLM 5.1" },
],
passthroughModels: true,
},
openrouter: {

View File

@@ -15,6 +15,7 @@
### 🐛 Bug Fixes
- **fix(providers):** allow local OpenAI-compatible endpoints (like Ollama) to be added without an API key (fixes #1893)
- **fix(providers):** bypass AgentRouter unauthorized_client_error by spoofing Claude CLI headers via Anthropic endpoints (fixes #1921)
- **fix(copilot):** emit compatible reasoning text deltas (#1919 — thanks @ivan-mezentsev)
- **fix(api-manager):** show validation errors inline in modals, not behind (#1920 — thanks @andrewmunsell)
- **fix(compression):** align seeded standard savings combo with stacked default, preserve stacked defaults, and secure metadata routes.