Skip to main content
Claude token compression Claude Token Compression reduces token costs in Claude conversations by compressing tool call results — the large outputs from file reads, shell commands, search results, and other tools — before they reach Anthropic models. Unlike Agentic compression, it is fully lossless: no information is lost, and no quality configuration is needed. For Claude Code users, this means lower costs when using API billing (up to 30% reduction), and longer sessions for Pro/Max subscribers (up to 35% longer): the same token budget goes further.

What Gets Compressed

Claude Token Compression targets tool_result messages in Claude API format. This includes:
  • File contents: output from Read tool and file system operations
  • Grep and search outputs: results from code search, ripgrep, and similar tools
  • Shell command output: stdout/stderr from Bash and terminal commands
  • API responses: large JSON or text payloads returned by tool calls
  • Database query results: rows and records returned from tool-executed queries
User messages and assistant turns are not modified, only tool results are compressed.

How to Enable

In the Edge Models section of your console, find the Claude Token Compression card and simply select which API keys should use Claude compression.
Enable compression for specific API keys
Claude Token Compression can also be enabled at API key creation time.
There are no compression ratio or BERT threshold settings. Claude Token Compression is fully lossless by design. Just enable it and go.

Integration with 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

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.

Benefits of Using Claude Code with Edgee

Once you have configured Edgee for Claude Code, you can start using Claude Code normally. You will immediately see the savings by going to the console, on the dashboard or in the logs. See Claude Code integration for more instructions.