Set up with the Headroom app
- Install OpenCode if you have not yet. Headroom only offers the connector once it detects OpenCode.
- Install Headroom for macOS, Windows, or Linux and open it once.
- Turn on the OpenCode connector in the app.
- 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
baseURLof theanthropicandopenaiproviders points at Headroom's proxy on127.0.0.1:6767. A base URL you already set yourself is left alone. - A transport plugin is added to the config's
pluginlist. 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(oropencode.jsoncif 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.