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

# Use Claude Code with RunBridge AI

> Connect Claude Code to the Anthropic Messages API with a RunBridge AI gateway credential.

Use Claude Code's [LLM gateway configuration](https://code.claude.com/docs/en/llm-gateway-connect) to send Anthropic Messages requests through RunBridge AI.

## Prerequisites

* Install Claude Code from the [official setup guide](https://code.claude.com/docs/en/setup), then run `claude --version`.
* Create an active API key in the [RunBridge AI dashboard](https://runbridge.ai/console/token).
* Choose an exact Claude [model ID](/overview/models) that supports **Anthropic Messages, streaming, and tool calling**. Replace `your-claude-model-id` in every setting below.

The official installer for macOS, Linux, and WSL is:

```bash theme={null}
curl -fsSL https://claude.ai/install.sh | bash
claude --version
```

For Windows and alternate installation methods, follow the official setup guide.

## Configure the endpoint and credential

Run this in the Bash or Zsh terminal that will launch Claude Code:

```bash theme={null}
printf 'RunBridge AI API key: '
read -rs RUNBRIDGE_API_KEY
printf '\n'
export RUNBRIDGE_API_KEY
export ANTHROPIC_AUTH_TOKEN="$RUNBRIDGE_API_KEY"
export ANTHROPIC_BASE_URL="https://api.runbridge.ai"
export ANTHROPIC_MODEL="your-claude-model-id"
export ANTHROPIC_DEFAULT_OPUS_MODEL="your-claude-model-id"
export ANTHROPIC_DEFAULT_SONNET_MODEL="your-claude-model-id"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="your-claude-model-id"
claude
```

`ANTHROPIC_AUTH_TOKEN` sends `Authorization: Bearer ...`. Set the base URL to the API **origin**, without `/v1` or `/messages`; the client builds `/v1/messages`.

All three model aliases above deliberately use the same accessible model for the first connection. To use separate models for Opus, Sonnet, and Haiku tasks, replace each value with the corresponding supported RunBridge AI model ID. Mapping Haiku to a larger model can increase the cost of background tasks.

### Persistent settings and Windows

For an editor extension or a process that does not inherit terminal variables, merge this into your personal `~/.claude/settings.json` (Windows: `%USERPROFILE%\.claude\settings.json`):

```json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.runbridge.ai",
    "ANTHROPIC_AUTH_TOKEN": "your-runbridge-api-key",
    "ANTHROPIC_MODEL": "your-claude-model-id",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "your-claude-model-id",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "your-claude-model-id",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "your-claude-model-id"
  }
}
```

Enter your actual key only in the private local file and restrict file access to your user. Keep credentials out of a shared project's `.claude/settings.json`. For the Claude Desktop app, follow its separate [gateway setup instructions](https://code.claude.com/docs/en/llm-gateway-connect#desktop-app); terminal exports alone do not configure that app.

## Verify the connection

1. Start Claude Code and run `/status`.
2. Confirm **Anthropic base URL** is `https://api.runbridge.ai` and the credential source is `ANTHROPIC_AUTH_TOKEN`.
3. Confirm your chosen model, then ask: **Reply with “RunBridge connected” without using tools or changing files.**
4. Check the request in your RunBridge AI usage records. Verify tool calling separately in a disposable project before working on real code.

## Troubleshooting

| Symptom | Check |
| - | - |
| A claude.ai login is still the active credential | Check `/status`, set the gateway token in the process or settings used by this surface, and restart. See the official guide for credential conflicts. |
| 401 | Check the RunBridge AI key and whether an old `ANTHROPIC_API_KEY` conflicts with the intended bearer token configuration. |
| 404 | Use `https://api.runbridge.ai` as the base URL; do not append `/v1/messages`. |
| Model not found, including a background task | Verify every configured model ID and the Opus/Sonnet/Haiku alias mappings. |
| Unsupported feature or beta header | Check the model and gateway's support for the requested Claude Code feature; Messages compatibility does not imply all Anthropic platform features are available. |

See the official [gateway connection guide](https://code.claude.com/docs/en/llm-gateway-connect) and [model configuration](https://code.claude.com/docs/en/model-config) for supported settings.

<script type="application/ld+json">
  {`
    {
    "@context": "https://schema.org",
    "@type": "TechArticle",
    "headline": "Use Claude Code with RunBridge AI",
    "description": "Connect Claude Code to the Anthropic Messages API with a RunBridge AI gateway credential.",
    "url": "https://runbridge.mintlify.site/integrations/claude-code",
    "inLanguage": "en",
    "publisher": {
      "@type": "Organization",
      "name": "RunBridge AI"
    }
    }
    `}
</script>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.