> ## 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

> Connect Claude Code to RedPill's Anthropic-compatible Messages API

Claude Code uses RedPill's Anthropic-compatible Messages API. Set the base URL to the host without
`/v1` because Claude Code appends `/v1/messages` itself.

## Configure

```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"

claude
```

Use `ANTHROPIC_AUTH_TOKEN` because RedPill authenticates with a bearer token. Clearing
`ANTHROPIC_API_KEY` prevents an existing Anthropic key from adding a conflicting `x-api-key`
credential.

## Discover models

Enable gateway discovery to load compatible RedPill models into Claude Code's `/model` picker:

```bash theme={null}
export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1
```

Claude Code uses family aliases for some background and plan-mode work. Map the aliases when those
features are part of your workflow:

```bash theme={null}
export ANTHROPIC_DEFAULT_OPUS_MODEL="anthropic/claude-opus-5"
export ANTHROPIC_DEFAULT_SONNET_MODEL="anthropic/claude-sonnet-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="anthropic/claude-haiku-4.5"
```

## Check the connection

Run `/status` after launch and confirm the RedPill base URL, bearer credential source, and selected
model. Claude Code officially supports Claude models; use [Codex CLI](/guides/integrations/coding-tools/codex-cli),
[OpenCode](/guides/integrations/coding-tools/opencode), or [Cline](/guides/integrations/coding-tools/cline)
for arbitrary OpenAI-compatible models.

To require a confidential upstream, select an `is_tee: true` Claude model and change the host to
`https://tee.redpill.ai`.

Claude Code's gateway configuration is base-URL-only and does not verify ACI locally. See
[Verified ACI clients](/guides/verified-aci-client) for the required transport boundary.

## Troubleshooting

| Symptom                                 | Check                                                     |
| --------------------------------------- | --------------------------------------------------------- |
| Request path contains `/v1/v1/messages` | Remove `/v1` from `ANTHROPIC_BASE_URL`.                   |
| Authentication fails                    | Use `ANTHROPIC_AUTH_TOKEN` and clear `ANTHROPIC_API_KEY`. |
| Background tasks use another model      | Set the three `ANTHROPIC_DEFAULT_*_MODEL` aliases.        |

## References

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