Skip to content

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.

feat: a custom endpoint's model rows are its map, and a connection can turn built-in tools off (#149, #150) (#155)

github-actions[bot]b10b955aa4ca
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 15ca0222..b3d69061 100644
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -304,9 +304,14 @@ install_backends() {
try_install "Cline" npm install -g --prefix "$TOOLS" --no-audit --no-fund "cline@${HR_CLINE_VERSION:-3.0.60}" || true
fi
- if wanted codex && [ ! -x "$(backend_bin codex)" ]; then
- echo "[harnessrouter] installing Codex (Apache-2.0)…"
- try_install "Codex" npm install -g --prefix "$TOOLS" --no-audit --no-fund @openai/codex || true
+ # Pinned, and re-pinned on every start: an install from a fresh volume used to take whatever
+ # npm served that day (an August volume ran 0.147, a September one 0.154, on the same image), so
+ # the runner's codex behaviour was measured against a version the operator could not name.
+ # The pin is the version the support matrix ran on; bumping it is a PR with a matrix rerun.
+ CODEX_PIN="${HR_CODEX_VERSION:-0.154.0}"
+ if wanted codex && [ "$("$(backend_bin codex)" --version 2>/dev/null | awk '{print $2}')" != "$CODEX_PIN" ]; then
+ echo "[harnessrouter] installing Codex $CODEX_PIN (Apache-2.0, version-pinned)…"
+ try_install "Codex" npm install -g --prefix "$TOOLS" --no-audit --no-fund "@openai/codex@$CODEX_PIN" || true
fi
if wanted pi && [ ! -x "$(backend_bin pi)" ]; then
diff --git a/docs/self-hosting-guide.md b/docs/self-hosting-guide.md
index 3838bfd9..8e979082 100644
--- a/docs/self-hosting-guide.md
+++ b/docs/self-hosting-guide.md
@@ -253,6 +253,59 @@ integration there is nothing to set.
</details>
+<details>
+<summary>Your own endpoint: a proxy or a gateway that names its models its own way</summary>
+
+Pick the **Custom** provider. It asks for the API format the endpoint speaks (OpenAI Chat
+Completions, OpenAI Responses for Codex, or Anthropic Messages), the endpoint URL, the key, and
+the **models** it serves. Each model row pairs the id a harness picks (the same ids every other
+provider uses, `gpt-5.5`, `claude-opus-4.8`) with the name this endpoint wants on the wire. That
+name is an arbitrary string per row and is sent verbatim: a bare vendor id, a deployment alias, a
+versioned SKU. Leave it blank to send the model id as it is. No transform is applied, because the
+name a proxy expects is a fact about that proxy and nothing else.
+
+The mapping is a property of the connection, not of a harness: a harness picks a model by its id,
+the connection decides how that id is written for its endpoint. Two harnesses that need different
+vocabularies on one endpoint are two connections to it.
+
+**Disabled built-in tools.** Some endpoints refuse an agent's built-in tools per model (a proxy
+that answers `400 The following tool is not allowed for model 'gpt-5.5': web_search` to Codex).
+Name those tools on the connection, comma-separated, and every turn through it runs without them;
+for Codex's `web_search` that is a hard switch in its configuration, not a request. The same field
+exists on each harness, for tools you want off regardless of the endpoint.
+
+</details>
+
+<details>
+<summary>The same, from a script (the integrations document)</summary>
+
+The console saves one document, and you can write it yourself. `PUT /v1/admin/integrations` with the
+console's session (or a key of this instance) takes the whole document; `GET` reads it back with
+keys redacted. Rows are matched by `name`, so a `PUT` with an existing name replaces that row.
+
+```json
+{
+ "integrations": [
+ {"name": "proxy-anthropic", "provider": "custom",
+ "config": {"api_format": "anthropic", "base_url": "https://proxy.internal/anthropic", "api_key": "…"},
+ "models": [{"canonical": "claude-opus-4.8", "provider_id": "anthropic--claude-4.8-opus"}]},
+ {"name": "proxy-openai", "provider": "custom",
+ "config": {"api_format": "responses", "base_url": "https://proxy.internal/openai/v1", "api_key": "…",
+ "disabled_tools": "web_search"},
+ "models": [{"canonical": "gpt-5.5", "provider_id": "gpt-5.5"},
+ {"canonical": "gpt-5.4", "provider_id": "prod-gpt-v2"}]}
+ ],
+ "model_map": {"claude-opus-4.8": "proxy-anthropic", "gpt-5.5": "proxy-openai", "gpt-5.4": "proxy-openai"}
+}
+```
+
+`models` on a custom row is the endpoint's whole list. On every other provider the list comes from
+the product's own table for that vendor, and a `models` row there only changes the wire id of a
+model that table already lists. `model_map` routes a model id to the integration that serves it;
+a model with no route goes to the first integration that can serve it.
+
+</details>
+
<details>
<summary>Setting it from the environment instead, for a scripted deploy</summary>
@@ -288,7 +341,7 @@ problem, because it only offers you providers that work.
| `tokenrouter` | Claude Code, Codex, Hermes, Pi, DeepSeek Harness, OpenCode, Qwen Code, Gemini CLI, Cline, Oh My Pi |
| `vercel` | Claude Code, Codex, Hermes, Pi, DeepSeek Harness, OpenCode, Qwen Code, Cline, Oh My Pi |
| `llmtr` | Claude Code, Codex, Hermes, Pi, DeepSeek Harness, OpenCode, Qwen Code, Cline, Oh My Pi |
-| `custom` | Claude Code, Hermes, Pi, DeepSeek Harness, OpenCode, Qwen Code, Cline, Oh My Pi |
+| `custom` | Claude Code, Codex (Responses format), Hermes, Pi, DeepSeek Harness, OpenCode, Qwen Code, Cline, Oh My Pi |
</details>
diff --git a/gateway/app.py b/gateway/app.py
index 9197429d..25ae33f9 100644
--- a/gateway/app.py
+++ b/gateway/app.py
@@ -1082,6 +1082,10 @@ _INTEGRATION_WIRING: dict[tuple[str, str], str] = {
("custom", "omp"): "tokenrouter",
("custom", "qwen"): "openai-api",
("custom", "cline"): "openai-api",
+ # A custom endpoint that speaks the OpenAI Responses API drives codex (issue #149: a proxy
+ # naming its models its own way). The runner's "tokenrouter" provider is exactly that shape:
+ # OpenAI-compatible, base on the connection, wire_api responses.
+ ("custom", "codex"): "tokenrouter",
# Google AI Studio: one key, Gemini's OpenAI-compatible chat-completions surface. Every
# backend that talks OpenAI's chat shape through a base_url reaches it as 'openai-api'.
# Not claude (Anthropic's protocol) and not codex (the Responses API): unprobed is unlisted.
@@ -1209,15 +1213,24 @@ def _integration_models(integ: dict) -> dict[str, str]:
(a stale snapshot is indistinguishable from a deliberate override, so it cannot be trusted
to introduce models). Nothing is lost: only canonicals in the catalog can be requested.
- The "custom" provider is the exception: it has no vendor table. The model comes from the
- integration's own config — the user-supplied model_id. That is the one model this integration
- serves, and it is its own provider-native id (the user's endpoint calls it whatever they named
- it, and the runner sends that name verbatim).
+ The "custom" provider is the exception: it has no vendor table, so its stored rows ARE the
+ list. Each row pairs a canonical id (what a harness picks) with the name the endpoint wants on
+ the wire, an arbitrary string per row: a bare vendor id, a deployment alias, a SKU. A row
+ with no wire id sends the canonical verbatim. No transform is ever applied (issue #149: the
+ wire id a proxy expects is arbitrary and per endpoint; only an explicit map is correct).
+ An integration saved before rows existed carries a single model_id, its own name for its one
+ model; that still reads as one row.
"""
provider = str(integ.get("provider") or "").lower()
if provider == "custom":
- cfg = integ.get("config") or {}
- model_id = str(cfg.get("model_id") or "").strip()
+ rows: dict[str, str] = {}
+ for m in (integ.get("models") or []):
+ canonical = str(m.get("canonical") or "").strip()
+ if canonical:
+ rows[canonical] = str(m.get("provider_id") or "").strip() or canonical
+ if rows:
+ return rows
+ model_id = str((integ.get("config") or {}).get("model_id") or "").strip()
return {model_id: model_id} if model_id else {}
models = dict(_vendor_models(str(integ.get("provider") or "").lower()))
for m in (integ.get("models") or []):
@@ -4457,7 +4470,6 @@ _PROVIDER_CATALOG: dict[str, dict] = {
{"key": "base_url", "label": "Endpoint URL",
"placeholder": "https://your-api.example.com"},
{"key": "full_url", "label": "Use Full URL"},
- {"key": "model_id", "label": "Model ID", "placeholder": "your-model-name"},
],
"secret": "api_key",
"secret_label": "API Key",
@@ -4510,6 +4522,8 @@ _CUSTOM_FORMAT_BACKENDS = {
# OpenAI endpoint drives it directly; it speaks nothing else, so it stays off the anthropic set.
"openai": {"hermes", "opencode", "pi", "dsh", "qwen", "cline", "omp"},
"anthropic": {"claude", "opencode", "pi", "dsh", "omp"},
+ # The OpenAI Responses API: what codex speaks, and only codex among the agent CLIs here.
+ "responses": {"codex"},
}
@@ -4525,19 +4539,36 @@ def _integration_serves_backend(integ: dict, backend: str) -> bool:
return bool(_INTEGRATION_WIRING.get((provider, backend)))
+# Built-in agent tools an endpoint may refuse (a proxy that gates codex's web_search per model,
+# issue #150): named on the connection, comma-separated, and joined to the harness's own list on
+# every turn through it. Offered wherever a codex-driving provider is configured.
+_DISABLED_TOOLS_FIELD = {"key": "disabled_tools", "label": "Disabled built-in tools",
+ "placeholder": "web_search"}
+
+
+def _catalog_canonicals() -> list[str]:
+ """Every canonical model id a harness can ask for: the union of the backends' catalogs."""
+ return sorted({m for e in _MODEL_CATALOG.values() for m in (e.get("models") or [])})
+
+
def _provider_catalog_public() -> list[dict]:
"""The catalog the console renders its Add-Integration form from."""
- return [{"id": pid,
- "label": meta["label"],
- "base_url": meta["base_url"],
- "fields": meta["fields"],
- "secret": meta["secret"],
- "secret_label": meta["secret_label"],
- "key_hint": meta.get("key_hint", ""),
- "models": [{"canonical": c, "provider_id": v}
- for c, v in _VENDOR_MODELS.get(pid, {}).items()],
- "backends": _provider_backends(pid)}
- for pid, meta in _PROVIDER_CATALOG.items()]
+ out = []
+ for pid, meta in _PROVIDER_CATALOG.items():
+ backends = _provider_backends(pid)
+ out.append({"id": pid,
+ "label": meta["label"],
+ "base_url": meta["base_url"],
+ "fields": meta["fields"] + ([_DISABLED_TOOLS_FIELD] if "codex" in backends else []),
+ "secret": meta["secret"],
+ "secret_label": meta["secret_label"],
+ "key_hint": meta.get("key_hint", ""),
+ "models": [{"canonical": c, "provider_id": v}
+ for c, v in _VENDOR_MODELS.get(pid, {}).items()],
+ # The custom provider's rows name any canonical; the form offers this list.
+ "canonicals": _catalog_canonicals() if pid == "custom" else [],
+ "backends": backends})
+ return out
def _integration_public(integ: dict) -> dict:
@@ -4788,11 +4819,16 @@ async def admin_integrations_put(body: IntegrationsBody, request: Request) -> di
# Persisting the derived list instead is what made this list go stale — and worse, a
# model later retired from the table would live on forever in whatever was written here.
table = _vendor_models(provider)
- models = [{"canonical": c, "provider_id": pid}
- for c, pid in ((str(m.get("canonical") or "").strip(),
- str(m.get("provider_id") or "").strip())
- for m in (i.get("models") or []))
- if c and pid and table.get(c) != pid]
+ rows = [(str(m.get("canonical") or "").strip(), str(m.get("provider_id") or "").strip())
+ for m in (i.get("models") or [])]
+ if provider == "custom":
+ # No vendor table: the rows are the endpoint's model list, kept whole (see
+ # _integration_models); a blank wire id is the canonical, written out so the stored
+ # document says what goes on the wire.
+ models = [{"canonical": c, "provider_id": pid or c} for c, pid in rows if c]
+ else:
+ models = [{"canonical": c, "provider_id": pid}
+ for c, pid in rows if c and pid and table.get(c) != pid]
out.append({"name": name, "provider": provider, "config": cfg, "models": models})
names = {i["name"] for i in out}
if len(names) != len(out):
@@ -6466,6 +6502,10 @@ async def _resp_execute(translator: _RespTranslator, *, org: str, member: str, s
if backend in _NATIVE_ONLY_BACKENDS else
"credential cannot be brokered; refused")})
continue
+ # Built-in tools this CONNECTION cannot use (its endpoint refuses them: a proxy that gates
+ # codex's web_search per model, issue #150) join the harness's own list for this turn.
+ conn_off = [t.strip() for t in str(conn.get("disabled_tools") or "").split(",") if t.strip()]
+ turn_tools_off = sorted(set(tools_disabled or []) | set(conn_off))
body = {"backend": conn.get("backend", backend), "provider": conn.get("provider"),
# The gemini backend takes the canonical id: gemini-cli's resolution tables and the runner's
# served-model check key by it, and the provider's own name for it (TokenRouter's
@@ -6479,7 +6519,7 @@ async def _resp_execute(translator: _RespTranslator, *, org: str, member: str, s
"timeout_seconds": timeout_s,
"auth": sandbox_auth, "resume_session_id": resume, "files": files_in,
"mcp_servers": mcp_servers, "skills": skills, "agent_doc": agent_doc,
- "skills_suppressed": skills_suppressed, "tools_disabled": tools_disabled,
+ "skills_suppressed": skills_suppressed, "tools_disabled": turn_tools_off,
# Image generation, when an integration can serve it. A per-turn credential for
# the broker, never a provider key — see _image_auth.
"image_auth": image_auth,
diff --git a/gateway/tests/test_custom_model_map.py b/gateway/tests/test_custom_model_map.py
new file mode 100644
index 00000000..49b4eeb5
--- /dev/null
+++ b/gateway/tests/test_custom_model_map.py
@@ -0,0 +1,59 @@
+"""Issue #149: a custom endpoint names its models its own way, so its rows are the map."""
+import asyncio
+import sys
+from pathlib import Path
+
+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
+import app as gw # noqa: E402
+
+
+def test_the_custom_rows_are_the_map_and_a_blank_wire_id_is_the_canonical():
+ integ = {"name": "proxy", "provider": "custom",
+ "config": {"api_format": "responses", "base_url": "https://proxy.internal/openai/v1"},
+ "models": [{"canonical": "claude-opus-4.8", "provider_id": "anthropic--claude-4.8-opus"},
+ {"canonical": "gpt-5.5", "provider_id": ""},
+ {"canonical": "gpt-5.4", "provider_id": "prod-gpt-v2"}]}
+ assert gw._integration_models(integ) == {"claude-opus-4.8": "anthropic--claude-4.8-opus",
+ "gpt-5.5": "gpt-5.5", "gpt-5.4": "prod-gpt-v2"}
+
+
+def test_a_custom_integration_saved_with_one_model_id_still_reads_as_that_one_row():
+ integ = {"name": "old", "provider": "custom", "config": {"api_format": "openai", "model_id": "my-llm"}}
+ assert gw._integration_models(integ) == {"my-llm": "my-llm"}
+ # rows win over the legacy field once they exist
+ integ["models"] = [{"canonical": "gpt-5.5", "provider_id": "x"}]
+ assert gw._integration_models(integ) == {"gpt-5.5": "x"}
+
+
+def test_the_mapped_connection_sends_the_wire_id_verbatim(monkeypatch):
+ integ = {"name": "proxy", "provider": "custom",
+ "config": {"api_format": "responses", "base_url": "https://proxy.internal/openai/v1", "api_key": "k"},
+ "models": [{"canonical": "gpt-5.5", "provider_id": "prod-gpt-v2"}]}
+ async def mm(): return {"gpt-5.5": "proxy"}
+ async def docs(): return [integ]
+ monkeypatch.setattr(gw, "_effective_model_map", mm)
+ monkeypatch.setattr(gw, "_integrations_doc", docs)
+ conn = asyncio.run(gw._mapped_integration_conn("codex", "gpt-5.5"))
+ assert conn and conn["provider"] == "tokenrouter" and conn["model"] == "prod-gpt-v2" and conn["_model_resolved"]
+ # a Responses endpoint drives codex and nothing else; a chat one never drives codex
+ assert gw._integration_serves_backend(integ, "codex") and not gw._integration_serves_backend(integ, "hermes")
+ integ["config"]["api_format"] = "openai"
+ assert not gw._integration_serves_backend(integ, "codex") and gw._integration_serves_backend(integ, "hermes")
+
+
+def test_the_catalog_offers_the_canonicals_to_the_custom_form_and_disabled_tools_wherever_codex_runs():
+ cat = {c["id"]: c for c in gw._provider_catalog_public()}
+ custom = cat["custom"]
+ assert "gpt-5.5" in custom["canonicals"] and "claude-opus-4.8" in custom["canonicals"]
+ assert not any(f["key"] == "model_id" for f in custom["fields"])
+ for pid, c in cat.items():
+ has = any(f["key"] == "disabled_tools" for f in c["fields"])
+ assert has == ("codex" in c["backends"]), pid
+ assert "codex" in custom["backends"]
+
+
+def test_the_connections_disabled_tools_join_the_harness_list_for_the_turn():
+ # the union the turn body carries: the harness's list plus the connection's comma-separated field
+ conn = {"provider": "tokenrouter", "disabled_tools": "web_search, image_generation"}
+ conn_off = [t.strip() for t in str(conn.get("disabled_tools") or "").split(",") if t.strip()]
+ assert sorted(set(["Bash"]) | set(conn_off)) == ["Bash", "image_generation", "web_search"]
diff --git a/runner/server.py b/runner/server.py
index 245126d7..66ceec98 100644
--- a/runner/server.py
+++ b/runner/server.py
@@ -1410,8 +1410,15 @@ def _codex_resume_thread_id(cfg_dir: "pathlib.Path", wanted: str | None) -> str
return max(ids)[1] if ids else None
+def _codex_web_search_off(tools_disabled: list[str] | None) -> bool:
+ """Whether the turn's disabled list names codex's built-in web search (either spelling)."""
+ return any(x.split(" (")[0].strip().lower().replace("-", "_") in ("web_search", "websearch")
+ for x in (tools_disabled or []) if x and x.strip())
+
+
def _codex_prepare_env(provider: str, auth: Auth, model: str, cwd: str,
- env: dict, mcp_toml: str = "", resume: bool = False) -> "pathlib.Path":
+ env: dict, mcp_toml: str = "", resume: bool = False,
+ tools_disabled: list[str] | None = None) -> "pathlib.Path":
"""Shared codex setup for BOTH exec and app-server: write config.toml (model/provider/base_url +
MCP), point CODEX_HOME at the checkpointed workspace, set provider auth + TMPDIR. Returns the
CODEX_HOME dir. Mutates env."""
@@ -1450,6 +1457,15 @@ def _codex_prepare_env(provider: str, auth: Auth, model: str, cwd: str,
model=model, provider=f"hr-{p}", effort=CODEX_REASONING_EFFORT, ctx=CODEX_CONTEXT_WINDOW,
name=spec["name"], base_url=base_url, env_key=spec["env_key"],
wire_api=auth.wire_api or "responses")
+ if _codex_web_search_off(tools_disabled):
+ # The one built-in codex tool with a hard switch. Codex offers web_search by default on
+ # the Responses wire and an endpoint that gates it per model answers 400 "The following
+ # tool is not allowed" on every turn (issue #150); the TOP-LEVEL key is the only knob
+ # (verified on codex 0.147 and 0.154: `[tools] web_search = false` parses and does
+ # nothing). It goes before the first table header: appended at the end it would belong
+ # to the last table and switch nothing (measured on rc.1: the tool stayed in the request).
+ head, sep, tail = cfg.partition("\n[")
+ cfg = head + '\nweb_search = "disabled"' + sep + tail
if resume:
# A resumed session keeps the provider id it started under; Codex looks that id up in the
# config and refuses to load without it ("Model provider `azure` not found", a July
@@ -1581,9 +1597,11 @@ def _sanitize_codex_rollout(rollouts: list[str], *, content_only: bool = True) -
def _build_codex(provider: str, auth: Auth, model: str, prompt: str, cwd: str,
- env: dict, mcp_toml: str = "", resume_session_id: str | None = None) -> tuple[list[str], str]:
+ env: dict, mcp_toml: str = "", resume_session_id: str | None = None,
+ tools_disabled: list[str] | None = None) -> tuple[list[str], str]:
"""The exec command, and the note the transcript must carry when a follow-up's rollout is gone."""
- cfg_dir = _codex_prepare_env(provider, auth, model, cwd, env, mcp_toml, resume=bool(resume_session_id))
+ cfg_dir = _codex_prepare_env(provider, auth, model, cwd, env, mcp_toml, resume=bool(resume_session_id),
+ tools_disabled=tools_disabled)
# Drop --ephemeral so codex PERSISTS the rollout to $CODEX_HOME/sessions (inside the checkpointed
# workspace) — that's what makes a follow-up history-aware. Mirror the claude resume guard: only
# `resume <id>` if the rollout is actually present in the (re)hydrated workspace, else start fresh
@@ -5131,10 +5149,11 @@ def turn(req: TurnReq, identifier: str = "") -> dict:
model = model or CODEX_DEFAULT_MODEL
mcp_toml = _codex_mcp_toml(req.mcp_servers)
if use_appserver:
- _codex_prepare_env(req.provider, auth, model, cwd, env, mcp_toml, resume=bool(req.resume_session_id)) # config.toml + CODEX_HOME + auth
+ _codex_prepare_env(req.provider, auth, model, cwd, env, mcp_toml, resume=bool(req.resume_session_id),
+ tools_disabled=req.tools_disabled) # config.toml + CODEX_HOME + auth
else:
cmd, codex_note = _build_codex(req.provider, auth, model, req.prompt, cwd, env,
- mcp_toml=mcp_toml, resume_session_id=req.resume_session_id)
+ mcp_toml=mcp_toml, resume_session_id=req.resume_session_id, tools_disabled=req.tools_disabled)
elif backend == "hermes":
model = model or HERMES_DEFAULT_MODEL
hermes_provider = (req.provider or "bedrock").lower()
diff --git a/runner/tests/test_codex_web_search.py b/runner/tests/test_codex_web_search.py
new file mode 100644
index 00000000..98fade27
--- /dev/null
+++ b/runner/tests/test_codex_web_search.py
@@ -0,0 +1,30 @@
+"""Issue #150: codex's built-in web_search has one switch, the top-level config key."""
+import pathlib
+import sys
+
+sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
+import server as rs # noqa: E402
+
+
+def test_naming_web_search_in_the_disabled_list_turns_the_tool_off_in_config(tmp_path):
+ env = {"HOME": str(tmp_path)}
+ cfg_dir = rs._codex_prepare_env("openai", rs.Auth(api_key="k"), "gpt-5.5", str(tmp_path), env,
+ tools_disabled=["Bash", "web_search (search the web)"])
+ cfg = (cfg_dir / "config.toml").read_text()
+ import tomllib
+ doc = tomllib.loads(cfg)
+ # At the TOP level: a line appended after the last [table] header belongs to that table and
+ # switches nothing (rc.1 shipped exactly that; the tool stayed in the request).
+ assert doc["web_search"] == "disabled" and "web_search" not in doc["sandbox_workspace_write"]
+ assert doc["model"] == "gpt-5.5" and doc["model_providers"] # the rest of the file is intact
+ assert "Bash" not in cfg # the others stay a standing instruction, not config
+
+
+def test_the_switch_stays_out_of_config_unless_named(tmp_path):
+ env = {"HOME": str(tmp_path)}
+ cfg_dir = rs._codex_prepare_env("openai", rs.Auth(api_key="k"), "gpt-5.5", str(tmp_path), env, tools_disabled=["Bash"])
+ assert "web_search" not in (cfg_dir / "config.toml").read_text()
+ import tomllib
+ tomllib.loads((cfg_dir / "config.toml").read_text())
+ assert rs._codex_web_search_off(["WebSearch"]) and rs._codex_web_search_off(["web-search"]) \
+ and not rs._codex_web_search_off(None) and not rs._codex_web_search_off(["web"])
diff --git a/ui/src/app/(app)/integrations/page.tsx b/ui/src/app/(app)/integrations/page.tsx
index 3c58966d..071bf7d2 100644
--- a/ui/src/app/(app)/integrations/page.tsx
+++ b/ui/src/app/(app)/integrations/page.tsx
@@ -41,6 +41,8 @@ interface ProviderMeta {
secret_label: string;
key_hint?: string;
models: ModelRow[];
+ /** For the custom provider: every canonical id a harness can ask for, the choices of its rows. */
+ canonicals?: string[];
backends: string[];
}
interface Doc {
@@ -380,13 +382,16 @@ export default function IntegrationsPage() {
config: { ...editing.config, [f.key]: e.target.value },
})}>
<option value="openai">OpenAI Chat Completions</option>
+ <option value="responses">OpenAI Responses</option>
<option value="anthropic">Anthropic Messages</option>
</select>
<p className="field-help">
{editing.config['api_format'] === 'anthropic'
? 'Anthropic Messages format works with Claude Code, OpenCode, Pi, and DSH backends.'
+ : editing.config['api_format'] === 'responses'
+ ? 'OpenAI Responses format is what Codex speaks; only Codex can drive it. The endpoint gets /responses appended.'
: editing.config['api_format'] === 'openai'
- ? 'OpenAI Chat Completions format works with Hermes, OpenCode, Pi, and DSH backends. Codex and Claude Code cannot drive a custom OpenAI endpoint.'
+ ? 'OpenAI Chat Completions format works with Hermes, OpenCode, Pi, Qwen Code, Cline, Oh My Pi and DSH backends. Codex and Claude Code cannot drive a chat endpoint.'
: 'If you use Claude Code, choose Anthropic Messages format.'}
</p>
</div>
@@ -414,7 +419,7 @@ export default function IntegrationsPage() {
transition: 'left .15s' }} />
</button>
<span style={{ fontSize: 13, color: fullUrlOn ? 'var(--ink)' : 'var(--muted)' }}>
- {fullUrlOn ? 'On — the URL is used as-is' : 'Off — /chat/completions is appended'}
+ {fullUrlOn ? 'On, the URL is used as it is' : `Off, ${editing.config['api_format'] === 'anthropic' ? '/v1/messages' : editing.config['api_format'] === 'responses' ? '/responses' : '/chat/completions'} is appended`}
</span>
</div>
</div>
@@ -426,7 +431,7 @@ export default function IntegrationsPage() {
const fullUrl = editing.config['full_url'] === '1' || editing.config['full_url'] === 'true';
placeholder = fullUrl
? 'Enter the full request URL, including the path. The request will use this URL directly.'
- : 'Enter an OpenAI-compatible API endpoint, without a trailing slash. /chat/completions will be appended to your endpoint.';
+ : `Enter the endpoint without a trailing slash; ${editing.config['api_format'] === 'anthropic' ? '/v1/messages' : editing.config['api_format'] === 'responses' ? '/responses' : '/chat/completions'} is appended to it.`;
}
return (
<div className="field" key={f.key}>
@@ -456,13 +461,37 @@ export default function IntegrationsPage() {
const isCustom = editing.provider === 'custom';
const models = meta?.models || [];
if (isCustom) {
+ // The endpoint names its models its own way: each row pairs the model a harness
+ // picks with the name this endpoint wants on the wire, sent verbatim.
+ const rows = editing.models || [];
+ const choices = meta?.canonicals || [];
+ const setRows = (next: ModelRow[]) => setEditing({ ...editing, models: next });
return (
<div className="field">
- <label>Model</label>
+ <label>Models</label>
<p className="field-help">
- This integration serves the model ID you entered above. Add it in the
- mapping table below after saving.
+ The models this endpoint serves, and the name it wants for each one. Leave the
+ name blank to send the model id as it is.
</p>
+ {rows.map((r, idx) => (
+ <div className="itg-model-row" key={idx}>
+ <select className="select" aria-label="Model" value={r.canonical}
+ onChange={(e) => setRows(rows.map((x, i) => i === idx ? { ...x, canonical: e.target.value } : x))}>
+ <option value="">Choose a model</option>
+ {choices.map((c) => <option key={c} value={c}>{c}</option>)}
+ </select>
+ <input type="text" aria-label="Name on the wire" placeholder={r.canonical || 'same as the model id'}
+ value={r.provider_id === r.canonical ? '' : r.provider_id}
+ onChange={(e) => setRows(rows.map((x, i) => i === idx ? { ...x, provider_id: e.target.value } : x))} />
+ <button type="button" className="button" aria-label="Remove model"
+ onClick={() => setRows(rows.filter((_, i) => i !== idx))}>
+ <iconify-icon icon="tabler:x"></iconify-icon>
+ </button>
+ </div>
+ ))}
+ <button type="button" className="button" onClick={() => setRows([...rows, { canonical: '', provider_id: '' }])}>
+ <iconify-icon icon="tabler:plus"></iconify-icon>Add model
+ </button>
</div>
);
}
@@ -506,7 +535,8 @@ export default function IntegrationsPage() {
const mm = Object.fromEntries(Object.entries(doc.model_map).map(([k, v]) =>
[k, v === editingOriginal ? editing.name.trim() : v]));
if (await persist({
- integrations: [...rest, { ...editing, name: editing.name.trim(), models: [] }],
+ integrations: [...rest, { ...editing, name: editing.name.trim(),
+ models: (editing.models || []).filter((m) => m.canonical.trim()) }],
model_map: mm,
})) setEditing(null);
}}>{busy ? 'Saving…' : editingOriginal ? 'Save' : 'Create'}</button>
diff --git a/ui/src/app/revamp.css b/ui/src/app/revamp.css
index 7230f3e5..6c43b928 100644
--- a/ui/src/app/revamp.css
+++ b/ui/src/app/revamp.css
@@ -1685,6 +1685,10 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent;
color: var(--muted); font-size: 18px; cursor: pointer; }
.itg-frame-close:hover { background: var(--surface); color: var(--fg); }
+ /* a custom endpoint's model rows: the model a harness picks, the name the endpoint wants */
+ .itg-model-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; margin-bottom: 8px; }
+ .itg-model-row .select, .itg-model-row input { min-width: 0; }
+ @media (max-width: 480px) { .itg-model-row { grid-template-columns: minmax(0, 1fr) auto; } .itg-model-row input { grid-column: 1 / -1; } }
.itg-provider { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; text-align: left; }
.itg-provider.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }