Skip to content

Feature Request: Support ANTHROPIC_BASE_URL for custom API endpoints #338

@ramarivera

Description

@ramarivera

Summary

AutoMaker currently does not support custom Anthropic API endpoints via the ANTHROPIC_BASE_URL environment variable. This prevents users from using AutoMaker with:

  • LLM gateways (LiteLLM, Helicone, etc.)
  • Anthropic-compatible providers (GLM 4.7, Minimax M2.1, Z.AI, etc.)
  • Corporate proxies with custom authentication
  • Self-hosted deployments with regional endpoints

Root Cause

In apps/server/src/providers/claude-provider.ts, the ALLOWED_ENV_VARS allowlist explicitly filters environment variables passed to the Claude Agent SDK:

// Line 20-29
const ALLOWED_ENV_VARS = [
  'ANTHROPIC_API_KEY',
  'PATH',
  'HOME',
  'SHELL',
  'TERM',
  'USER',
  'LANG',
  'LC_ALL',
];

The Claude Agent SDK (and underlying @anthropic-ai/sdk) does support ANTHROPIC_BASE_URL - it's just being filtered out by AutoMaker before reaching the SDK.

Proposed Solution

Minimal Fix (1 line)

Add ANTHROPIC_BASE_URL to the allowlist:

const ALLOWED_ENV_VARS = [
  'ANTHROPIC_API_KEY',
  'ANTHROPIC_BASE_URL',  // ← Add this
  'PATH',
  'HOME',
  // ...
];

This would allow users to run AutoMaker with custom endpoints:

ANTHROPIC_API_KEY=your-key \
ANTHROPIC_BASE_URL=https://your-gateway.example.com/v1 \
docker-compose up -d

Enhanced Solution (Optional)

For a better UX, consider also adding:

  1. ANTHROPIC_AUTH_TOKEN - For gateways that use different auth headers
  2. Settings UI integration - Allow configuring the endpoint in the settings panel

Use Cases

  1. LLM Gateway Integration: Route through LiteLLM, Helicone, or similar for logging/caching
  2. Alternative Providers: Use Anthropic-compatible APIs like GLM 4.7, Minimax M2.1
  3. Enterprise Deployments: Corporate proxies with custom authentication
  4. Regional Endpoints: Self-hosted or regional API deployments

References

  • Claude Code supports this via ~/.claude/settings.json with env.ANTHROPIC_BASE_URL
  • Claude Code LLM Gateway docs
  • The Claude Agent SDK inherits this from @anthropic-ai/sdk

Note: Similar issues were searched before filing. This report was created with AI assistance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementImprovements to existing functionality or UI.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions