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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/welcome/ai-gateway/ai-gateway-integration/claude-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
