Skip to content

Conversation

@windoze
Copy link
Contributor

@windoze windoze commented Nov 24, 2025

Summary

Recently Anthropic models are available on Microsoft Azure and it uses different API base URL like https://your-azure-foundry-resource.services.ai.azure.com/anthropic, this new feature is already supported by Claude Code tools.

This PR adds configurable base URL support for the Anthropic backend, enabling users to specify custom API endpoints through multiple configuration sources. This allows compatibility with Anthropic-compatible API services, proxy servers, and enterprise deployments.

Key changes:

  • Add base_url parameter to Anthropic backend (defaults to https://api.anthropic.com)
  • Support base URL configuration from CLI args, environment variable (LLM_BASE_URL), or secret store (BASE_URL)

Usage examples:

# Via command line
llm --provider anthropic --base-url https://your-azure-foundry-resource.services.ai.azure.com/anthropic chat

# Via environment variable
export LLM_BASE_URL=https://your-azure-foundry-resource.services.ai.azure.com/anthropic
llm --provider anthropic chat

# Via secret store
llm set BASE_URL https://your-azure-foundry-resource.services.ai.azure.com/anthropic
llm --provider anthropic chat

windoze and others added 2 commits November 24, 2025 15:42
Add base_url parameter to Anthropic struct and constructor to enable
custom API endpoints. This allows compatibility with Anthropic-compatible
API services and proxy servers while defaulting to the official API.

Changes:
- Add base_url field to Anthropic struct
- Update Anthropic::new() to accept optional base_url parameter
- Update API request to use configurable base URL
- Default to https://api.anthropic.com when no custom URL provided
- Pass base_url from LLMBuilder to Anthropic constructor

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Extend CLI to support reading base URL from multiple sources: command
line arguments, LLM_BASE_URL environment variable, or the secret store.
This provides flexible configuration options for users who need to use
custom API endpoints.

Changes:
- Add get_base_url() helper function to check multiple sources
- Check environment variable LLM_BASE_URL as fallback
- Check secret store BASE_URL key as additional fallback
- Update main() to use get_base_url() instead of direct args access

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

1 participant