Skip to content

feat: add ANTHROPIC_BASE_URL setting for custom API endpoints - #210

Open
octo-patch wants to merge 1 commit into
RichardAtCT:mainfrom
octo-patch:octo/20260730-provider-add-recvqg70EDusKo
Open

feat: add ANTHROPIC_BASE_URL setting for custom API endpoints#210
octo-patch wants to merge 1 commit into
RichardAtCT:mainfrom
octo-patch:octo/20260730-provider-add-recvqg70EDusKo

Conversation

@octo-patch

Copy link
Copy Markdown

Reason: provider-add — expose an Anthropic-compatible custom endpoint via the SDK extension point while preserving the existing SDK/session flow.

Changes

  • src/config/settings.py: add the optional anthropic_base_url field plus the anthropic_base_url_str computed property (whitespace-trimmed), mirroring the existing anthropic_api_key / anthropic_api_key_str pair.
  • src/claude/sdk_integration.py: in ClaudeSDKManager.__init__, export the configured value to the ANTHROPIC_BASE_URL environment variable (and clear it when unset) alongside the existing ANTHROPIC_API_KEY handling. The Claude Code SDK reads this env var, so the SDK/client construction and session flow are unchanged.

Tests

  • tests/unit/test_claude/test_sdk_integration.py: add test_sdk_manager_initialization_with_base_url and test_sdk_manager_initialization_without_base_url.
  • tests/unit/test_config.py: add test_anthropic_base_url_property covering unset, set, and whitespace-trimming cases.

Verification

Ran with the project toolchain:

  • pytest tests/ — 533 passed.
  • black --check, isort --check-only, and flake8 on the changed src/ and tests/ files — clean.
  • mypy src/config/settings.py — no issues (pre-existing SDK typing notes in sdk_integration.py are unchanged and out of scope).

Documentation

  • .env.example, README.md, docs/configuration.md, and CHANGELOG.md document the new ANTHROPIC_BASE_URL option.

Add an optional ANTHROPIC_BASE_URL setting that configures the Claude
Code SDK to use a proxy/enterprise endpoint or any Anthropic-compatible
provider endpoint. ClaudeSDKManager exports the value to the
ANTHROPIC_BASE_URL environment variable, preserving the existing
SDK/session flow when the setting is left empty.
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