feat: Add support for Azure Anthropic endpoints via AnthropicFoundry #3100
+183
−32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please describe the purpose of this pull request.
This PR adds support for Azure Anthropic endpoints by integrating the AnthropicFoundry client into the existing Anthropic provider logic.
Currently, letta assumes all Anthropic interaction occurs via the standard API. This change allows users to configure a custom endpoint (e.g., an Azure AI Foundry endpoint) via ANTHROPIC_API_BASE. When this environment variable is detected, the system:
4 Adds the Azure-specific model alias anthropic/claude-opus-4-5 to the supported model list.
How to test
Run the newly added test case which mocks the Foundry client initialization:
Manual Verification
Set ANTHROPIC_API_BASE in your .env to a valid Azure Anthropic endpoint. Set ANTHROPIC_API_KEY to your Azure key. Create a generic agent using an Azure-hosted model (e.g., anthropic/claude-opus-4-5).
Send a message and verify the response.
Following is the code I used for my testing the feature end to end
Have you tested this PR?
Unit Tests: Added test_anthropic_foundry_client_initialization to tests/test_llm_clients.py and verified it passes.
Manual Verification: Verified successful agent creation and message generation against a live Azure Anthropic endpoint using a custom verification script.
Related issues or PRs
None
Is your PR over 500 lines of code?
No
Additional context
None