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 Guidearrow-up-right for more details.

Installation

Install Claude Code globally using npm:

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:

vim ~/.claude/settings.json
  1. Add the following configuration, replacing the values with your own AI Gateway information:

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

Send a single prompt directly

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

Last updated