Skip to main content
Claude Code is Anthropic’s official CLI tool for interactive coding with AI assistance. Route your Claude Code traffic through Edgee to reduce token costs by up to 30% with intelligent compression and gain full observability over every coding session. Edgee’s OpenAI-compatible API works seamlessly with Claude Code, set up once, save automatically.

Configuration

Claude Code supports custom API endpoints through its settings. You can configure it to use Edgee as your AI provider in two ways:

Option 1: Environment Variables

The configuration differs depending on whether you’re using Claude Pro/Max or API billing:

For Claude Pro/Max Users

Set the following environment variables in your shell configuration (~/.bashrc, ~/.zshrc, etc.):
export ANTHROPIC_BASE_URL="https://api.edgee.ai"
export ANTHROPIC_CUSTOM_HEADERS="x-edgee-api-key:<YOUR_EDGEE_API_KEY>"
Replace <YOUR_EDGEE_API_KEY> with your actual Edgee API key from the Edgee Console.

For API Billing Users

Set the following environment variables in your shell configuration (~/.bashrc, ~/.zshrc, etc.):
export ANTHROPIC_BASE_URL="https://api.edgee.ai"
export ANTHROPIC_AUTH_TOKEN="<YOUR_EDGEE_API_KEY>"
export ANTHROPIC_API_KEY=""
Replace <YOUR_EDGEE_API_KEY> with your actual Edgee API key from the Edgee Console.
Then restart your terminal or run:
source ~/.zshrc  # or ~/.bashrc

Option 2: Claude Code Settings

You can also configure Claude Code through its settings file. Create or edit ~/.claude/settings.json:

For Claude Pro/Max Users

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.edgee.ai",
    "ANTHROPIC_CUSTOM_HEADERS": "x-edgee-api-key:<YOUR_EDGEE_API_KEY>"
  }
}
Replace <YOUR_EDGEE_API_KEY> with your actual Edgee API key from the Edgee Console.

For API Billing Users

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.edgee.ai",
    "ANTHROPIC_AUTH_TOKEN": "<YOUR_EDGEE_API_KEY>",
    "ANTHROPIC_API_KEY": ""
  }
}
Replace <YOUR_EDGEE_API_KEY> with your actual Edgee API key from the Edgee Console.

Usage

Once configured, Claude Code will automatically route all requests through Edgee. You can use Claude Code normally:
# Start an interactive session
claude

# Ask a question directly
claude "How do I implement a binary search tree in Python?"

# Work on a specific file
claude --file src/main.py "Add error handling to this code"

Enable Token Compression for Claude Code

Claude Token Compression provides fully lossless compression of tool call results, file reads, search outputs, command output, and more. No information is lost, so your coding sessions behave exactly as they would without compression, but at a lower token cost. How to enable:
  1. Go to Edge Models in the Edgee Console.
  2. Find the Claude Token Compression card.
  3. Select which API keys to enable it for.
Enable compression for specific API keys
No additional configuration is needed. Claude Token Compression is fully lossless by design. Once enabled on an API key, it works automatically on every request.

Benefits of Using Claude Code with Edgee

Automatic Cost Reduction

If you are using API billing, you will see a significant reduction in your token costs by up to 30%.

Longer Sessions with the Same Token Budget

If you are using Claude Pro/Max, Claude Code lets you enjoy sessions up to 35% longer with the same token budget.