Skip to content

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

fix(wrap): set ANTHROPIC_HOST so `wrap goose` actually proxies Anthropic (#2619)

filipc07fad0f37d4
diff --git a/headroom/cli/wrap.py b/headroom/cli/wrap.py
index 2c09e9f72..a398a2f7f 100644
--- a/headroom/cli/wrap.py
+++ b/headroom/cli/wrap.py
@@ -7868,6 +7868,7 @@ def continue_dev(
# =============================================================================
+
# OpenClaw
# =============================================================================
diff --git a/headroom/providers/wrap_registry.py b/headroom/providers/wrap_registry.py
index e4d42e567..826fa404d 100644
--- a/headroom/providers/wrap_registry.py
+++ b/headroom/providers/wrap_registry.py
@@ -160,14 +160,15 @@ WRAP_TARGETS: dict[str, WrapTarget] = {
EnvVar("OPENAI_BASE_URL", "openai_v1"),
EnvVar("OPENAI_API_BASE", "openai_v1", display=False),
EnvVar("ANTHROPIC_BASE_URL", "anthropic"),
+ EnvVar("ANTHROPIC_HOST", "anthropic"),
),
project_prefix=False,
help_text=(
"Launch Goose (Block) CLI through Headroom proxy.\n"
"\n"
"\b\n"
- "Sets OPENAI_BASE_URL and ANTHROPIC_BASE_URL to route Goose's API calls\n"
- "through Headroom.\n"
+ "Sets OPENAI_BASE_URL, ANTHROPIC_BASE_URL, and ANTHROPIC_HOST to route\n"
+ "Goose's API calls through Headroom.\n"
"\n"
"\b\n"
"Uninstall: there is no ``headroom unwrap goose`` subcommand — nothing is\n"
diff --git a/tests/test_cli/test_wrap_goose.py b/tests/test_cli/test_wrap_goose.py
index ba3f48b9e..24f2ad496 100644
--- a/tests/test_cli/test_wrap_goose.py
+++ b/tests/test_cli/test_wrap_goose.py
@@ -26,7 +26,11 @@ def test_wrap_goose_sets_provider_envs(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
- """OPENAI_BASE_URL, OPENAI_API_BASE, ANTHROPIC_BASE_URL are set on launch."""
+ """OPENAI_BASE_URL, OPENAI_API_BASE, ANTHROPIC_BASE_URL, ANTHROPIC_HOST are set.
+
+ Goose's Anthropic provider reads ANTHROPIC_HOST rather than
+ ANTHROPIC_BASE_URL, so the value is asserted rather than mere presence.
+ """
monkeypatch.chdir(tmp_path)
monkeypatch.delenv("HEADROOM_CONTEXT_TOOL", raising=False)
@@ -45,6 +49,7 @@ def test_wrap_goose_sets_provider_envs(
assert env["OPENAI_BASE_URL"] == "http://127.0.0.1:9000/v1"
assert env["OPENAI_API_BASE"] == "http://127.0.0.1:9000/v1"
assert env["ANTHROPIC_BASE_URL"] == "http://127.0.0.1:9000"
+ assert env["ANTHROPIC_HOST"] == "http://127.0.0.1:9000"
assert captured["tool_label"] == "GOOSE"
assert captured["agent_type"] == "goose"
assert captured["args"] == ("session",)
diff --git a/tests/test_cli/test_wrap_registry.py b/tests/test_cli/test_wrap_registry.py
index 105406b46..6f229b243 100644
--- a/tests/test_cli/test_wrap_registry.py
+++ b/tests/test_cli/test_wrap_registry.py
@@ -17,10 +17,11 @@ from headroom.providers.wrap_registry import WRAP_TARGETS, build_launch_env
def test_goose_banner_hides_openai_api_base_alias():
_, display = build_launch_env(WRAP_TARGETS["goose"], 8787, environ={}, project="p")
- # Legacy goose never encoded the project prefix and showed two vars only.
+ # Goose has no project prefix; its endpoint override is visible in the banner.
assert display == [
"OPENAI_BASE_URL=http://127.0.0.1:8787/v1",
"ANTHROPIC_BASE_URL=http://127.0.0.1:8787",
+ "ANTHROPIC_HOST=http://127.0.0.1:8787",
]