Skip to content

fix: normalize base_url to str before rstrip in anthropic adapter#4968

Closed
bugkill3r wants to merge 1 commit into
NousResearch:mainfrom
bugkill3r:fix/httpx-url-rstrip-4944
Closed

fix: normalize base_url to str before rstrip in anthropic adapter#4968
bugkill3r wants to merge 1 commit into
NousResearch:mainfrom
bugkill3r:fix/httpx-url-rstrip-4944

Conversation

@bugkill3r

Copy link
Copy Markdown
Contributor

Summary

  • Fixes fix fallback activation when provider client base_url is an httpx.URL #4944
  • _is_third_party_anthropic_endpoint() and _requires_bearer_auth() called .rstrip() on base_url assuming it's always a string
  • When a provider client exposes base_url as an httpx.URL object (e.g. MiniMax fallback), this crashes with AttributeError: 'URL' object has no attribute 'rstrip'
  • Wrapping in str() handles both str and httpx.URL inputs

Test plan

  • _requires_bearer_auth(httpx.URL("https://api.minimax.io/anthropic")) returns True without crashing
  • _is_third_party_anthropic_endpoint(httpx.URL("https://example.com")) returns True without crashing
  • String inputs continue to work as before

…usResearch#4944)

When a provider client exposes base_url as an httpx.URL object,
calling .rstrip() crashes with AttributeError. Wrap base_url in
str() in _is_third_party_anthropic_endpoint and _requires_bearer_auth
to handle both str and httpx.URL inputs.
@teknium1

teknium1 commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Superseded by PR #6289 which includes this fix (plus additional thinking block signature stripping for third-party endpoints). Thanks @bugkill3r for the minimal fix approach!

@teknium1 teknium1 closed this Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix fallback activation when provider client base_url is an httpx.URL

2 participants