🤖 I have created a release *beep* *boop* --- ## [0.45.0](https://github.com/headroomlabs-ai/headroom/compare/v0.44.0...v0.45.0) (2026-11-22) ### Features * **opencode:** add repeatable --extra-model flag for custom wrap-time models ([#2364](https://github.com/headroomlabs-ai/headroom/issues/2364)) ([66e0086](https://github.com/headroomlabs-ai/headroom/commit/66e0086952d4b311c9fe9b489fbd12d1d270fcde)) * **savings:** book modelled output savings per request, as a token and dollar range ([#4878](https://github.com/headroomlabs-ai/headroom/issues/4878)) ([00436a8](https://github.com/headroomlabs-ai/headroom/commit/00436a8b11b69f19e280ba0ce3f54f50094e4a5e)) * **shaper:** let an extension replace a level's steering text; default to L3 ([#4877](https://github.com/headroomlabs-ai/headroom/issues/4877)) ([a3afd43](https://github.com/headroomlabs-ai/headroom/commit/a3afd43e0cbd3ed4b2186419bcc8ac447d110e39)) * **telemetry:** split beacon sessions by harness, model and day ([#4881](https://github.com/headroomlabs-ai/headroom/issues/4881)) ([ac932eb](https://github.com/headroomlabs-ai/headroom/commit/ac932eb7c43156e94088d21e6c1edf3dc14b233b)) * **tray:** opt-in system tray icon with savings counter, dashboard and update alert ([#4726](https://github.com/headroomlabs-ai/headroom/issues/4726)) ([e9301f3](https://github.com/headroomlabs-ai/headroom/commit/e9301f34c1296c1f1290ed590fe02cbfd991e3c1)) ### Bug Fixes * **benchmarks:** drop the duplicate protect_recent=0 table from the proof harness ([#4754](https://github.com/headroomlabs-ai/headroom/issues/4754)) ([a385ea8](https://github.com/headroomlabs-ai/headroom/commit/a385ea8e60a14c1511d82b21d518421af35deab2)) * **benchmarks:** refuse a dirty or non-git --worktree in codemode_ab ([#4736](https://github.com/headroomlabs-ai/headroom/issues/4736)) ([6b7b635](https://github.com/headroomlabs-ai/headroom/commit/6b7b6358d526a833631798ea1b073e941775d89f)) * **binaries:** ignore tool binaries found via the current directory ([#4838](https://github.com/headroomlabs-ai/headroom/issues/4838)) ([7a0f15f](https://github.com/headroomlabs-ai/headroom/commit/7a0f15f563d8a74e5496435c9f61fba9d72f3a0b)) * **cache:** exclude cold starts from TTL hit evidence ([#4728](https://github.com/headroomlabs-ai/headroom/issues/4728)) ([93df7ae](https://github.com/headroomlabs-ai/headroom/commit/93df7ae4f725da790823084dca0a8ab6467bfcfe)) * **cache:** preserve complete CCR hashes across restarts ([#4820](https://github.com/headroomlabs-ai/headroom/issues/4820)) ([e27f0d9](https://github.com/headroomlabs-ai/headroom/commit/e27f0d96cc3032d5f2c510ac97545553b867a697)) * **cache:** replay every parallel tool result ([#4818](https://github.com/headroomlabs-ai/headroom/issues/4818)) ([973c12d](https://github.com/headroomlabs-ai/headroom/commit/973c12d2af9cc6a9b021516d0c92edee12c10ecb)) * **cache:** scope learned TTL cache to its source file ([#4727](https://github.com/headroomlabs-ai/headroom/issues/4727)) ([acb58a0](https://github.com/headroomlabs-ai/headroom/commit/acb58a0c00c9972abb7044b6ff3aa1b4cfed8e64)) * **ccr:** send batch continuations to the upstream the batch was submitted to ([#4848](https://github.com/headroomlabs-ai/headroom/issues/4848)) ([5f82080](https://github.com/headroomlabs-ai/headroom/commit/5f82080329b41fa5dd556ed9c873d7d313f1a4f0)) * **ci:** keep alert rule and location out of the public CodeQL triage issue ([#4863](https://github.com/headroomlabs-ai/headroom/issues/4863)) ([047aadd](https://github.com/headroomlabs-ai/headroom/commit/047aadde868d38e27b5d6bc2d99dd21362fa0d53)) * **ci:** verify installer provenance in build workflows ([#4677](https://github.com/headroomlabs-ai/headroom/issues/4677)) ([b235bc2](https://github.com/headroomlabs-ai/headroom/commit/b235bc2d27f0b15b2c5a364f853d52ab0b3ea003)) * **compression:** bound the JSON-block and truncation-banner scans ([#4845](https://github.com/headroomlabs-ai/headroom/issues/4845)) ([bae62bc](https://github.com/headroomlabs-ai/headroom/commit/bae62bc87ba593df74f6a6109dc2317ba71b3216)) * **compress:** stop adding markers the caller did not ask for ([#4678](https://github.com/headroomlabs-ai/headroom/issues/4678)) ([c21b081](https://github.com/headroomlabs-ai/headroom/commit/c21b0813bd1b041b1e3ca1d55a07a9498e61f181)) * **content-router:** keep list-form tool_result text blocks on separate lines ([#4739](https://github.com/headroomlabs-ai/headroom/issues/4739)) ([f4e3ad4](https://github.com/headroomlabs-ai/headroom/commit/f4e3ad4b1168755ccb27bd151b684ee65cf2d86f)) * **content-router:** protect cache_control markers nested in tool_result content ([#4898](https://github.com/headroomlabs-ai/headroom/issues/4898)) ([18067b1](https://github.com/headroomlabs-ai/headroom/commit/18067b1d19f6606bae3b4d6b50efeeaa48dc477e)) * **copilot:** keep new VS Code chats on the Local harness so they reach the proxy ([#4899](https://github.com/headroomlabs-ai/headroom/issues/4899)) ([0d203db](https://github.com/headroomlabs-ai/headroom/commit/0d203db6b814e62773bb08aa79f0c036ab9323af)) * **deps:** move the wrap E2E harness to npm 12.2.2 and drop the fixed audit exceptions ([#4778](https://github.com/headroomlabs-ai/headroom/issues/4778)) ([f6fbac3](https://github.com/headroomlabs-ai/headroom/commit/f6fbac3a4975f62a296656fb15f1d3e72270c445)) * **deps:** patch quinn-udp, rustix and opentelemetry-api advisories ([#4835](https://github.com/headroomlabs-ai/headroom/issues/4835)) ([0368a87](https://github.com/headroomlabs-ai/headroom/commit/0368a872cdd5064b39888e13847200ff562ac192)) * **examples:** keep the macos launchagent running when reinstall is declined ([#4734](https://github.com/headroomlabs-ai/headroom/issues/4734)) ([02a2b56](https://github.com/headroomlabs-ai/headroom/commit/02a2b568d4526724c3d8a0a098c7fb601c6c9fbe)) * **examples:** validate the macos launchagent port as plain decimal ([#4733](https://github.com/headroomlabs-ai/headroom/issues/4733)) ([a91c48a](https://github.com/headroomlabs-ai/headroom/commit/a91c48a3a4f89bd3892b5db9d08c0697e1a356ca)) * **gemini:** apply the request rate limit to Cloud Code and countTokens ([#4862](https://github.com/headroomlabs-ai/headroom/issues/4862)) ([c2292ed](https://github.com/headroomlabs-ai/headroom/commit/c2292ed0c64679e4a67cccb096a93873c940032c)) * **kompress:** honour toin_read_only in the Kompress CCR store ([#4895](https://github.com/headroomlabs-ai/headroom/issues/4895)) ([8da7e17](https://github.com/headroomlabs-ai/headroom/commit/8da7e17e4e1c3636031fd9ee25cb061a317419c9)) * **learn:** only fold real linked worktrees into their main checkout ([#4839](https://github.com/headroomlabs-ai/headroom/issues/4839)) ([d2fb350](https://github.com/headroomlabs-ai/headroom/commit/d2fb350a3445d860e86f52739b5adfb24e73666c)) * **learn:** render non-string Bash commands without raising ([#4826](https://github.com/headroomlabs-ai/headroom/issues/4826)) ([cfdeb1c](https://github.com/headroomlabs-ai/headroom/commit/cfdeb1c4667edb1caa923bf0b8cfa4fd994c5c76)) * **lossless:** never grep-fold Go, nginx, klog or access-log timestamps ([#4901](https://github.com/headroomlabs-ai/headroom/issues/4901)) ([cf32846](https://github.com/headroomlabs-ai/headroom/commit/cf3284675eade1f4cee3358932d9c2f72562253f)) * **lossless:** never grep-fold Ruby Logger timestamps ([#4907](https://github.com/headroomlabs-ai/headroom/issues/4907)) ([4a94500](https://github.com/headroomlabs-ai/headroom/commit/4a945007817022c9f797d811f475dc1172522b97)) * **mcp:** check Host and Origin on the Streamable HTTP transport ([#4852](https://github.com/headroomlabs-ai/headroom/issues/4852)) ([70ba721](https://github.com/headroomlabs-ai/headroom/commit/70ba72138d6ab6862ac61494552c7dd71006cd5c)) * **memory:** dispatch the advertised memory_list tool ([#4830](https://github.com/headroomlabs-ai/headroom/issues/4830)) ([0d91550](https://github.com/headroomlabs-ai/headroom/commit/0d9155019febfb0237f115edb8c5cd5448cf6bcb)) * **memory:** include older memories in agent sync ([#4832](https://github.com/headroomlabs-ai/headroom/issues/4832)) ([a6a825c](https://github.com/headroomlabs-ai/headroom/commit/a6a825c55d665ef9c261bc627c30947a263133ec)) * **memory:** keep Neo4j relationship types to a single identifier ([#4837](https://github.com/headroomlabs-ai/headroom/issues/4837)) ([b0a8c00](https://github.com/headroomlabs-ai/headroom/commit/b0a8c000caade71df451b4c1976fe402e12a2a6a)) * **memory:** return stored id from a background DirectMem0 save ([#4759](https://github.com/headroomlabs-ai/headroom/issues/4759)) ([6665940](https://github.com/headroomlabs-ai/headroom/commit/6665940656bd7e1111e36ffd49f23c59615440de)) * **memory:** scope TrafficLearner's SQLite reads to its user_id ([#4850](https://github.com/headroomlabs-ai/headroom/issues/4850)) ([9321a41](https://github.com/headroomlabs-ai/headroom/commit/9321a415a6f976b5350329c009f569d7a3f201a7)) * **memory:** validate embedding dimensions before writes ([#4831](https://github.com/headroomlabs-ai/headroom/issues/4831)) ([cd6f438](https://github.com/headroomlabs-ai/headroom/commit/cd6f438fec0aa9495efa120585d24a3945a0a1b5)) * **oauth2:** stop following redirects from the token endpoint ([#4849](https://github.com/headroomlabs-ai/headroom/issues/4849)) ([02dfdd8](https://github.com/headroomlabs-ai/headroom/commit/02dfdd8f892543848d35c07de235d7610a71f52d)) * **openclaw:** keep the Python launcher fallback off the working directory ([#4843](https://github.com/headroomlabs-ai/headroom/issues/4843)) ([acebf20](https://github.com/headroomlabs-ai/headroom/commit/acebf20b47efa6a31acd78e9f742b022e03192fb)) * **openclaw:** let the circuit breaker open on proxy failures ([#4755](https://github.com/headroomlabs-ai/headroom/issues/4755)) ([1372f95](https://github.com/headroomlabs-ai/headroom/commit/1372f9552460c49dee0bd1fb58e9d79518f73d8c)) * **openclaw:** preserve assistant text blocks when tool arguments change ([#4829](https://github.com/headroomlabs-ai/headroom/issues/4829)) ([d077263](https://github.com/headroomlabs-ai/headroom/commit/d077263012e3cfa5113ea7ccee3ae9bd2dce594a)) * **openclaw:** return structured retrieval tool results ([#4707](https://github.com/headroomlabs-ai/headroom/issues/4707)) ([e6b5777](https://github.com/headroomlabs-ai/headroom/commit/e6b5777806c53206ddea08ccede317e3e92971c6)) * **opencode:** default options-form https.request calls to https ([#4749](https://github.com/headroomlabs-ai/headroom/issues/4749)) ([12b5fb7](https://github.com/headroomlabs-ai/headroom/commit/12b5fb7f2aaf031bd32ef3ba53a8ebad4401b987)) * **opencode:** do not break every request when the proxy URL is empty or invalid ([#4750](https://github.com/headroomlabs-ai/headroom/issues/4750)) ([318e8e0](https://github.com/headroomlabs-ai/headroom/commit/318e8e080848061dadb92d22c6accc6161c9063e)) * **opencode:** keep child process options when the args slot is null or undefined ([#4748](https://github.com/headroomlabs-ai/headroom/issues/4748)) ([9f2cc01](https://github.com/headroomlabs-ai/headroom/commit/9f2cc017863f540c61f8747b3c744a97776ebaf2)) * **opencode:** override effect to patched 4.0.0-beta.103 ([#4762](https://github.com/headroomlabs-ai/headroom/issues/4762)) ([19d439f](https://github.com/headroomlabs-ai/headroom/commit/19d439f7b0528846f96505203232841513f097d1)) * **opencode:** percent-encode the project name in x-headroom-project ([#4780](https://github.com/headroomlabs-ai/headroom/issues/4780)) ([863b3c7](https://github.com/headroomlabs-ai/headroom/commit/863b3c7cc7979e7293f797be0c4bd4ab25595844)) * **opencode:** stop routing a host's bare /messages or /responses to the proxy ([#4781](https://github.com/headroomlabs-ai/headroom/issues/4781)) ([#4791](https://github.com/headroomlabs-ai/headroom/issues/4791)) ([87c1293](https://github.com/headroomlabs-ai/headroom/commit/87c12931fbfecc62a8fad65eb2294cd95c417b2f)) * **opencode:** stop routing non-LLM hosts and paths to the proxy ([#4747](https://github.com/headroomlabs-ai/headroom/issues/4747)) ([#4758](https://github.com/headroomlabs-ai/headroom/issues/4758)) ([c48778c](https://github.com/headroomlabs-ai/headroom/commit/c48778c4ab6add83bc4d46bde9ba2c5bc11edbc3)) * **output-shaper:** don't add Responses instructions to a body already steered in input ([#4937](https://github.com/headroomlabs-ai/headroom/issues/4937)) ([3a8270b](https://github.com/headroomlabs-ai/headroom/commit/3a8270b836bc9ffa050eb7066a902ea936bc7ef2)) * **plugins:** keep the hook launcher's Python fallback off the project dir ([#4842](https://github.com/headroomlabs-ai/headroom/issues/4842)) ([c5d8f13](https://github.com/headroomlabs-ai/headroom/commit/c5d8f133606ffadbf4be8731dc1fed77e471f64f)) * **proxy:** bound brotli output per step and lossless inverse expansion ([#4861](https://github.com/headroomlabs-ai/headroom/issues/4861)) ([5503383](https://github.com/headroomlabs-ai/headroom/commit/5503383befa19ecbfdd65604ff7a36b5f45b9d15)) * **proxy:** check x-headroom-base-url off the event loop in chat and responses ([#4856](https://github.com/headroomlabs-ai/headroom/issues/4856)) ([2f58877](https://github.com/headroomlabs-ai/headroom/commit/2f58877732eaae2849ab3019c0867674733bc53d)) * **proxy:** clamp /transformations/feed limit to [1, 100] ([ec2ab21](https://github.com/headroomlabs-ai/headroom/commit/ec2ab21844ac7dfbadeea1a5636b12b1a4699e26)) * **proxy:** clamp /transformations/feed limit to [1, 100] ([#4934](https://github.com/headroomlabs-ai/headroom/issues/4934)) ([ec2ab21](https://github.com/headroomlabs-ai/headroom/commit/ec2ab21844ac7dfbadeea1a5636b12b1a4699e26)) * **proxy:** don't take Claude Code's "Tool loaded." note as the user query ([#4714](https://github.com/headroomlabs-ai/headroom/issues/4714)) ([dcd03b9](https://github.com/headroomlabs-ai/headroom/commit/dcd03b9b4c58340a5f4448fd4740045294e156f7)) * **proxy:** enforce HEADROOM_PROXY_TOKEN in the Rust front and listen on loopback by default ([#4840](https://github.com/headroomlabs-ai/headroom/issues/4840)) ([f5c4217](https://github.com/headroomlabs-ai/headroom/commit/f5c42176483a5e0fa3522fd1758a3cf3f65bb0a2)) * **proxy:** give the OpenAI Responses error frame its type discriminator ([#4331](https://github.com/headroomlabs-ai/headroom/issues/4331)) ([53a2521](https://github.com/headroomlabs-ai/headroom/commit/53a2521637ec6d71a5b53e11f5698ebef96d97b1)) * **proxy:** keep Copilot requests on Copilot when an extension advises another provider ([#4894](https://github.com/headroomlabs-ai/headroom/issues/4894)) ([998d710](https://github.com/headroomlabs-ai/headroom/commit/998d71080cb4ac8a8d6d6cd56c48c2c543443df5)) * **proxy:** keep credentials out of proxy logs and 400 debug dumps ([#4865](https://github.com/headroomlabs-ai/headroom/issues/4865)) ([dffc4dc](https://github.com/headroomlabs-ai/headroom/commit/dffc4dcc57c6e6308cee3965855a5c7b692ca053)) * **proxy:** keep hop-by-hop request headers off upstream calls ([#4775](https://github.com/headroomlabs-ai/headroom/issues/4775)) ([8f47a86](https://github.com/headroomlabs-ai/headroom/commit/8f47a8641055c89475806c2df825b70331d8ad36)) * **proxy:** keep relay tasks when the same WS handle re-registers ([#4904](https://github.com/headroomlabs-ai/headroom/issues/4904)) ([f4691e8](https://github.com/headroomlabs-ai/headroom/commit/f4691e8ab10a237255922e8d0dee66cd0db05191)) * **proxy:** keep reserved openai tool names resident during tool search deferral ([#4753](https://github.com/headroomlabs-ai/headroom/issues/4753)) ([62f2a2d](https://github.com/headroomlabs-ai/headroom/commit/62f2a2decd5848100582c4e3d7219861f97f104f)) * **proxy:** keep settings.json mode and symlink in the cc-switch reconciler ([#4844](https://github.com/headroomlabs-ai/headroom/issues/4844)) ([3bae009](https://github.com/headroomlabs-ai/headroom/commit/3bae009c3fd9c2a730b98830e642ecb312878002)) * **proxy:** keep upstream credentials out of manifests, env and TOIN ([#4866](https://github.com/headroomlabs-ai/headroom/issues/4866)) ([2e4ff6f](https://github.com/headroomlabs-ai/headroom/commit/2e4ff6f9c7ea2424278d8aecc791ac6dfb44a435)) * **proxy:** let an extension declare its install() fail-closed ([#4737](https://github.com/headroomlabs-ai/headroom/issues/4737)) ([#4773](https://github.com/headroomlabs-ai/headroom/issues/4773)) ([c05fbdd](https://github.com/headroomlabs-ai/headroom/commit/c05fbdddc873078dd97cb9ede841e75ef7ed0bef)) * **proxy:** log client-supplied model ids as one escaped token ([#4854](https://github.com/headroomlabs-ai/headroom/issues/4854)) ([b9f6255](https://github.com/headroomlabs-ai/headroom/commit/b9f62553950f59f7467abb8e2e9c1477fcf924fa)) * **proxy:** make the Rust front's native Bedrock and Vertex routes opt-in ([#4851](https://github.com/headroomlabs-ai/headroom/issues/4851)) ([99021af](https://github.com/headroomlabs-ai/headroom/commit/99021af20a87bd1885e62f3607c9a5f234010fc7)) * **proxy:** pin non-ASCII upstream hosts by A-label and resolve x-headroom-base-url once ([#4855](https://github.com/headroomlabs-ai/headroom/issues/4855)) ([904e56a](https://github.com/headroomlabs-ai/headroom/commit/904e56a35769b601d0bfdd386f9aca0f6110612d)) * **proxy:** refuse a private x-headroom-base-url on the async chat and responses path ([#4879](https://github.com/headroomlabs-ai/headroom/issues/4879)) ([5023c84](https://github.com/headroomlabs-ai/headroom/commit/5023c84e527e28281dd73d1ba04184fe738aac0f)) * **proxy:** refuse HTTP requests from untrusted browser origins ([#4853](https://github.com/headroomlabs-ai/headroom/issues/4853)) ([ab1d029](https://github.com/headroomlabs-ai/headroom/commit/ab1d0292df09dee1d97221d7e60fa0664fc9f0f9)) * **proxy:** reject a private x-headroom-base-url on chat and responses with 400 ([#4857](https://github.com/headroomlabs-ai/headroom/issues/4857)) ([491afe9](https://github.com/headroomlabs-ai/headroom/commit/491afe98b11ccd601e8b7586b608b2ef940ee692)) * **proxy:** resolve the forwarded client from the right and keep settings writes loopback-only ([#4847](https://github.com/headroomlabs-ai/headroom/issues/4847)) ([e15e342](https://github.com/headroomlabs-ai/headroom/commit/e15e342d9bc1a8a3831c952d05029352013b69e0)) * **proxy:** retain final backend streaming usage ([#4814](https://github.com/headroomlabs-ai/headroom/issues/4814)) ([93331f2](https://github.com/headroomlabs-ai/headroom/commit/93331f28742663d279b377da2fe41124de0a5a55)) * **proxy:** retry a TLS error only while the request is being written ([#4776](https://github.com/headroomlabs-ai/headroom/issues/4776)) ([854a696](https://github.com/headroomlabs-ai/headroom/commit/854a69654498089bdc36fa3dc0034024702d6332)) * **proxy:** send operator extra headers only to a designated origin ([#4858](https://github.com/headroomlabs-ai/headroom/issues/4858)) ([6d8121c](https://github.com/headroomlabs-ai/headroom/commit/6d8121cfd4362f21cbdff08aeb9eb4e90c05e2d2)) * **proxy:** stop a "*" origin setting from waiving the WebSocket Origin check ([#4846](https://github.com/headroomlabs-ai/headroom/issues/4846)) ([d9ae7ad](https://github.com/headroomlabs-ai/headroom/commit/d9ae7ad7219d19f32eec10d3dfd1ea2eb6331ff3)) * **proxy:** turn off the image stage when --compressor leaves out image ([#4723](https://github.com/headroomlabs-ai/headroom/issues/4723)) ([8f04221](https://github.com/headroomlabs-ai/headroom/commit/8f04221b2d390e990b98061853c5d6aea9b15e6d)) * **router:** keep source code out of the prose (Kompress) fallbacks ([#4787](https://github.com/headroomlabs-ai/headroom/issues/4787)) ([3aafdf2](https://github.com/headroomlabs-ai/headroom/commit/3aafdf2dcc95020af6affdbfaf837059a0748f3a)) * **sdk:** accept string contents and functionCall without args in the Gemini adapter ([#4756](https://github.com/headroomlabs-ai/headroom/issues/4756)) ([200c838](https://github.com/headroomlabs-ai/headroom/commit/200c838c7393d20ae56a0c338f832ed27133c398)) * **sdk:** encode the signature hash in client.telemetry.getTool ([#4772](https://github.com/headroomlabs-ai/headroom/issues/4772)) ([3c66c91](https://github.com/headroomlabs-ai/headroom/commit/3c66c91eea3ad8cf77d7d66abe484cee876271eb)) * **sdk:** keep Gemini thought signatures and call ids through the compress round trip ([#4777](https://github.com/headroomlabs-ai/headroom/issues/4777)) ([622df29](https://github.com/headroomlabs-ai/headroom/commit/622df2962bf2b89d7708f2ec5726a2d50e419c4f)) * **sdk:** reject "." ".." and NUL plugin names like the python twin ([#4771](https://github.com/headroomlabs-ai/headroom/issues/4771)) ([99ef4ee](https://github.com/headroomlabs-ai/headroom/commit/99ef4eec8279936131ef52512993d31bafb54b55)) * **sdk:** reject sharedcontext maxentries below 1 ([#4743](https://github.com/headroomlabs-ai/headroom/issues/4743)) ([4b6529f](https://github.com/headroomlabs-ai/headroom/commit/4b6529fc147698ca7bce6dfa993be49d1529f79b)) * **sdk:** throw typed proxy 4xx errors from compress instead of retrying ([#4751](https://github.com/headroomlabs-ai/headroom/issues/4751)) ([e602e4c](https://github.com/headroomlabs-ai/headroom/commit/e602e4cfb510f188e52cd1c81eb515f4d1b2634d)) * **smart-crusher:** keep container-shaped strings as strings in lossless tables ([#4875](https://github.com/headroomlabs-ai/headroom/issues/4875)) ([303f521](https://github.com/headroomlabs-ai/headroom/commit/303f521812bed4b189d628d8cf8f62b4b8e58e58)) * **sql:** stop granting anon read access to raw proxy telemetry ([#4867](https://github.com/headroomlabs-ai/headroom/issues/4867)) ([b324efb](https://github.com/headroomlabs-ai/headroom/commit/b324efb1d4a01ce5a698f848527c0d55ec3cd1a4)) * **tag-protector:** make tag protection and restore linear in input size ([#4841](https://github.com/headroomlabs-ai/headroom/issues/4841)) ([c8b3d67](https://github.com/headroomlabs-ai/headroom/commit/c8b3d67715ab95429857832faaa3a871b465408c)) * **wrap:** match Serena's unset dashboard key instead of appending a duplicate ([#4315](https://github.com/headroomlabs-ai/headroom/issues/4315)) ([1da8930](https://github.com/headroomlabs-ai/headroom/commit/1da8930ab47a2fc5339ded97e5a41bfe6fc419eb)) ### Performance Improvements * **bm25:** lower batch allocations -- 93.4% less peak memory ([#4893](https://github.com/headroomlabs-ai/headroom/issues/4893)) ([cb8414c](https://github.com/headroomlabs-ai/headroom/commit/cb8414cc73724903e3283a60ebf86b7c9b02d089)) ### Dependencies * bump pyo3 from 0.29.3 to 0.30.1 ([#4811](https://github.com/headroomlabs-ai/headroom/issues/4811)) ([5df3d94](https://github.com/headroomlabs-ai/headroom/commit/5df3d946ea4fafc9bd5296ad46f6e38b20197e8d)) * bump ruff from 0.17.3 to 0.17.4 in the pip-minor-patch group ([#4804](https://github.com/headroomlabs-ai/headroom/issues/4804)) ([e89d2c2](https://github.com/headroomlabs-ai/headroom/commit/e89d2c2ab2545ce8378e9d5aa4dee4d593161ecb)) * bump the npm-minor-patch group across 3 directories with 10 updates ([#4813](https://github.com/headroomlabs-ai/headroom/issues/4813)) ([6182b5f](https://github.com/headroomlabs-ai/headroom/commit/6182b5fe062b27de013b4e6fa71906b6c2c0d89f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: headroom-release[bot] <352661243+headroom-release[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
headroom-opencode
OpenCode integration helpers for Headroom. The package supports two integration paths:
- Provider config helpers used by
headroom wrap opencodeand persistent installs. - A native OpenCode plugin that installs Headroom transport interception and exposes the retrieve tool.
Install
npm install headroom-opencode
Building from source
Tsup 9 requires Node.js ^22.18.0 || ^24.11.0 || >=26.0.0. The current locked
graph also includes ini 7, which requires ^22.22.2 || ^24.15.0 || >=26.0.0.
These are development-install requirements; the published plugin and its host
retain their own runtime requirements. Node.js 24.22.2 is a verified choice
for this dependency graph. From plugins/opencode, run:
npm ci
npm test
npm run typecheck
npm run build
npm run build:standalone
For a reproducible real OpenCode 2.x → proxy → local SSE upstream check, see the transport runtime proof. It records the tested scope and limitations.
Provider Config Helpers
Use these helpers when you need to generate OpenCode config that routes a headroom provider through a running Headroom proxy.
import {
buildOpencodeConfigContent,
createHeadroomProvider,
} from "headroom-opencode";
const provider = createHeadroomProvider({ proxyPort: 8787 });
const config = buildOpencodeConfigContent({
proxyPort: 8787,
defaultModel: "claude-sonnet-4-6",
});
console.log(provider.provider.headroom.npm);
console.log(config.model);
The generated provider uses @ai-sdk/openai-compatible and points model requests at http://127.0.0.1:<port>/v1.
Native OpenCode Plugin
The package's default export is an OpenCode plugin that loads on both OpenCode 1.x and 2.x. Register it in opencode.json:
{
"plugin": [
["headroom-opencode", { "proxyUrl": "http://127.0.0.1:8787" }]
]
}
OpenCode 2.x migrates the 1.x plugin key automatically. To configure it the 2.x way, use "plugins": [{ "package": "headroom-opencode", "options": { ... } }].
The default export is { id: "headroom", server, setup }. OpenCode 1.x calls server (HeadroomPlugin) and 2.x calls setup (headroomSetup); each ignores the other's field. Both entry points:
- install Headroom transport interception for OpenCode provider traffic.
- expose the
headroom_retrievetool (a direct tool on 2.x, not only through code mode). - add
HEADROOM_ACTIVE,HEADROOM_PROXY_URL,HEADROOM_PROJECT(andHEADROOM_BACKENDwhen set) to shell command environments. - default to
HEADROOM_PROXY_URL, thenhttp://127.0.0.1:8787, when noproxyUrloption is supplied. - skip routing for hosts listed in
excludeHosts(orHEADROOM_OPENCODE_EXCLUDE_HOSTS); those requests go straight upstream with no compression or telemetry. - route the provider base URLs configured in OpenCode, so a compatible gateway with an arbitrary path prefix is still compressed. Only wire endpoints (
/chat/completions,/responses,/messages) under a configured base route; other paths on that host pass through.
Routing is decided by method, path shape, and configured bases, never by host identity. A POST routes when its path ends in a wire endpoint and the segment before that endpoint is a version (/v1, /v1beta, /v4), api, or a recognised root (backend-api, codex, openai, anthropic, zen) — or when it sits under one of OpenCode's configured provider base URLs. Everything else goes direct, including a bare /messages on an unknown host: that is the same shape as a messaging API, so becoming the bare path is not evidence of a provider. Two shapes still route without a configured base, because no path can tell them from a gateway: /api/v2/messages and /v2/responses. List the host in excludeHosts if one of your own services has that shape.
On 2.x, setup returns a cleanup that releases the transport, so hot reloads do not stack interceptors.
OpenCode 2.x keeps its own reference to fetch from before plugins load, so patching fetch alone does not catch its model traffic. For models with a resolved baseURL, the plugin also rewrites OpenAI chat-completions, Responses, and Anthropic Messages traffic so that it points at the proxy — including GitHub Copilot's Claude models. Anthropic Messages base URLs with a path prefix (for example a gateway rooted at /api/...) stay on their own base URL, because the proxy's Messages route ignores the original-path header and cannot preserve that prefix. Headers name the real upstream and request path, as the transport does, and authentication settings are retained. Local, excluded, and unsupported-protocol models are left alone. headroom wrap opencode routes native Anthropic and OpenAI through the proxy separately, via their baseURL.
To keep a provider off the proxy, list its host. An entry matches the host and all of its subdomains, and .example.com / *.example.com are accepted as spellings of example.com:
// opencode.json
{
"plugin": [["/path/to/headroom/providers/opencode/_dist", { "excludeHosts": ["opencode.ai"] }]]
}
or, for headroom wrap opencode and spawned Node child processes, set the environment variable before launching:
HEADROOM_OPENCODE_EXCLUDE_HOSTS="opencode.ai,.corp.internal" headroom wrap opencode
Retrieve Tool
import { createHeadroomRetrieveTool } from "headroom-opencode";
const retrieve = createHeadroomRetrieveTool({
proxyBaseUrl: "http://127.0.0.1:8787",
});
const result = await retrieve.execute({
hash: "0123456789abcdef01234567",
});
The tool calls /v1/retrieve/<hash> on the Headroom proxy.
Compression Helper
import { compressWithHeadroom } from "headroom-opencode";
const result = await compressWithHeadroom(
[{ role: "user", content: "Summarize this file" }],
{ model: "gpt-4o", proxyUrl: "http://127.0.0.1:8787" },
);
console.log(`Saved ${result.tokensSaved} tokens`);
Models
| Model | Context | Output |
|---|---|---|
claude-sonnet-4-6 |
200K | 16K |
claude-opus-4-6 |
200K | 16K |
claude-haiku-4-5-20251001 |
200K | 8K |
gpt-4o |
128K | 16K |
gpt-4.1 |
1M | 32K |
The provider config exposes these as headroom/<model> and defaults to headroom/claude-sonnet-4-6.
Environment
| Variable | Used by | Description |
|---|---|---|
HEADROOM_PROXY_URL |
Native plugin | Proxy URL used by HeadroomPlugin |
HEADROOM_OPENCODE_EXCLUDE_HOSTS |
Native plugin | Comma-separated hosts (and their subdomains) that bypass the proxy; the excludeHosts plugin option takes precedence |
HEADROOM_OPENCODE_WIRE_ROOTS |
Native plugin | Set from OpenCode's configured provider base URLs so spawned Node processes route the same bases; rarely set by hand |
OPENCODE_CONFIG_CONTENT |
OpenCode wrapper | Generated OpenCode provider, model, and MCP config |
License
Apache-2.0