Files
agent-framework/python/packages/anthropic/tests
T
Evan Mattson 8bb4692678 Python: Add base_url parameter to AnthropicClient and RawAnthropicClient (#5685)
* feat(anthropic): add base_url parameter to AnthropicClient and RawAnthropicClient

Add base_url support to AnthropicSettings TypedDict, RawAnthropicClient,
and AnthropicClient so users can point the client at Foundry or other
Anthropic-compatible endpoints without having to construct AsyncAnthropic
manually.

- Add base_url field to AnthropicSettings (resolved from ANTHROPIC_BASE_URL env var)
- Add base_url parameter to RawAnthropicClient.__init__ and pass it to AsyncAnthropic
- Add base_url parameter to AnthropicClient.__init__ and forward to super
- Add unit tests for base_url on both client classes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Python: Add `base_url` parameter to `AnthropicClient` and `RawAnthropicClient`

Fixes #5683

* test: add ANTHROPIC_BASE_URL env fallback tests for issue #5683

Add unit tests verifying that both AnthropicClient and RawAnthropicClient
pick up base_url from the ANTHROPIC_BASE_URL environment variable via
load_settings when base_url is not passed explicitly as a constructor arg.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test(anthropic): explicit base_url kwarg beats ANTHROPIC_BASE_URL env var (#5683)

Add regression tests asserting that when both ANTHROPIC_BASE_URL is set
in the environment *and* an explicit base_url kwarg is passed to
AnthropicClient / RawAnthropicClient, the explicit kwarg wins.

This closes the priority-ordering contract (explicit arg > env var) that
the existing tests left implicit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8bb4692678 ยท 2026-05-07 17:57:09 +00:00
History
..