> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pangolin.net/llms.txt
> Use this file to discover all available pages before exploring further.

# 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](/manage/ai/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.

<Note>
  **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](/manage/ai/virtual-api-keys). 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](/manage/clients/install-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.
</Note>

## Fastest: Pangolin CLI

[Install the Pangolin CLI](/manage/clients/install-client#quick-install-recommended) if you don't have it, then log in:

```bash theme={"theme":"gruvbox-light-hard"}
pangolin login
```

Configure Claude Code against a resource:

```bash theme={"theme":"gruvbox-light-hard"}
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:

```bash theme={"theme":"gruvbox-light-hard"}
pangolin configure claude --resource <resource-niceid-or-domain>
```

To undo it:

```bash theme={"theme":"gruvbox-light-hard"}
pangolin configure claude --reset
```

## Manual setup

Pick the preset that matches your provider.

### Default (Anthropic)

Write `~/.claude/settings.json`:

```json theme={"theme":"gruvbox-light-hard"}
{
    "apiKeyHelper": "echo '<key>'",
    "env": {
        "ANTHROPIC_BASE_URL": "<endpoint>"
    }
}
```

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

```bash theme={"theme":"gruvbox-light-hard"}
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`:

```json theme={"theme":"gruvbox-light-hard"}
{
    "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`:

```json theme={"theme":"gruvbox-light-hard"}
{
    "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`:

```json theme={"theme":"gruvbox-light-hard"}
{
    "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"
    }
}
```
