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

# Crush

> Route Charm's Crush through Edgee to cut token costs and gain full observability, with one command.

Crush is Charm's terminal coding agent. Route it through Edgee to reduce token costs with lossless compression and gain full observability over every session.

## Edgee CLI setup (recommended)

The fastest way to connect Crush to Edgee is the CLI. It authenticates, merges an Edgee provider into your Crush config (populated from the live Edgee model catalog), and starts Crush, no config file to edit by hand.

<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 Crush through Edgee">
    ```bash theme={"dark"}
    edgee launch crush
    ```

    The CLI authenticates, adds the `edgee` provider, and starts Crush. Token compression is enabled automatically. Pick an Edgee model from Crush's model picker.

    <Note>
      Crush must already be installed. See the [Crush repository](https://github.com/charmbracelet/crush) for install instructions.
    </Note>
  </Step>
</Steps>

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

### Model context windows and pricing

Each model the CLI writes into the `edgee` provider carries its context window and its per-million-token rates, read from the Edgee model catalog:

```json theme={"dark"}
{
  "id": "anthropic/claude-sonnet-4-5",
  "name": "anthropic/claude-sonnet-4-5",
  "context_window": 1000000,
  "cost_per_1m_in": 3,
  "cost_per_1m_out": 15,
  "cost_per_1m_in_cached": 3.75,
  "cost_per_1m_out_cached": 0.3
}
```

Those are Claude Sonnet 4.5's catalog values: a 1M context window, $3 and $15 per million input and output tokens, $3.75 per million cache-write tokens, $0.30 per million cached-read tokens.

Why it matters: Crush reads a `context_window` of `0` as "unknown". It hides the header's context gauge and skips auto-summarizing, to avoid truncating a custom model it knows nothing about. Declaring the real window turns both back on. Without the rate fields, every session reports as free.

Details on what the CLI emits:

* `context_window` comes from the catalog. When a model is served by several LLM providers with different windows, the value is the author's own provider entry, or the smallest declared window when the author doesn't serve it — overstating the window makes Crush summarize too late and the request gets rejected.
* The two cache fields are named the opposite of their meaning in Crush: it costs cache-*creation* tokens at `cost_per_1m_in_cached` and cache-*read* tokens at `cost_per_1m_out_cached`. The CLI follows Crush's convention, matching [catwalk](https://github.com/charmbracelet/catwalk)'s own catalog entries.
* `default_max_tokens` is not emitted. Crush drops `max_tokens` from the request when it is `0`, deferring to the upstream cap, and the catalog carries no output-token cap to put there.
* A model that is genuinely free gets zeroed rates rather than omitted ones.
* Models the catalog has no entry for keep working; they just ship without a window or rates. The fetch is best-effort — if it fails, launch continues with no declared metadata.

## Manual setup (advanced)

Prefer to configure Crush yourself? Add an OpenAI-compatible provider pointed at Edgee to your global `crush.json` (`~/.config/crush/crush.json`):

```json theme={"dark"}
{
  "$schema": "https://charm.land/crush.json",
  "providers": {
    "edgee": {
      "id": "edgee",
      "name": "Edgee",
      "type": "openai-compat",
      "base_url": "https://edgee.io/v1",
      "api_key": "<YOUR_EDGEE_API_KEY>",
      "extra_headers": {
        "x-edgee-api-key": "<YOUR_EDGEE_API_KEY>"
      },
      "discover_models": true
    }
  }
}
```

<Note>
  Replace `<YOUR_EDGEE_API_KEY>` with your actual Edgee API key from the [Edgee Console](https://www.edgee.ai). With `discover_models` enabled, Crush populates its model picker from the Edgee catalog.
</Note>

Discovery gives Crush the model ids and nothing else: the gateway's `/v1/models` listing carries no context window and no pricing. To get the context gauge, auto-summarizing, and real session costs, declare the models yourself instead of relying on `discover_models`:

```json theme={"dark"}
{
  "providers": {
    "edgee": {
      "id": "edgee",
      "name": "Edgee",
      "type": "openai-compat",
      "base_url": "https://edgee.io/v1",
      "api_key": "<YOUR_EDGEE_API_KEY>",
      "models": [
        {
          "id": "anthropic/claude-sonnet-4-5",
          "name": "claude sonnet 4.5 (edgee)",
          "context_window": 1000000,
          "cost_per_1m_in": 3,
          "cost_per_1m_out": 15,
          "cost_per_1m_in_cached": 3.75,
          "cost_per_1m_out_cached": 0.3
        }
      ]
    }
  }
}
```

Watch the cache field names: the write rate goes under `cost_per_1m_in_cached` and the read rate under `cost_per_1m_out_cached`, per Crush's own convention. `edgee launch crush` does this for you from the live catalog.

## Benefits

<CardGroup cols={2}>
  <Card title="Cost reduction" icon="dollar-sign">
    Edgee's token compression reduces the tokens sent to and from the model, with no change to output quality.
  </Card>

  <Card title="Observability" icon="chart-line">
    Every request is logged in the Edgee Console with token counts, latency, and cost breakdowns.
  </Card>

  <Card title="Reliability" icon="shield-check">
    Automatic retry and fallback across providers keeps your sessions running even when a provider has issues.
  </Card>

  <Card title="One command" icon="terminal">
    No config to edit, the CLI wires everything up.
  </Card>
</CardGroup>

## Next Steps

* Learn more about the [Edgee CLI](/docs/features/cli) and its launch commands
* Set up [observability](/docs/features/observability) to monitor usage and costs
* Explore [retry and fallback](/docs/features/retry-and-fallback) for resilient routing
