Privacy-first analytics pixel
Headroom logo Headroom

Headroom for OpenCode: how to set it up

OpenCode sends the same kind of bulky context to the model as Claude Code does: file reads, terminal output, and the whole conversation on every turn. Headroom compresses that context locally before it leaves your machine. There are two ways to connect them: the connector in the Headroom desktop app, or headroom wrap opencode from the open-source CLI.

Set up with the Headroom app

  1. Install OpenCode if you have not yet. Headroom only offers the connector once it detects OpenCode.
  2. Install Headroom for macOS, Windows, or Linux and open it once.
  3. Turn on the OpenCode connector in the app.
  4. Restart OpenCode so it reads the updated configuration, then run a normal task. Its requests appear in Headroom's activity view.

If OpenCode is missing from the connector list, Headroom did not detect it: install OpenCode and restart Headroom.

What the connector changes

Everything happens in OpenCode's own config file, with no environment variables or shell profile edits:

  • The baseURL of the anthropic and openai providers points at Headroom's proxy on 127.0.0.1:6767. A base URL you already set yourself is left alone.
  • A transport plugin is added to the config's plugin list. It routes every other provider through the proxy as well, so their traffic shows up in the activity view, although only Anthropic and OpenAI requests are compressed.
  • The file is ~/.config/opencode/opencode.json (or opencode.jsonc if that exists) on macOS and Linux, and %APPDATA%\opencode\ on Windows.

A project-level opencode.json can override these settings for that project. Turning the connector off, quitting Headroom, or uninstalling it restores your previous configuration.

Set up with the open-source CLI

The Headroom CLI has its own OpenCode integration. With Python 3.10 or newer:

pip install "headroom-ai[all]"
headroom wrap opencode

wrap starts a proxy and points OpenCode at it for that session. You keep the process running yourself and update it with pip install -U headroom-ai; the install guide covers the trade-offs. Use one route or the other, not both: the app removes the CLI's provider block when you turn its connector on.

What to expect

The compression is the same engine that runs for Claude Code and ChatGPT Codex: about 50% fewer tokens on the noisy items it compresses, typically 40-50% across a session, with originals kept on your machine so the model can retrieve them. Sessions heavy on logs, test output, and large file reads gain the most. Because the connector is experimental, a few features that work for Claude Code are not available for OpenCode yet, such as the Serena add-on and the warning Headroom shows when routing breaks.

For background on where the tokens go, see why Claude Code is so expensive; the same patterns apply to OpenCode. What is Headroom? covers the rest of the app.

Try it on an OpenCode session

Install Headroom, turn on the OpenCode connector, and run a task you already do. The first 7 days are free, with no credit card.

Download for free

7-day free trial · no credit card required

Not ready to install yet?

Leave your email and we'll send a one-page summary of the benchmarks, plus a note when big updates ship. No drip campaign.