anthropic provider: honor ANTHROPIC_BASE_URL env var#292
Closed
jaylossless wants to merge 1 commit into
Closed
Conversation
The anthropic provider hardcodes base_url to https://api.anthropic.com, so it can't target self-hosted gateways or Anthropic-compatible endpoints. The openai provider already honors OPENAI_BASE_URL; this brings the anthropic provider to parity. Behavior is unchanged when ANTHROPIC_BASE_URL is unset. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
|
I will merge and create release sometime by end of day. Thanks! |
keshprad
self-requested a review
July 22, 2026 00:49
Member
|
Coming back to this, I see another PR with comprehensive tests. Closing this in favor or #282 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The
anthropicprovider hardcodesbase_urltohttps://api.anthropic.comincreate_chat_model, so it can't be pointed at self-hosted gateways, corporate proxies, or Anthropic-compatible endpoints. Theopenaiprovider already honorsOPENAI_BASE_URL; this brings theanthropicprovider to parity by honoringANTHROPIC_BASE_URL(the same env var the official Anthropic SDK reads).Change
create_chat_modelreadsANTHROPIC_BASE_URLfrom the environment, falling back to the existingapi.anthropic.comdefault.Testing
Pointed the
anthropicprovider at an Anthropic-compatible Messages endpoint viaANTHROPIC_BASE_URLand confirmed scans complete with tool-use structured output; the default path is unaffected when the var is unset.🤖 Generated with Claude Code