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

**1. Install the Edgee CLI**

> [tab] 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] Homebrew (macOS)
>
> ```bash theme={"dark"}
> brew install edgee-ai/tap/edgee
>
> # Enable aliases (recommended).
> edgee alias
> # Reopen your terminal afterward.
> ```

> [tab] Windows (PowerShell)
>
> ```powershell theme={"dark"}
> irm https://edgee.ai/install.ps1 | iex
>
> # Enable aliases (recommended).
> edgee alias
> # Reopen your terminal afterward.
> ```

**2. Launch CodeBuddy through Edgee**

Choose how you want to launch. Both options route requests through Edgee.

> [tab] With aliases (recommended)
>
> With aliases installed in the previous step, use your usual command:
>
> ```bash theme={"dark"}
> codebuddy
> ```
>
> The alias runs `edgee launch` for you, so requests go through Edgee.

> [tab] Without aliases
>
> Launch explicitly through Edgee each time:
>
> ```bash theme={"dark"}
> edgee launch codebuddy
> ```
>
> No alias setup is required.

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

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 **CodeBuddy** 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 **CodeBuddy**, 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 CodeBuddy

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_CODING_AGENT_KEY>"
```

> [!NOTE]
>
> Replace `<YOUR_CODING_AGENT_KEY>` with the coding-agent key copied above.

## Next Steps

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

## 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](https://www.edgee.ai/docs/troubleshooting.md) and [Gateway errors](https://www.edgee.ai/docs/llm-router/api-reference/errors.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.