Repository navigation
agents: route claude to the headroom proxy root, not /v1 - #32
Merged
Merged
Conversation
claude appends /v1/messages to ANTHROPIC_BASE_URL, so the proxy URL with
/v1 became /v1/v1/messages, which the proxy passes through and
api.anthropic.com answers 404: every claude request failed with the proxy
on ("issue with the selected model"). opencode (AI SDK) and kimi expect a
/v1 base and keep it; pi already used the root. agents-wiring asserts it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
andrewthomaslee
enabled auto-merge (squash)
November 9, 2026 13:44
andrewthomaslee
added a commit
to external-systems/home
that referenced
this pull request
Nov 9, 2026
) ## What - `users/netsa/default.nix`, `users/matt/default.nix`: `homeSpec.programs.headroom.enable = true` (was `false`). - `flake.lock`, `devenv.lock`, `devenv.yaml`: `nix flake update modules org-pkgs` → modules `main` 5e8005f, org-pkgs `main` 1188419, then `sync-locks`. ## Why The headroom proxy was turned off because the 0.42 wheel package broke. It now comes from: - external-systems/pkgs#27: headroom 0.43.1 built with uv2nix (`headroom`, `headroom-lean`, `headroom-sandbox`). - external-systems/modules#31: `homeSpec.programs.headroom.package` defaults to `headroom-lean`, the torch-free profile (1.1 GiB closure). - external-systems/modules#32: claude's `ANTHROPIC_BASE_URL` is the proxy root. Before that fix, every claude request went to `/v1/v1/messages` and failed. With headroom enabled, `homeSpec.agents.mcp.headroom.{enable,routeProviders}` (both default on) give every agent the headroom MCP server and send its provider traffic through the `headroom-proxy` user service on 127.0.0.1:8787: - claude: `ANTHROPIC_BASE_URL`. - opencode: anthropic `baseURL`. - pi: models.json. - kimi: `KIMI_CODE_BASE_URL`. ### Behaviour - netsa (nixos, kamrui-h1, ghost, beelink) and matt (beelink) get a `headroom-proxy` systemd user service. - `claude` started from a login shell uses the proxy. - Claude Desktop: the headroom MCP server is synced into `claude_desktop_config.json`. The desktop chat talks to claude.ai, so it can't use the proxy. The desktop app's Code tab sets its own `ANTHROPIC_BASE_URL`, so it isn't routed yet. ## Checks - `fmt`: no changes. `check`: all checks passed. - `nix build` of `nixosConfigurations.{nixos,kamrui-h1,ghost,beelink}.config.system.build.toplevel`: OK. Each closure has `headroom-lean-0.43.1` and `headroom-proxy.service`. - kamrui-h1 netsa: `ANTHROPIC_BASE_URL=http://127.0.0.1:8787`, `KIMI_CODE_BASE_URL=http://127.0.0.1:8787/v1`. Proxy ExecStart: `headroom proxy --host 127.0.0.1 --port 8787 --mode cache --openai-api-url https://api.kimi.ai/coding/v1`. ## Merge order pkgs (#27, merged) → modules (#31, #32, merged) → **home (this PR)**. ## Deploy The owner approved deploying kamrui-h1 after merge (`clan machines update kamrui-h1`). Other machines are the owner's call: ``` clan machines update nixos ghost beelink ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
andrewthomaslee
added a commit
that referenced
this pull request
Nov 13, 2026
pkgs#31/#32: parallel vm-test --all, fresh --rebuild, CACHED results, preparation retry. skills#19: the vm-tests, remote-builder, clanservices and external-systems skills for that runner and the converged clanServices. sync-locks in the same commit. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
flake-parts/homeModules/agents/agents.nix: withhomeSpec.agents.mcp.headroom.routeProviders, claude'sANTHROPIC_BASE_URLis now the proxy root (http://127.0.0.1:8787), not…/v1.tests/flake-module.nix:agents-wiringasserts that value.Why
Claude Code appends
/v1/messagestoANTHROPIC_BASE_URL. With…:8787/v1every request went to/v1/v1/messages. The headroom proxy passes that through, and api.anthropic.com answers 404, so claude fails with "There's an issue with the selected model" whenever the proxy is on. The proxy has been off in home since the 0.42 package broke, so nobody hit this. Re-enabling it in home would have broken claude.opencode (AI SDK
baseURL, defaulthttps://api.anthropic.com/v1) and kimi (KIMI_CODE_BASE_URL, an OpenAI-style/v1base) are right with/v1and keep it. pi already uses the root.Checks
Against headroom-lean 0.43.1 on this machine, with
claude -pon a subscription login:ANTHROPIC_BASE_URL=http://127.0.0.1:PORT/v1: proxy log showsPOST /v1/v1/messages→ 404 twice; claude errors.ANTHROPIC_BASE_URL=http://127.0.0.1:PORT:POST /v1/messages→ 200; claude answers; proxy/statsreports 461 tokens saved.agents-wiringfails on the old value ("claude not routed to the headroom proxy root") and passes with the fix.fmt: no changes.check: all checks passed.Merge order
pkgs (external-systems/pkgs#27, merged) → modules (#31 merged, this PR) → home (bumps
modules org-pkgs, re-enables the headroom proxy).🤖 Generated with Claude Code