> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/welcome/ai-gateway/ai-gateway-integration/claude-code.md).

# Claude Code

Integrating Claude Code with AI Gateway provides a unified and flexible way to access Claude models while simplifying configuration and usage.

You can view [**Help Guide**](https://code.claude.com/docs/en/overview) for more details.

## Installation

Install Claude Code globally using npm:

```bash
npm install -g @anthropic-ai/claude-code
```

Ensure that Node.js and npm are properly installed before proceeding.

## Configuration

Claude Code reads its runtime configuration from a local settings file.

1. Open (or create) the configuration file:

```bash
vim ~/.claude/settings.json
```

2. Add the following configuration, replacing the values with your own AI Gateway information:

```json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://gateway.theturbo.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-xxxxxxxxxxxxxx"
  }
}
```

* **ANTHROPIC\_BASE\_URL**\
  The Claude-compatible endpoint exposed by the AI Gateway.
* **ANTHROPIC\_AUTH\_TOKEN**\
  The API key generated when creating your AI Gateway instance.

## Usage

Once configured, Claude Code can be used in multiple ways:

**Start an interactive session**

```bash
claude
```

**Send a single prompt directly**

```bash
claude "Explain the difference between HTTP and HTTPS."
```

All requests will be routed through the AI Gateway, allowing centralized access control, logging, and model management.
