AI Gateway is now available: identity-aware access to any AI provider, eliminate API keys, and tunnel to self-hosted models. Get started

AI GatewayConfigure AI Clients and Agents

Claude Code

Connect Claude Code to a Pangolin AI Gateway resource

Claude Code talks the Anthropic Messages API, so the resource you point it at needs an Anthropic-compatible provider attached - Anthropic itself, Bedrock, Vertex AI, or a custom Anthropic-compatible endpoint like Kimi K2. See AI Gateway Overview if you haven't set that up yet.

You'll need the resource's URL (its <endpoint>) and its API key (<key>). Both are on the resource's Keys page.

Public vs. private resources

Wherever these instructions show <key>, what you put there depends on the resource type:

  • Public resource - reachable from anywhere, so the gateway checks a virtual API key. Copy it from the resource URL after login, the Resource Launcher more-info panel, or https://app.pangolin.net/<org-id>/keys (use your self-hosted dashboard URL in place of app.pangolin.net if you self-host).
  • Private resource - only reachable from devices connected to your Pangolin network, so no key is checked. You must have the Pangolin client installed and connected. Use the literal string none as the key.

Don't delete the key field for private resources. Most clients refuse to start without some key set, so they need an inert placeholder rather than a missing one.

Fastest: Pangolin CLI

Install the Pangolin CLI if you don't have it, then log in:

pangolin login

Configure Claude Code against a resource:

pangolin configure claude

This prompts you to pick an organization and resource if you have more than one, fetches a key for you if the resource needs one, and writes ~/.claude/settings.json. To skip the prompts:

pangolin configure claude --resource <resource-niceid-or-domain>

To undo it:

pangolin configure claude --reset

Manual setup

Pick the preset that matches your provider.

Default (Anthropic)

Write ~/.claude/settings.json:

{
    "apiKeyHelper": "echo '<key>'",
    "env": {
        "ANTHROPIC_BASE_URL": "<endpoint>"
    }
}

Or, for a one-off shell session instead of a permanent settings file:

export ANTHROPIC_BASE_URL=<endpoint>
export ANTHROPIC_API_KEY=<key>
claude

For a private resource, keep apiKeyHelper/ANTHROPIC_API_KEY in place and set the key to none. Claude Code only calls apiKeyHelper if it's present, and falls back to whatever account you're already signed into if it isn't - so removing it sends your traffic to Anthropic instead of through the gateway.

Amazon Bedrock

Use this when the resource has a Bedrock provider attached. Write ~/.claude/settings.json:

{
    "env": {
        "ANTHROPIC_MODEL": "claude-sonnet-4-6",
        "ANTHROPIC_BEDROCK_BASE_URL": "<endpoint>/bedrock",
        "CLAUDE_CODE_USE_BEDROCK": "1",
        "CLAUDE_CODE_SKIP_BEDROCK_AUTH": "1"
    }
}

Google Vertex AI

Use this when the resource has a Vertex AI provider attached. Write ~/.claude/settings.json:

{
    "env": {
        "CLOUD_ML_REGION": "global",
        "ANTHROPIC_VERTEX_PROJECT_ID": "<your-gcp-project-id>",
        "CLAUDE_CODE_USE_VERTEX": "1",
        "CLAUDE_CODE_SKIP_VERTEX_AUTH": "1",
        "ANTHROPIC_VERTEX_BASE_URL": "<endpoint>/v1"
    }
}

Replace <your-gcp-project-id> with your actual GCP project ID.

Kimi K2 (Moonshot AI)

Use this when the resource has a custom provider pointed at Moonshot AI's Anthropic-compatible endpoint. Write ~/.claude/settings.json:

{
    "apiKeyHelper": "echo '<key>'",
    "env": {
        "ANTHROPIC_BASE_URL": "<endpoint>/anthropic",
        "ANTHROPIC_MODEL": "kimi-k2",
        "ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k2",
        "ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k2",
        "ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-k2",
        "CLAUDE_CODE_SUBAGENT_MODEL": "kimi-k2",
        "ENABLE_TOOL_SEARCH": "false"
    }
}

Was this page helpful?

⌘I

On this page