> ## 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 **cut token costs by 15-20%** with lossless compression,
and gain **full observability** over every coding session. (Our SWE-bench Lite benchmark measures 50% with all
three strategies on: see [what you'll actually save](/docs/features/token-compression#what-youll-actually-save).)

Edgee works with your existing Claude subscription, including Claude Pro, Premium, and Max.

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

        # Accept the alias prompt (recommended).
        # If skipped: edgee alias
        # Reopen your terminal afterward.
        ```
      </Tab>

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

        # Enable aliases (recommended).
        edgee alias
        # Reopen your terminal afterward.
        ```
      </Tab>

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

        # Enable aliases (recommended).
        edgee alias
        # Reopen your terminal afterward.
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Launch Claude Code through Edgee">
    Choose how you want to launch. Both options route requests through Edgee.

    <Tabs>
      <Tab title="With aliases (recommended)">
        With aliases installed in the previous step, use your usual command:

        ```bash theme={"dark"}
        claude
        ```

        The alias runs `edgee launch` for you, so requests go through Edgee.
      </Tab>

      <Tab title="Without aliases">
        Launch explicitly through Edgee each time:

        ```bash theme={"dark"}
        edgee launch claude
        ```

        No alias setup is required.
      </Tab>
    </Tabs>

    If you are not signed in, Edgee starts sign-in automatically at launch. Follow the prompts and select your organization when asked.

    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)

### Get your coding-agent key

Manual setup uses the key of your enrolled **Claude Code** agent, **not a standard API key** created for LLM Router applications.

1. Open the [Edgee Console](https://www.edgee.ai) and select your organization.
2. In the header, click **Set up coding agent** or **+**, select **Claude Code**, and click **Enroll**. If your agent is already enrolled, use its existing icon.
3. Click the agent's icon, then **Advanced settings → Advanced**.
4. Under **Edgee API key (for manual setup)**, click **Reveal key**, then the copy icon.

Use this key wherever the configuration below shows `<YOUR_CODING_AGENT_KEY>`.

### Configure Claude Code

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://edgee.io"
export ANTHROPIC_CUSTOM_HEADERS="x-edgee-api-key:<YOUR_CODING_AGENT_KEY>"
```

<Note>
  Replace `<YOUR_CODING_AGENT_KEY>` with the coding-agent key copied above.
</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://edgee.io",
    "ANTHROPIC_CUSTOM_HEADERS": "x-edgee-api-key:<YOUR_CODING_AGENT_KEY>"
  }
}
```

<Note>
  Replace `<YOUR_CODING_AGENT_KEY>` with the coding-agent key copied above.
</Note>

## Usage

Keep launching through Edgee so the request uses your configured gateway:

```bash theme={"dark"}
edgee launch claude "Explain this repository"
```

Arguments after the agent name are forwarded to the installed agent. Use that agent's current help for its supported flags. A bare `claude` command routes through Edgee only if you have installed an [alias](/docs/cli/aliases).

## Verify the connection

Send one request from the configured client, then open **Logs** in the same Edgee organization. Check the served model, provider, and key. For a CLI-launched coding agent, also inspect its session report.

If the request is missing, check that you launched through Edgee or saved the client’s gateway URL and coding-agent key. If it appears with an error, inspect the error before changing settings. See [Troubleshooting](/docs/troubleshooting) and [Gateway errors](/docs/llm-router/api-reference/errors).
