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

# Codex

> Use Edgee with Codex to cut token costs and extend sessions, with zero manual configuration.

[Codex](https://github.com/openai/codex) is OpenAI's open-source CLI coding agent.
Route your Codex traffic through Edgee to **reduce token costs by up to 50%** with lossless compression,
and gain **full observability** over every coding session.

## Edgee CLI setup (recommended)

The fastest way to connect Codex to Edgee is through the CLI, no config files to edit manually.

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

    The CLI authenticates, writes the Codex config, and starts Codex, 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)

If you prefer to configure Codex without the CLI, update your Codex configuration file at `~/.codex/config.toml`:

```toml theme={"dark"}
model_provider = "edgee"

[model_providers.edgee]
name = "EDGEE"
base_url = "https://api.edgee.ai/v1"
http_headers = { "x-edgee-api-key" = "<YOUR_EDGEE_API_KEY>" }
wire_api = "responses"
```

<Note>
  Replace `<YOUR_EDGEE_API_KEY>` with your actual Edgee API key from the [Edgee Console](https://www.edgee.ai).
  You'll also need to enable Codex Token Compression on that key from the **Dashboard** section.
</Note>

## Usage

Once launched, use Codex normally, compression is transparent:

```bash theme={"dark"}
# Ask a question directly
codex "How do I implement a binary search tree in Python?"

# Run in full-auto mode
codex --approval-mode full-auto "Refactor this module to use async/await"

# Resume a previous session
edgee launch codex --resume
```

## Benefits

<CardGroup cols={2}>
  <Card title="Automatic Cost Reduction" icon="dollar-sign">
    If you are using API billing, you will see a significant reduction in your token costs by up to 50%.
  </Card>

  <Card title="More Work Per Session" icon="chart-line">
    Compression makes the effective context window stretch further, so Codex can tackle larger tasks before hitting limits.
  </Card>
</CardGroup>
