feat: ANTHROPIC_BASE_URL override + opt-in headroom proxy overlay #39
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/api-proxy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds support for routing worker
claudetraffic through a transparent proxy (e.g. headroom, a context-compression layer), via a new instance-wideANTHROPIC_BASE_URLoverride, plus an opt-in bundled headroom compose overlay.Two layers, decoupled:
anthropic_base_urlinstance setting (registry-driven,env > db > default, validated http(s):// or empty). When non-empty it's injected into each worker's plainEnvarray at spawn (a base URL is not a secret, so deliberately not the tmpfs secret block). Works with any transparent proxy. Surfaces automatically in the instance settings UI with a label + help text.docker-compose.headroom.yml, an opt-in overlay running a headroomcodeimage (AST-aware code compression) withHEADROOM_CODE_AWARE_ENABLED=1andHEADROOM_TELEMETRY=off, joined to thenexus-workersbridge. It setsANTHROPIC_BASE_URLon the nexus service, which env-locks the setting so workers route through headroom automatically when the overlay is up.Auth model is transparent OAuth passthrough: Nexus only sets the base URL; no API-key handling, subscription billing preserved. This relies on the proxy forwarding claude's OAuth
Authorizationheader untouched (Remote Control requires OAuth, not an API key — see AGENTS.md facts #2/#3).Changes
nexus/src/lib/server/settings/registry.ts—anthropic_base_urlsetting (+ tests)nexus/src/lib/server/workers/anthropic-env.ts— pureanthropicBaseUrlEnvhelper (+ tests)nexus/src/lib/server/workers/service.ts— inject into workerEnvat spawnnexus/src/lib/server/settings/service.test.ts— default + env-lock precedence testsnexus/src/lib/components/settings/InstancePanel.svelte— UI label + help textdocker-compose.headroom.yml— opt-in overlay (gateway-pinnednexus-workersnet)AGENTS.md— env-var table row + verified-fact #19docs/superpowers/specs|plans/— design spec + implementation planTest Plan
Automated (green on this branch):
pnpm test— 542/542 passpnpm exec tsc --noEmitcleanpnpm typecheck(svelte-check) — 0 errors / 0 warningsdocker-compose.headroom.ymlparses;nexus-workersnet has subnet + pinned gatewayRuntime verification (operator-side, pending — blocking gate for the overlay only):
claudeturn — confirm it succeeds on the shared OAuth login and billing stays on the subscription (headroom forwards the Bearer header, doesn't inject its ownANTHROPIC_API_KEY). If this fails, withdraw the overlay; the knob still ships.HEADROOM_CODE_AWARE_ENABLEDtruthy form and no blocking model fetch on cold startdocker compose -f docker-compose.yml -f docker-compose.headroom.yml configmerges cleanly on a real Docker hosthttps://claude.ai/code/session_01HdTWo7DzxEhk63aKPo4Xpn
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.