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

# CodeBuddy

> Route CodeBuddy through Edgee to cut token costs and gain full observability, with one command.

CodeBuddy is a CLI 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 CodeBuddy to Edgee is the CLI, no environment variables to set 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 CodeBuddy through Edgee">
    ```bash theme={"dark"}
    edgee launch codebuddy
    ```

    The CLI authenticates, configures routing, and starts CodeBuddy, all in one command. Token compression is enabled automatically.

    <Note>
      CodeBuddy must already be installed. See the [CodeBuddy repository](https://cnb.cool/codebuddy/codebuddy-code) 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.

## Manual setup (advanced)

CodeBuddy reads its endpoint and headers from environment variables. Set the following in your shell configuration (`~/.bashrc`, `~/.zshrc`, etc.):

```bash theme={"dark"}
export CODEBUDDY_BASE_URL="https://edgee.io/v1"
export CODEBUDDY_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>

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