HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.
Python agent-apiagent-frameworkagent-harnessai-agentsai-infrastructurecoding-agentconformance-testingdeepseek-harnessharness-engineeringhermesllmopen-protocolopen-sourceopen-standardpi-coding-agentself-hosteduhpunified-apiunified-harness-protocolunified-interface
feat(qwen): custom OpenAI endpoints drive qwen-code too, through the relay
richard-epsillaf28a25ab34a3
diff --git a/gateway/app.py b/gateway/app.pyindex e282454e..bdfdbab5 100644--- a/gateway/app.py+++ b/gateway/app.py@@ -964,6 +964,7 @@ _INTEGRATION_WIRING: dict[tuple[str, str], str] = {("custom", "claude"): "tokenrouter",("custom", "hermes"): "openai-api", ("custom", "opencode"): "tokenrouter",("custom", "pi"): "tokenrouter", ("custom", "dsh"): "tokenrouter",+ ("custom", "qwen"): "openai-api",}@@ -3607,7 +3608,9 @@ def _provider_backends(provider: str) -> list[str]:# speak is a promise the router breaks at the first call, so these sets drive the picker's# grey-out._CUSTOM_FORMAT_BACKENDS = {- "openai": {"hermes", "opencode", "pi", "dsh"},+ # qwen-code is a pure OPENAI_BASE_URL/OPENAI_API_KEY client (0.22.1, verified), so a custom+ # OpenAI endpoint drives it directly; it speaks nothing else, so it stays off the anthropic set.+ "openai": {"hermes", "opencode", "pi", "dsh", "qwen"},"anthropic": {"claude", "opencode", "pi", "dsh"},}diff --git a/runner/server.py b/runner/server.pyindex d6970fa8..62de975a 100644--- a/runner/server.py+++ b/runner/server.py@@ -2407,6 +2407,13 @@ def _build_qwen(provider: str, auth: Auth, model: str, prompt: str, cwd: str, enraise HTTPException(400, f"unknown qwen provider '{pr}' (one of {sorted(QWEN_PROVIDERS)})")if not auth.base_url:raise HTTPException(400, "qwen needs a base_url (none configured)")+ if auth.api_format == "openai" and auth.api_key:+ # A custom OpenAI endpoint rides the loopback relay, exactly like opencode's: request+ # shapes strict endpoints refuse are repaired in flight (Azure's gpt-5.x deployments 400+ # on max_tokens), and the real key never enters the CLI's environment — which matters+ # more here than anywhere, because qwen takes its credential ONLY via env.+ relay_base, relay_tok = _hermes_relay_route(auth.base_url, auth.api_key)+ auth = auth.model_copy(update={"base_url": relay_base, "api_key": relay_tok})home = pathlib.Path(cwd) / ".harness" / "home"home.mkdir(parents=True, exist_ok=True)env["HOME"] = str(home) # sessions/skills/settings live INSIDE the workspace