Skip to content

feat: Add native base_url and custom_headers inputs for LLM Gateway integration #840

@GuitaristForEver

Description

@GuitaristForEver

Problem

Users integrating Claude Code Action with LLM Gateways, API proxies, or API management solutions currently need to use env: blocks to set ANTHROPIC_BASE_URL and ANTHROPIC_CUSTOM_HEADERS. This is:

  • Not discoverable - inputs don't appear in action.yml or IDE autocomplete
  • Requires custom scripting - users must understand env var passthrough
  • Confusing format - users don't know headers need JSON format (see AWS Bedrock via porkey in claude code action #704)

Related Discussions (Users Currently Blocked)

Proposed Solution

Add native inputs that mirror the existing pattern for anthropic_api_key:

- uses: anthropics/claude-code-action@v1
  with:
    anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
    base_url: "https://your-gateway.example.com"
    custom_headers: '{"x-portkey-api-key": "${{ secrets.PORTKEY_KEY }}"}'

New Inputs

Input Description Default
base_url Custom API endpoint URL for LLM Gateway/proxy ""
custom_headers Custom HTTP headers as JSON string ""

Backwards Compatibility

Inputs take precedence but fall back to env vars:

ANTHROPIC_BASE_URL: ${{ inputs.base_url || env.ANTHROPIC_BASE_URL }}
ANTHROPIC_CUSTOM_HEADERS: ${{ inputs.custom_headers || env.ANTHROPIC_CUSTOM_HEADERS }}

Use Cases

  1. LLM Gateways - Route through enterprise gateways per Anthropic docs
  2. Portkey/LiteLLM - Observability and fallback routing
  3. API Management - Azure APIM, AWS API Gateway, Kong policies
  4. Custom Auth - Subscription keys, bearer tokens, correlation IDs

Implementation

Simple YAML changes to both action.yml files + documentation updates. No TypeScript changes needed - the SDK already reads these env vars.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions