Skip to content

fix(anthropic): re-apply ANTHROPIC_BASE_URL override reverted by 2.4.3 snapshot#301

Open
psvaggelis wants to merge 1 commit into
NVIDIA:mainfrom
psvaggelis:fix/reapply-anthropic-base-url
Open

fix(anthropic): re-apply ANTHROPIC_BASE_URL override reverted by 2.4.3 snapshot#301
psvaggelis wants to merge 1 commit into
NVIDIA:mainfrom
psvaggelis:fix/reapply-anthropic-base-url

Conversation

@psvaggelis

Copy link
Copy Markdown
Contributor

What

Restores the ANTHROPIC_BASE_URL handling from #282. On current main,
AnthropicProvider again ignores ANTHROPIC_BASE_URL and sends every request
to api.anthropic.com regardless of the configured endpoint.

Why

#282 was merged into main on 2026-07-22, then reverted by the
"Sync OSS release snapshot 2.4.3" commit a54947c (#299, 2026-07-23), which
overwrote the same four files back to their pre-fix state. As of main today:

  • resolve_credentials() returns (api_key, None) — the env var is never read.
  • create_chat_model() hardcodes base_url=ANTHROPIC_BASE_URL (the module default).

This bypasses proxy / gateway / egress-controlled deployments and re-introduces
the inconsistency with OpenAIProvider, which honors OPENAI_BASE_URL.

Changes

  • providers/anthropic/provider.py: resolve_credentials() reads
    ANTHROPIC_BASE_URL; create_chat_model() uses base_url or ANTHROPIC_BASE_URL.
    Unset behaves exactly as before (requests go to the public API).
  • Restores the regression tests from fix(anthropic): honor ANTHROPIC_BASE_URL env override #282 (override + default-endpoint cases;
    ANTHROPIC_BASE_URL cleared in the env-isolation fixtures).

Testing

  • ruff check / ruff format --check: clean.
  • pytest -m "not integration and not provider": 1381 passed, 12 skipped, 6 xfailed.

@keshprad keshprad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apologize for accidental revert

@keshprad keshprad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you sign your commit to ensure the DCO check passes?

Re-applies NVIDIA#282, reverted on main by the 2.4.3 OSS snapshot sync
(a54947c). resolve_credentials() now reads ANTHROPIC_BASE_URL and
create_chat_model() uses base_url or the default endpoint, so
proxy/gateway deployments route through the configured host again.
Regression coverage for the override and default paths restored.

Signed-off-by: Papastavros Vaggelis <psvaggelis@gmail.com>
@psvaggelis
psvaggelis force-pushed the fix/reapply-anthropic-base-url branch from c20afa4 to c33597b Compare July 23, 2026 18:49
@psvaggelis

Copy link
Copy Markdown
Contributor Author

Signed off the commit — DCO should pass once the workflow run is approved, thanks!

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.

2 participants