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

# Claude Code

> Run Claude Code on RedPill through Private AI Proxy, or configure it by hand.

Claude Code speaks the Anthropic Messages protocol. Private AI Proxy configures it automatically.

## With Private AI Proxy

1. Install [Private AI Proxy](/get-started/private-ai-proxy), sign in, and turn on **Protected**.
2. On the **Agents** screen, connect **Claude Code**.
3. Start `claude`.

The app writes the Messages provider into Claude Code's settings with an agent-scoped token for its
local API, and restores the previous settings when you disconnect or stop Protected.

From the CLI, the same connection is:

```bash theme={null}
pap agents connect claude-code
```

## Without the Proxy

Set the base URL to the host without `/v1`; Claude Code appends `/v1/messages` itself.

```bash theme={null}
export REDPILL_AI_API_KEY="YOUR_API_KEY"
export ANTHROPIC_BASE_URL="https://api.redpill.ai"
export ANTHROPIC_AUTH_TOKEN="$REDPILL_AI_API_KEY"
export ANTHROPIC_API_KEY=""
export ANTHROPIC_MODEL="anthropic/claude-sonnet-5"
export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1

claude
```

`ANTHROPIC_AUTH_TOKEN` sends the key as a bearer token; clearing `ANTHROPIC_API_KEY` stops an
existing Anthropic key from adding a conflicting `x-api-key` header. Gateway model discovery loads
RedPill models into the `/model` picker. Map the family aliases if plan mode or background work
needs them: `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`,
`ANTHROPIC_DEFAULT_HAIKU_MODEL`.

This path does not verify ACI locally. For confidential-only routing, use an `is_tee: true` model
with `https://tee.redpill.ai`. See [Verified ACI clients](/guides/verified-aci-client).

## Check the connection

Run `/status` in Claude Code. With the Proxy, the base URL is `http://127.0.0.1:4180`; without it,
`https://api.redpill.ai`. Confirm the bearer credential source and the selected model.

## Troubleshooting

| Symptom                                 | Check                                                                             |
| --------------------------------------- | --------------------------------------------------------------------------------- |
| Claude Code ignores the Proxy           | Confirm **Connected** in the app and that Protected is on, then restart `claude`. |
| Request path contains `/v1/v1/messages` | Remove `/v1` from `ANTHROPIC_BASE_URL`.                                           |
| Authentication fails                    | Use `ANTHROPIC_AUTH_TOKEN` and clear `ANTHROPIC_API_KEY`.                         |

## References

* [Claude Code gateway configuration](https://docs.anthropic.com/en/docs/claude-code/llm-gateway)
* [RedPill Messages API](/api-reference/messages)
* [RedPill model catalog](/api-reference/models)
