feat: add custom base URL support for Anthropic-compatible endpoints (#246)

Support ANTHROPIC_BASE_URL + ANTHROPIC_AUTH_TOKEN in .env to route
SDK requests through proxies or gateways. Preflight now validates the
custom endpoint is reachable instead of skipping credential checks.
This commit is contained in:
ezl-keygraph
2026-03-18 00:53:44 +05:30
committed by GitHub
parent 629c52ed3b
commit ae4bd45a30
4 changed files with 73 additions and 9 deletions
+12 -4
View File
@@ -13,7 +13,14 @@ ANTHROPIC_API_KEY=your-api-key-here
# CLAUDE_CODE_OAUTH_TOKEN=your-oauth-token-here
# =============================================================================
# OPTION 2: Router Mode (use alternative providers)
# OPTION 2: Custom Base URL (compatible proxies, gateways, etc.)
# =============================================================================
# Point the SDK at an alternative Anthropic-compatible endpoint.
# ANTHROPIC_BASE_URL=https://your-proxy.example.com
# ANTHROPIC_AUTH_TOKEN=your-auth-token # Auth token for the custom endpoint
# =============================================================================
# OPTION 3: Router Mode (use alternative providers)
# =============================================================================
# Enable router mode by running: ./shannon start ... ROUTER=true
# Then configure ONE of the providers below:
@@ -27,15 +34,16 @@ ANTHROPIC_API_KEY=your-api-key-here
# ROUTER_DEFAULT=openrouter,google/gemini-3-flash-preview
# =============================================================================
# Model Tier Overrides (Anthropic API / OAuth / Bedrock)
# Model Tier Overrides (Anthropic API / OAuth / Custom Base URL / Bedrock)
# =============================================================================
# Override which model is used for each tier. Defaults are used if not set.
# Optional for direct Anthropic and custom base URL modes. Required for Bedrock/Vertex.
# ANTHROPIC_SMALL_MODEL=... # Small tier (default: claude-haiku-4-5-20251001)
# ANTHROPIC_MEDIUM_MODEL=... # Medium tier (default: claude-sonnet-4-6)
# ANTHROPIC_LARGE_MODEL=... # Large tier (default: claude-opus-4-6)
# =============================================================================
# OPTION 3: AWS Bedrock
# OPTION 4: AWS Bedrock
# =============================================================================
# https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/
# Requires the model tier overrides above to be set with Bedrock-specific model IDs.
@@ -49,7 +57,7 @@ ANTHROPIC_API_KEY=your-api-key-here
# AWS_BEARER_TOKEN_BEDROCK=your-bearer-token
# =============================================================================
# OPTION 4: Google Vertex AI
# OPTION 5: Google Vertex AI
# =============================================================================
# https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-partner-models
# Requires a GCP service account with roles/aiplatform.user.