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.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
fix: respect COPILOT_PROVIDER_TYPE env var when provider_type is auto (#549)
kouyouqi12324cf256e50fb
diff --git a/headroom/providers/copilot/wrap.py b/headroom/providers/copilot/wrap.pyindex 518b302ed..db1610a3b 100644--- a/headroom/providers/copilot/wrap.py+++ b/headroom/providers/copilot/wrap.py@@ -22,6 +22,10 @@ def resolve_provider_type(return provider_typeenv = environ or os.environ+ # Check COPILOT_PROVIDER_TYPE env var before falling back to backend default.+ env_type = env.get("COPILOT_PROVIDER_TYPE")+ if env_type in {"anthropic", "openai"}:+ return env_typeeffective_backend = backend or env.get("HEADROOM_BACKEND") or "anthropic"return "anthropic" if effective_backend == "anthropic" else "openai"diff --git a/tests/test_provider_copilot_wrap.py b/tests/test_provider_copilot_wrap.pyindex c3d082915..849da6b98 100644--- a/tests/test_provider_copilot_wrap.py+++ b/tests/test_provider_copilot_wrap.py@@ -47,7 +47,30 @@ def test_detect_running_proxy_backend_requires_string_backend(monkeypatch) -> Nodef test_resolve_provider_type_prefers_explicit_and_env() -> None:- assert resolve_provider_type("anthropic", "openai") == "openai"+ assert (+ resolve_provider_type(+ "anthropic",+ "openai",+ {"COPILOT_PROVIDER_TYPE": "anthropic", "HEADROOM_BACKEND": "anthropic"},+ )+ == "openai"+ )+ assert (+ resolve_provider_type(+ "anthropic",+ "auto",+ {"COPILOT_PROVIDER_TYPE": "openai", "HEADROOM_BACKEND": "anthropic"},+ )+ == "openai"+ )+ assert (+ resolve_provider_type(+ None,+ "auto",+ {"COPILOT_PROVIDER_TYPE": "not-a-provider", "HEADROOM_BACKEND": "anthropic"},+ )+ == "anthropic"+ )assert resolve_provider_type(None, "auto", {"HEADROOM_BACKEND": "anthropic"}) == "anthropic"assert resolve_provider_type(None, "auto", {"HEADROOM_BACKEND": "anyllm"}) == "openai"