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

> The three Edgee compression strategies, tuned for Codex. Each strategy is independently toggleable.

<img src="https://mintcdn.com/edgee/3uBZ-4NXtWlAewgx/images/banner-codex-compression.png?fit=max&auto=format&n=3uBZ-4NXtWlAewgx&q=85&s=16f61d6e5ea7af4deb907fcda4c55ded" alt="Codex compression" width="1312" height="455" data-path="images/banner-codex-compression.png" />

**Codex Compression** is the Edgee compression bundle tuned for Codex traffic — the three named strategies described in [Token Compression](/features/token-compression), pre-configured for the OpenAI Responses wire format that Codex uses.

You choose which strategies to enable. The CLI turns on a sensible default; the Console lets you toggle each one per API key.

| Strategy         | What it does for Codex                                                                                      | Default   | Customer-traffic average |
| ---------------- | ----------------------------------------------------------------------------------------------------------- | --------- | ------------------------ |
| **Tool Result**  | Trims tool-call outputs (file reads, shell commands, search results) before they reach the model. Lossless. | ✅ on      | **−19%**                 |
| **Tool Surface** | Drops MCP servers irrelevant to the current task via a virtual MCP that routes to the correct server.       | ⚠️ opt-in | **\~−25%** projected     |
| **Output**       | Reduces verbosity of model responses without losing technical content. Same answer, fewer tokens.           | ⚪ opt-in  | **−6.5%** when enabled   |

Per-strategy averages don't aggregate — they're measured on different baselines. Customer aggregate token-bill reduction across active customers (rolling 30 days) sits at approximately **20%**, with zero measurable drift on SWE-Bench Verified samples.

## Tool Result Trimming

`tool_result_trimming` filters the tool-call outputs Codex receives — file reads, shell commands, search results — before they reach the model. Lossless on tool-result payloads. User messages and assistant turns are not modified.

→ Full strategy reference: [Token Compression / Tool Result Trimming](/features/token-compression#tool-result-trimming).

## Tool Surface Reduction

Edgee creates a **virtual MCP server** that Codex sees. The virtual MCP classifies the user's task and searches for the correct real MCP server to use. It sends the result back to the client, which then executes the real MCP server. The IDE still exposes everything; nothing changes for the developer's setup.

→ Full strategy reference: [Token Compression / Tool Surface Reduction](/features/token-compression#tool-surface-reduction).

## Output Brevity

`output_brevity` reduces the verbosity of Codex's responses. Three strategies are available (`light`, `medium`, `hard`). Off by default for Codex sessions because output is a small share (\~1%) of total volume — turn it on if your Codex workflow leans heavy on long-form responses.

→ Full strategy reference: [Token Compression / Output Brevity](/features/token-compression#output-brevity).

## Receipts

> **−49.5%** fresh input tokens (1.14M → 574K per session). **−35.6%** total session cost ($4.00 → $2.58). Cache hit rate **76% → 85%**.
>
> Source: [`edgee-ai/compression-lab`](https://github.com/edgee-ai/compression-lab) · [Stop paying Codex to re-read context](https://www.edgee.ai/blog/posts/stop-paying-codex-to-re-read-context)

## Get started

```bash theme={"dark"}
edgee launch codex
```

If the Edgee CLI isn't installed yet:

<Tabs>
  <Tab title="macOS / Linux">
    ```bash theme={"dark"}
    curl -fsSL https://install.edgee.ai | bash
    ```
  </Tab>

  <Tab title="Homebrew">
    ```bash theme={"dark"}
    brew install edgee-ai/tap/edgee
    ```
  </Tab>

  <Tab title="Windows (PowerShell)">
    ```powershell theme={"dark"}
    irm https://install.edgee.ai/install.ps1 | iex
    ```
  </Tab>
</Tabs>

After your session, the CLI prints a link to view per-strategy savings in the Edgee Console.

<Card title="CLI guide" icon="terminal" href="/features/cli">
  Install, authenticate, and launch Codex in under a minute.
</Card>

## Codex-specific: OpenAI Responses wire format

Codex uses the OpenAI `responses` wire API. When routing through Edgee, the CLI automatically sets the correct provider config in `~/.codex/config.toml`:

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

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

This is handled automatically by `edgee launch codex`. You never need to edit this file manually.

## Toggling individual strategies

In the [Edgee Console](https://www.edgee.ai), open **Dashboard** and manage your Codex's settings right from the UI.

* Enable `tool_surface_reduction` to opt into the tool-surface compression.
* Enable `output_brevity` if your Codex workflow produces long-form output worth tightening.
* Disable `tool_result_trimming` only when you want to compare against an uncompressed baseline.

For team-managed keys, the same toggles are available per-member from **Team management → agent settings**. See [Team management](/features/team).

<Accordion title="Manual setup (advanced)">
  To configure Codex without the CLI, paste the config above into `~/.codex/config.toml` and replace `<YOUR_EDGEE_API_KEY>` with your key from the [Edgee Console](https://www.edgee.ai). Then enable the strategies you want from the **Edge Models** section.
</Accordion>

## Lossiness

`tool_result_trimming` is lossless on tool-result payloads. `tool_surface_reduction` is lossless on the model's perspective: Codex still sees the virtual MCP that can route to any real MCP server. `output_brevity` is **not** lossless on the prose dimension — it intentionally compresses prose verbosity. Across active customers (rolling 30 days), aggregate token bills are reduced by approximately **20%** with zero measurable drift on SWE-Bench Verified samples.

## Next

<CardGroup cols={2}>
  <Card title="Token Compression" icon="archive" iconType="duotone" href="/features/token-compression">
    Deep dive on each strategy.
  </Card>

  <Card title="Claude Code Compression" icon="https://mintcdn.com/edgee/RmPUqoqJw-u0FxFP/images/icons/claude.svg?fit=max&auto=format&n=RmPUqoqJw-u0FxFP&q=85&s=d3154991b618d253ee22ffaf55a433fc" iconType="duotone" href="/features/claude-compression" width="128" height="128" data-path="images/icons/claude.svg">
    Same three strategies, tuned for Claude Code.
  </Card>
</CardGroup>

<EdgeeSdk />
