Skip to content

fix(auxiliary): pass raw explicit_base_url to _wrap_if_needed for Anthropic transport - #19772

Closed
luyao618 wants to merge 1 commit into
NousResearch:mainfrom
luyao618:fix/auxiliary-anthropic-double-v1-explicit-base-url
Closed

fix(auxiliary): pass raw explicit_base_url to _wrap_if_needed for Anthropic transport#19772
luyao618 wants to merge 1 commit into
NousResearch:mainfrom
luyao618:fix/auxiliary-anthropic-double-v1-explicit-base-url

Conversation

@luyao618

@luyao618 luyao618 commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #19753 — auxiliary title generation (and other aux tasks) returns HTTP 404 when using a custom:<name> provider with api_mode: anthropic_messages and an explicit_base_url.

Root Cause

In resolve_provider_client(), the explicit_base_url branch (line ~2206) passes custom_base — the URL rewritten by _to_openai_base_url() with /v1 appended — to _wrap_if_needed(). When _maybe_wrap_anthropic() forwards this to build_anthropic_client(), the Anthropic SDK appends its own /v1/messages, producing /v1/v1/messages → 404.

PR #17467 previously fixed this same class of bug for the named-custom-provider and _try_custom_endpoint branches, but missed the explicit_base_url branch.

Fix

One-line change: pass explicit_base_url (the raw, un-rewritten URL) instead of custom_base to _wrap_if_needed(), so the Anthropic SDK constructs the correct path.

Testing

  • Added regression test tests/agent/test_auxiliary_explicit_base_url_anthropic.py that verifies the source passes explicit_base_url (not custom_base) to _wrap_if_needed.
  • All existing tests pass.

Scope

  • agent/auxiliary_client.py — 1 line changed
  • tests/agent/test_auxiliary_explicit_base_url_anthropic.py — new test file

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint labels May 4, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #19753 (the issue this fixes) and #17467 (prior fix for same class of bug that missed the explicit_base_url branch).

@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #19753 and #17467

…hropic transport

The explicit_base_url branch in resolve_provider_client() was passing
custom_base (_to_openai_base_url()-rewritten URL with /v1 appended) to
_wrap_if_needed(). When _maybe_wrap_anthropic() forwarded this to
build_anthropic_client(), the Anthropic SDK appended its own /v1/messages,
producing a double /v1/v1/messages path — HTTP 404.

PR NousResearch#17467 fixed the same class of bug for the named-custom-provider and
_try_custom_endpoint branches, but missed the explicit_base_url branch
(line ~2206).

Fix: pass explicit_base_url (the raw, un-rewritten URL) so the Anthropic
SDK constructs the correct /v1/messages path.

Fixes NousResearch#19753
@luyao618
luyao618 force-pushed the fix/auxiliary-anthropic-double-v1-explicit-base-url branch from 24b8042 to 99380fe Compare May 5, 2026 10:38
@luyao618

Copy link
Copy Markdown
Contributor Author

Closing: this PR has been open for 1-2 weeks with no maintainer review and the codebase continues to evolve. Will re-submit if the fix is still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auxiliary title generation 404 on custom Anthropic-mode providers (URL double-/v1)

2 participants