Skip to content

fix(auxiliary): honor /anthropic-suffixed gateway base_url in _try_anthropic (salvage #62061) - #85533

Merged
teknium1 merged 1 commit into
mainfrom
salv-62061
Aug 13, 2026
Merged

fix(auxiliary): honor /anthropic-suffixed gateway base_url in _try_anthropic (salvage #62061)#85533
teknium1 merged 1 commit into
mainfrom
salv-62061

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

_try_anthropic now honors configured gateway base URLs whose path ends /anthropic or /anthropic/v1 instead of discarding them and forcing api.anthropic.com. Salvage of #62061 by @iso2kx onto current main, authorship preserved.

_is_anthropic_compatible_host() was host-allowlist-only, so auxiliary/fallback Anthropic calls threw away a perfectly valid path-suffixed gateway base_url — the primary path already trusts these URLs via _detect_api_mode_for_url. The #52608 bare-non-Anthropic-host rejection is preserved.

Changes

Validation

Before After
gateway base_url …/anthropic on aux _try_anthropic discarded → api.anthropic.com honored
bare non-Anthropic host rejected still rejected
targeted tests 7/7, sabotage-verified

Infographic

anthropic-suffixed gateway trust

…allback calls

`_try_anthropic()` applies the configured `model.base_url` only when
`_is_anthropic_compatible_host()` trusts it, but that check accepted only the
literal `api.anthropic.com` host. Anthropic-compatible gateways that expose the
native Messages protocol under a `/anthropic` path suffix (MiniMax, Zhipu GLM,
LiteLLM-style relays, self-hosted proxies) were rejected, so every auxiliary
call (title generation, memory extraction, vision, reflection) and the
`provider: anthropic` fallback chain discarded the configured base_url and fell
back to `https://api.anthropic.com`. That diverges from the primary path, which
already trusts the `/anthropic` suffix via
`runtime_provider._detect_api_mode_for_url`, and fails outright when the gateway
(not Anthropic) holds the credentials.

Accept `/anthropic` and `/anthropic/v1` suffixed URLs in
`_is_anthropic_compatible_host()`, matching the primary-path convention and
`_wrap_if_needed`. A bare non-Anthropic base_url (e.g. `openrouter.ai/api/v1`
left on `provider: anthropic`) still returns False, preserving the #52608 guard.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/anthropic Anthropic native Messages API area/config Config system, migrations, profiles sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Aug 13, 2026
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 2be18b5 — fix(auxiliary): honor /anthropic-suffixed gateway base_url o

⚠️ Warnings

OSV vulnerability scan · View job

5 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 8m44s vs 9m28s (-7.7%). 17 job(s) slower, 6 faster, 1 unchanged.

  • Python tests / Run tests slice 6/12: -31.0s
  • Python tests / Run tests slice 7/12: +28.0s
  • Python tests / Run tests slice 4/12: -18.0s
  • OS-specific tests / Windows-only tests: +14.0s
  • Python tests / Run tests slice 2/12: +13.0s

@teknium1
teknium1 merged commit cd344a2 into main Aug 13, 2026
49 checks passed
@teknium1
teknium1 deleted the salv-62061 branch August 13, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/anthropic Anthropic native Messages API sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants