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

# Claude Code

> Use Edgee with Claude Code to cut token costs and extend sessions, with zero manual configuration.

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 50%** with lossless compression,
and gain **full observability** over every coding session.

## Edgee CLI setup (recommended)

The fastest way to connect Claude Code to Edgee is through the CLI, no manual API key setup or environment variables needed.

<Steps>
  <Step title="Install the Edgee CLI">
    <Tabs>
      <Tab title="macOS / Linux">
        ```bash theme={"dark"}
        curl -fsSL https://edgee.ai/install.sh | bash
        ```
      </Tab>

      <Tab title="Homebrew (macOS)">
        ```bash theme={"dark"}
        brew install edgee-ai/tap/edgee
        ```
      </Tab>

      <Tab title="Windows (PowerShell)">
        ```powershell theme={"dark"}
        irm https://edgee.ai/install.ps1 | iex
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Launch Claude Code through Edgee">
    ```bash theme={"dark"}
    edgee launch claude
    ```

    The CLI authenticates, configures routing, and starts Claude Code, all in one command. Token compression is enabled automatically.
  </Step>
</Steps>

After the session ends, the CLI prints a link to view token usage, compression savings, and cost breakdown in the Edgee Console.

## Manual setup (advanced)

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

Set the following environment variables in your shell configuration (`~/.bashrc`, `~/.zshrc`, etc.):

```bash theme={"dark"}
export ANTHROPIC_BASE_URL="https://api.edgee.ai"
export ANTHROPIC_CUSTOM_HEADERS="x-edgee-api-key:<YOUR_EDGEE_API_KEY>"
```

<Note>
  Replace `<YOUR_EDGEE_API_KEY>` with your actual Edgee API key from the [Edgee Console](https://www.edgee.ai).
</Note>

Then restart your terminal or run:

```bash theme={"dark"}
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`:

```json theme={"dark"}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.edgee.ai",
    "ANTHROPIC_CUSTOM_HEADERS": "x-edgee-api-key:<YOUR_EDGEE_API_KEY>"
  }
}
```

<Note>
  Replace `<YOUR_EDGEE_API_KEY>` with your actual Edgee API key from the [Edgee Console](https://www.edgee.ai).
</Note>

## Usage

Once launched, use Claude Code normally, compression is transparent:

```bash theme={"dark"}
# 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"

# Resume a previous session
edgee launch claude --resume
```

## Benefits

<CardGroup cols={2}>
  <Card title="Automatic Cost Reduction" icon="dollar-sign">
    If you are using API billing, you will see a significant reduction in your token costs by up to 50%.
  </Card>

  <Card title="Longer Sessions with the Same Token Budget" icon="chart-line">
    If you are using Claude Pro/Max, enjoy sessions up to 35% longer with the same token budget.
  </Card>
</CardGroup>
