Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

feat(core,web,cli,docs): every OpenRouter model speaks the Responses API (#705)

Yaowei Zhengcc31da0d8049
diff --git a/changelog/unreleased/2026-09-12-catalog-openrouter-responses.md b/changelog/unreleased/2026-09-12-catalog-openrouter-responses.md
new file mode 100644
index 00000000..b0ea357c
--- /dev/null
+++ b/changelog/unreleased/2026-09-12-catalog-openrouter-responses.md
@@ -0,0 +1,32 @@
+# Every OpenRouter model speaks the Responses API
+
+- **Date:** 2026-09-12
+- **Type:** feature
+- **Scope:** `core`, `web`, `cli`, `docs`, `model-catalog`
+- **PR:** [#705](https://github.com/Prism-Shadow/penguin-harness/pull/705)
+
+[中文版](2026-09-12-catalog-openrouter-responses.zh.md)
+
+Every OpenRouter preset in the built-in catalog moved to AgentHub's generic Responses client
+(`client_type = "openai-responses"`), and the OpenRouter provider group pins the same protocol,
+so a model added to that group by hand speaks it too.
+
+## Details
+
+- All 43 OpenRouter catalog rows pin `openai-responses`. Only the ten `openai/*` rows did
+ before; the rest carried `openai-chat`. The preset base URL is unchanged — OpenRouter serves
+ the Responses API at `{base}/responses` for every upstream it resells.
+- The `openrouter` entry in `MODEL_PROVIDERS` gained a group-level `clientType`, the mechanism
+ the vLLM group already used. `penguin config model add --provider openrouter` and the Web
+ App's add-model dialog write `openai-responses` for an id that has no catalog row of its own.
+- The add-model dialog's protocol note separates a gateway that pins a protocol from a
+ self-hosted group that pins one: for OpenRouter it says the base URL is already preset to the
+ gateway's endpoint, instead of asking for the address of the user's own server.
+- The models documentation was rewritten in both languages, and the `unified-llm-api`
+ skill's OpenRouter note now covers every id that gateway resells rather than its
+ `openai/*` ids alone.
+- Existing Projects keep what they stored. Presets are copied into `.project_config.toml` when
+ the Project is created and nothing rewrites them, so stored OpenRouter rows stay on
+ `openai-chat` until their owner presses **sync presets** on the models page, which rewrites
+ the catalog-owned fields — the protocol among them — and leaves credentials alone. Until
+ then the sync badge counts those rows.
diff --git a/changelog/unreleased/2026-09-12-catalog-openrouter-responses.zh.md b/changelog/unreleased/2026-09-12-catalog-openrouter-responses.zh.md
new file mode 100644
index 00000000..b2b09f29
--- /dev/null
+++ b/changelog/unreleased/2026-09-12-catalog-openrouter-responses.zh.md
@@ -0,0 +1,29 @@
+# OpenRouter 的每个模型都改走 Responses API
+
+- **Date:** 2026-09-12
+- **Type:** feature
+- **Scope:** `core`, `web`, `cli`, `docs`, `model-catalog`
+- **PR:** [#705](https://github.com/Prism-Shadow/penguin-harness/pull/705)
+
+[English](2026-09-12-catalog-openrouter-responses.md)
+
+内置目录中的 OpenRouter 预置条目全部改用 AgentHub 的通用 Responses 客户端
+(`client_type = "openai-responses"`),OpenRouter 分组本身也固定同一协议,因此手工添加进该分组的
+模型同样走这个协议。
+
+## 细节
+
+- 43 条 OpenRouter 目录条目全部固定 `openai-responses`。此前只有十条 `openai/*` 条目如此,其余
+ 都带的是 `openai-chat`。预置 base URL 不变——OpenRouter 为其转售的每一个上游模型都在
+ `{base}/responses` 上提供 Responses API。
+- `MODEL_PROVIDERS` 中的 `openrouter` 条目新增了分组级 `clientType`,沿用 vLLM 分组已有的机制。
+ 对于目录中没有对应条目的 id,`penguin config model add --provider openrouter` 与 Web App 的
+ 新增模型对话框都会写入 `openai-responses`。
+- 新增模型对话框的协议提示区分了「固定协议的网关分组」与「固定协议的自建分组」:对 OpenRouter 提示
+ base URL 已预填网关端点,而不再要求填写用户自己的服务地址。
+- 文档站的模型页中英双语同步重写;`unified-llm-api` skill 中关于 OpenRouter 的说明也从仅限
+ `openai/*` id 扩展为该网关转售的每一个 id。
+- 已有 Project 保持已存内容不变。预置条目是在 Project 创建时写入 `.project_config.toml` 的,此后
+ 没有任何机制会改写它们,因此已存的 OpenRouter 条目仍是 `openai-chat`,直到其所有者在模型页点击
+ **同步预置**——该操作会重写目录持有的字段(协议也在其中),并且不触碰凭证。在此之前,这些条目会
+ 被同步徽标计入。
diff --git a/packages/cli/src/commands/config.ts b/packages/cli/src/commands/config.ts
index db8bb5b4..2d3179ea 100644
--- a/packages/cli/src/commands/config.ts
+++ b/packages/cli/src/commands/config.ts
@@ -19,9 +19,10 @@
* a vendor the user did not name. For `model add`, a new entry's
* client_type and base_url are inherited from the built-in catalog row for that exact
* (provider, model_id) pair when one pins them, and otherwise default according to the
- * group's semantics (not set for first-party vendors; openai-chat for custom /
- * self-hosted groups / gateways, with the gateway's endpoint base URL pre-filled). For `model default`
- * / `model vision`, core validation raises an error when the reference is not
+ * group's semantics (not set for first-party vendors; the protocol a group pins where it
+ * pins one, and otherwise openai-chat for custom / self-hosted groups / gateways, with the
+ * gateway's endpoint base URL pre-filled). For `model default` / `model vision`, core
+ * validation raises an error when the reference is not
* found in models; `model remove` reports the same condition itself, since removal is
* idempotent in core, and clears the default / vision pointers that named the removed entry.
* `--root` specifies the data root directory (priority: option >
@@ -163,12 +164,12 @@ export function registerConfigCommand(program: Command, t: Messages): void {
// endpoint does so because its own id would not route otherwise — MiniMax M3 and the
// direct DeepSeek `deepseek-flash` — and an entry added by hand must inherit that pin
// or it is written unroutable. Failing a catalog row, the group decides: a group that
- // pins a protocol (vLLM) gets that pin, whatever the id; otherwise not set for
- // first-party vendor groups (AgentHub auto-routes by upstream id, with env fallback
- // keyed on id), and openai-chat for custom / user-defined / gateway groups, with the
- // gateway's endpoint base URL pre-filled as well. (An explicit --client-type /
- // --base-url is passed through and outranks both; core's addModel normalizes the
- // deprecated bare "openai" alias.)
+ // pins a protocol (OpenRouter, vLLM) gets that pin, whatever the id; otherwise not set
+ // for first-party vendor groups (AgentHub auto-routes by upstream id, with env fallback
+ // keyed on id), and openai-chat for the remaining custom / user-defined / gateway
+ // groups, with the gateway's endpoint base URL pre-filled as well. (An explicit
+ // --client-type / --base-url is passed through and outranks both; core's addModel
+ // normalizes the deprecated bare "openai" alias.)
const pInfo = providerInfo(provider);
const catalogEntry = catalogEntryFor(provider, modelId);
const openAiDefault =
diff --git a/packages/cli/test/config-model.test.ts b/packages/cli/test/config-model.test.ts
index f267d052..a05079a2 100644
--- a/packages/cli/test/config-model.test.ts
+++ b/packages/cli/test/config-model.test.ts
@@ -175,7 +175,7 @@ describe("penguin config model add/list (--root plus provider / model_id stored
expect(list.out.split("\n").some((l) => /anthropic\s+claude-sonnet-4-6/.test(l))).toBe(true);
});
- it("client_type defaults by grouping semantics (PRN-021): custom / self-hosted / gateway get openai-chat, first-party providers get none", async () => {
+ it("client_type defaults by grouping semantics (PRN-021): custom / self-hosted / gateway get openai-chat unless the group pins another protocol, first-party providers get none", async () => {
// The custom group and self-hosted groups (--provider not a catalog value): default to client_type=openai.
await runModel([
"add",
@@ -197,7 +197,9 @@ describe("penguin config model add/list (--root plus provider / model_id stored
"--root",
tmpRoot,
]);
- // Gateway group: openai-chat + the gateway's endpoint base URL pre-filled.
+ // Gateway group: the gateway's endpoint base URL pre-filled, and the protocol the group
+ // pins — OpenRouter speaks the Responses API for every model it serves, so an id added by
+ // hand gets openai-responses rather than the openai-chat the other gateways default to.
await runModel([
"add",
"--model-id",
@@ -228,7 +230,7 @@ describe("penguin config model add/list (--root plus provider / model_id stored
expect(by("custom", "my-openai-proxy").client_type).toBe("openai-chat");
expect(by("mylab", "in-house-1").client_type).toBe("openai-chat");
expect(by("deepseek", "my-fine-tune").client_type).toBeUndefined();
- expect(by("openrouter", "acme/some-model").client_type).toBe("openai-chat");
+ expect(by("openrouter", "acme/some-model").client_type).toBe("openai-responses");
expect(by("openrouter", "acme/some-model").base_url).toBe("https://openrouter.ai/api/v1");
expect(by("mylab", "special-1").client_type).toBe("verbatim-type");
});
@@ -257,7 +259,8 @@ describe("penguin config model add/list (--root plus provider / model_id stored
tmpRoot,
]);
// The same id under a group that does not sell it has no catalog row, so the group rule
- // still decides: a gateway gets openai-chat and its own endpoint, not DeepSeek's.
+ // still decides: OpenRouter gives it the openai-responses its group pins and its own
+ // endpoint, not DeepSeek's client and vendor endpoint.
await runModel([
"add",
"--model-id",
@@ -298,7 +301,7 @@ describe("penguin config model add/list (--root plus provider / model_id stored
parsed.models.find((m) => m.provider === p && m.model_id === id)!;
expect(by("deepseek", "deepseek-flash").client_type).toBe("deepseek-v4");
expect(by("deepseek", "deepseek-flash").base_url).toBe("https://api.deepseek.com");
- expect(by("openrouter", "deepseek-flash").client_type).toBe("openai-chat");
+ expect(by("openrouter", "deepseek-flash").client_type).toBe("openai-responses");
expect(by("openrouter", "deepseek-flash").base_url).toBe("https://openrouter.ai/api/v1");
expect(by("minimax", "MiniMax-M3").client_type).toBe("openai-chat");
expect(by("minimax", "MiniMax-M3").base_url).toBe("https://proxy.example/v1");
diff --git a/packages/core/src/state/model-catalog.ts b/packages/core/src/state/model-catalog.ts
index dddb5e3d..b0e42362 100644
--- a/packages/core/src/state/model-catalog.ts
+++ b/packages/core/src/state/model-catalog.ts
@@ -41,20 +41,21 @@
* auto-routed by AgentHub and leave client_type unset; the six gateway groups (OpenRouter,
* Fireworks AI, SiliconFlow, TokenDance, Qwen Pay-As-You-Go, Qwen Token Plan) can't be
* auto-routed, so every gateway row **always pins an explicit client_type** and inlines its
- * preset base URL. The vLLM group pins one too, but as a property of the GROUP rather than
- * of each row (ModelProviderInfo.clientType, read through providerClientType): a model the
- * user adds there speaks the same protocol as the presets, and has no preset base URL to
- * inherit — see the group's own block comment.
+ * preset base URL. Two groups pin at GROUP level as well (ModelProviderInfo.clientType, read
+ * through providerClientType), so that a model the user adds there speaks the same protocol
+ * as the presets: vLLM, whose added models have no preset base URL to inherit either, and
+ * OpenRouter, whose do — see each group's own block comment.
* That pin is load-bearing, not decoration: AgentHub's AutoLLMClient matches raw substrings
* against `client_type || model_id` and never looks at base_url, so an unpinned gateway id
* would be routed by its own spelling — `openai/gpt-5.6-sol` would reach the first-party
* GPT-5.6 client aimed at a gateway, and `anthropic/claude-opus-4.8` would throw outright
- * (dotted "4.8" matches neither "4-8" nor "-5"). Two protocols are pinned:
- * - `openai-chat` for most rows (AgentHub 0.4.2's canonical name for the generic Chat
- * Completions client — the bare "openai" spelling is a deprecated upstream alias, see
- * canonicalClientType);
- * - `openai-responses` for the OpenRouter `openai/*` rows, whose upstream really is an
- * OpenAI Responses server (see the OpenRouter block comment for why only those rows);
+ * (dotted "4.8" matches neither "4-8" nor "-5"). Three protocols are pinned:
+ * - `openai-responses` for every OpenRouter row: OpenRouter serves the Responses API for
+ * every upstream at the same base URL the rows already carry, and the group pins the same
+ * protocol so a user-added entry inherits it;
+ * - `openai-chat` for the other gateway rows (AgentHub 0.4.2's canonical name for the
+ * generic Chat Completions client — the bare "openai" spelling is a deprecated upstream
+ * alias, see canonicalClientType);
* - `openai-chat-vllm-adapter` for the vLLM group, which is Chat Completions on the wire
* but maps the thinking level onto the served model's own chat template
* (VLLM_CLIENT_TYPE).
@@ -114,7 +115,7 @@ export interface ModelProviderInfo {
* The AgentHub protocol EVERY entry in this group speaks, models the user adds included.
*
* Set it only where the group itself decides the answer and no other property already
- * implies it: the gateways derive `openai-chat` from carrying a `gatewayBaseUrl`, and
+ * implies it: the other gateways derive `openai-chat` from carrying a `gatewayBaseUrl`, and
* `custom` / user-defined groups deliberately declare nothing — their whole point is that
* the protocol is detected from the endpoint or picked by hand, and a pin here would
* take that choice away.
@@ -202,10 +203,10 @@ const DEEPSEEK_BASE_URL = "https://api.deepseek.com";
*
* The six gateway groups — OpenRouter, Fireworks AI, SiliconFlow, TokenDance, Qwen
* Pay-As-You-Go and Qwen Token Plan — reach their models through one of AgentHub's generic
- * OpenAI-protocol clients (`openai-chat`, or `openai-responses` for the OpenRouter
- * `openai/*` rows). Those clients read **OPENAI_API_KEY / OPENAI_BASE_URL** when the
- * credential is blank, not the gateway's own variable names, so every gateway group records
- * the OPENAI_* pair and the env fallback hint the frontend shows is accurate either way.
+ * OpenAI-protocol clients (`openai-responses` for OpenRouter, `openai-chat` for the rest).
+ * Those clients read **OPENAI_API_KEY / OPENAI_BASE_URL** when the credential is blank, not
+ * the gateway's own variable names, so every gateway group records the OPENAI_* pair and the
+ * env fallback hint the frontend shows is accurate either way.
*/
export const MODEL_PROVIDERS: ModelProviderInfo[] = [
{
@@ -240,6 +241,9 @@ export const MODEL_PROVIDERS: ModelProviderInfo[] = [
apiKeyUrl: "https://openrouter.ai/workspaces/default/keys",
modelsUrl: "https://openrouter.ai/models",
gatewayBaseUrl: OPENROUTER_BASE_URL,
+ // The whole group speaks the Responses API, which OpenRouter serves at the preset base
+ // URL below for every upstream — presets and user-added entries alike.
+ clientType: "openai-responses",
},
{
id: "fireworks",
@@ -552,14 +556,12 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
// every pre-existing openai/* and google/* row were re-read on 2026-08-18 from the model
// pages and the per-model endpoints API.
//
- // Protocol: rows pin `openai-chat` except the `openai/*` rows, which pin
- // `openai-responses` - OpenRouter serves the Responses API at {base}/responses (the same
- // https://openrouter.ai/api/v1 base URL these rows already carry), and AgentHub 0.4.2
- // verified that pairing live. The switch is deliberately limited to the OpenAI family:
- // OpenRouter will translate /responses for any upstream, but the Responses client leans on
- // OpenAI-specific reasoning-item round-tripping (replaying encrypted_content / signature /
- // summary and the assistant `phase`), which is only guaranteed when the upstream is
- // genuinely OpenAI. Non-OpenAI rows therefore stay on Chat Completions.
+ // Protocol: every row pins `openai-responses`. OpenRouter serves the Responses API at
+ // {base}/responses for every upstream, at the same https://openrouter.ai/api/v1 base URL
+ // the rows already carry, and the group pins the same protocol so an entry added to it by
+ // hand inherits it. The generic Responses client sends a text-only tool result as a plain
+ // string (AgentHub 0.4.11) and replays reasoning items only where the upstream returned
+ // them.
//
// Price buckets: cache_read stores the published input_cache_read
// (falling back to the input price for the rows without one — the :free rows and the
@@ -588,7 +590,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1000000,
pricing: usd(1, 12.5, 50),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -598,7 +600,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1000000,
pricing: usd(0.5, 6.25, 25),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -608,7 +610,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1000000,
pricing: usd(0.5, 6.25, 25),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -618,7 +620,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1000000,
pricing: usd(0.5, 6.25, 25),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -628,7 +630,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1000000,
pricing: usd(0.2, 2.5, 10),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -644,7 +646,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
pricing: usd(0.006, 0.3, 1.2),
offPeakDiscount: DEEPSEEK_OFF_PEAK,
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -654,7 +656,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1000000,
pricing: usd(0.0157192, 0.078596, 0.157192),
supportsVision: false,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -664,7 +666,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1000000,
pricing: usd(0.0168, 0.0679, 0.168),
supportsVision: false,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -679,7 +681,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1048576,
pricing: usd(0.007, 0.22, 0.66),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -692,7 +694,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1048576,
pricing: usd(0.022, 0.66, 1.98),
supportsVision: false,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -702,7 +704,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1000000,
pricing: usd(0.022, 0.66, 1.98),
supportsVision: false,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -717,7 +719,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
pricing: usd(0.15, 1.5, 7.5),
discount: 0.5,
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -733,7 +735,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
pricing: usd(0.15, 1.5, 7.5),
discount: 0.5,
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -752,7 +754,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
pricing: usd(0.15, 1.5, 7.5),
discount: 0.5,
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -765,7 +767,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1048576,
pricing: usd(0.15, 1.5, 9),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -777,7 +779,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1048576,
pricing: usd(0.03, 0.3, 2.5),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -788,7 +790,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1048576,
pricing: usd(0.06, 0.3, 1.2),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -798,7 +800,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1000000,
pricing: usd(0.3, 3, 15),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -808,7 +810,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 262144,
pricing: usd(0.0992, 0.589, 2.48),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -818,12 +820,11 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1000000,
pricing: usd(0, 0, 0),
supportsVision: false,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
- // The openai/* rows below mirror the direct OpenAI group one-for-one, and are the only
- // gateway rows on the Responses protocol (see the block comment). Their context windows
- // are OpenRouter's published 1,050,000 / 400,000, matching the direct rows.
+ // The openai/* rows below mirror the direct OpenAI group one-for-one. Their context
+ // windows are OpenRouter's published 1,050,000 / 400,000, matching the direct rows.
{
// Read 2026-09-09 from the models API and the per-model endpoints API: the default
// endpoint is OpenAI's own, listed at $10 input / $1 cached input / $12.5 cache write /
@@ -952,7 +953,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 128000,
pricing: usd(0, 0, 0),
supportsVision: false,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -962,7 +963,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1000000,
pricing: usd(0.25, 2.5, 6),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -972,7 +973,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 262144,
pricing: usd(0.05, 0.14, 1),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -983,7 +984,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 256000,
pricing: usd(0.04, 0.2, 1.15),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -998,7 +999,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1048576,
pricing: usd(0.042, 0.834, 2.501),
supportsVision: false,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -1008,7 +1009,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 262144,
pricing: usd(0.033, 0.132, 0.528),
supportsVision: false,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -1021,7 +1022,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1000000,
pricing: usd(0.17, 1, 4.05),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -1033,7 +1034,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 500000,
pricing: usd(0.5, 2, 6),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -1043,7 +1044,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 500000,
pricing: usd(0.3, 2, 6),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -1053,7 +1054,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1048576,
pricing: usd(0.0028, 0.14, 0.28),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -1066,7 +1067,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1048576,
pricing: usd(0.26, 1.4, 4.4),
supportsVision: false,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -1074,14 +1075,14 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
// promotion through 2026-09-09 16:00 UTC (Z.AI's own price list names the same window as
// 24:00 on 2026-09-09, UTC+8). Stored at the discounted rate the gateway actually bills;
// when it lapses, restore 0.03 / 0.15 / 0.5. The listing takes text, images and video,
- // and the generic openai-chat client it pins converts image_url parts.
+ // and the generic Responses client it pins carries image parts through.
modelId: "z-ai/glm-5.3-flash",
displayName: "GLM-5.3 Flash",
provider: "openrouter",
contextWindow: 1048576,
pricing: usd(0.015, 0.075, 0.25),
supportsVision: true,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
{
@@ -1091,7 +1092,7 @@ export const MODEL_CATALOG: ModelCatalogEntry[] = [
contextWindow: 1000000,
pricing: usd(0.1261, 0.679, 2.134),
supportsVision: false,
- clientType: "openai-chat",
+ clientType: "openai-responses",
baseUrl: OPENROUTER_BASE_URL,
},
// -- Fireworks AI (gateway, standard serverless USD pricing: cached input / uncached
@@ -2057,6 +2058,10 @@ export function providerInfo(providerId: string): ModelProviderInfo | undefined
* The protocol a group pins on every one of its entries (ModelProviderInfo.clientType), or
* undefined when the group pins none — an unknown id (a user-defined group) included.
*
+ * Two groups pin: vLLM, whose models are served by the user's own vLLM adapter, and
+ * OpenRouter, whose models all speak the Responses API OpenRouter serves at its preset base
+ * URL.
+ *
* The single entry point for the pin, so the places that decide a saved model's client_type
* cannot drift apart: the web add-model dialog's default, moving an entry between groups,
* the last-resort protocol on the save paths that do not probe, the env-var hint, and the
@@ -2224,8 +2229,8 @@ export function fastModeProtocol(
* config, avoiding duplicate hand-written copies). `provider` and `model_id` are persisted as
* separate fields (`model_id` is the plain upstream id); models whose upstream id can be
* auto-routed by AgentHub leave client_type unset; gateway models (OpenRouter / SiliconFlow)
- * always pin a client_type — openai-chat, or openai-responses for the OpenRouter openai/*
- * rows — and inline a preset base_url. The direct MiniMax M3 entry also pins its protocol and
+ * always pin a client_type — openai-responses for the OpenRouter rows, openai-chat for the
+ * rest — and inline a preset base_url. The direct MiniMax M3 entry also pins its protocol and
* endpoint. No secrets are included, so only an API key is needed.
*
* Pricing is written as the EFFECTIVE rate (effectivePricing: list less any running
diff --git a/packages/core/test/model-catalog.test.ts b/packages/core/test/model-catalog.test.ts
index 0e2fbec9..8a73a180 100644
--- a/packages/core/test/model-catalog.test.ts
+++ b/packages/core/test/model-catalog.test.ts
@@ -181,11 +181,15 @@ describe("model-catalog", () => {
// The group pin, read the one way every call site reads it.
expect(providerClientType("vllm")).toBe("openai-chat-vllm-adapter");
expect(providerInfo("vllm")!.gatewayBaseUrl).toBeUndefined();
- // No group but vLLM declares one: the gateways derive openai-chat from their preset
- // endpoint, and custom / user-defined groups leave the protocol to detection.
+ // Two groups declare one, in MODEL_PROVIDERS order: OpenRouter, whose entries all speak
+ // the Responses API its preset endpoint serves, and vLLM. The remaining gateways derive
+ // openai-chat from their preset endpoint, and custom / user-defined groups leave the
+ // protocol to detection.
expect(MODEL_PROVIDERS.filter((p) => p.clientType !== undefined).map((p) => p.id)).toEqual([
+ "openrouter",
"vllm",
]);
+ expect(providerClientType("openrouter")).toBe("openai-responses");
expect(providerClientType("custom")).toBeUndefined();
expect(providerClientType("my-own-group")).toBeUndefined();
// Presets reach a Project with the pin and the zero rate, and without an endpoint: what a
@@ -295,7 +299,7 @@ describe("model-catalog", () => {
}
});
- it("gateway models (OpenRouter / SiliconFlow / Qwen Token Plan): openai protocol + preset base URL; env fallback is OPENAI_API_KEY", () => {
+ it("gateway models (OpenRouter / SiliconFlow / Qwen Token Plan): OpenRouter pins Responses and the rest Chat Completions, all on a preset base URL; env fallback is OPENAI_API_KEY", () => {
const or = MODEL_CATALOG.filter((m) => m.provider === "openrouter");
// Dictionary order, newer versions of a series first (gpt-6-* before gpt-5.6-*,
// gpt-5.6-* before gpt-5.5, opus-4.8 before 4.7) — precomputed in the catalog, no
@@ -348,15 +352,13 @@ describe("model-catalog", () => {
for (const m of or) {
// Every gateway row pins a client type — never left to AgentHub's id-substring routing,
// which would send openai/gpt-5.6-* to the first-party GPT client and throw outright on
- // the dotted anthropic/claude-opus-4.8. The openai/* rows speak the Responses protocol
- // (OpenRouter serves it at {base}/responses); everything else is Chat Completions.
- expect(m.clientType, m.modelId).toBe(
- m.modelId.startsWith("openai/") ? "openai-responses" : "openai-chat",
- );
+ // the dotted anthropic/claude-opus-4.8. Whatever the upstream, OpenRouter serves the
+ // Responses API at {base}/responses, so the whole group pins it.
+ expect(m.clientType, m.modelId).toBe("openai-responses");
expect(m.baseUrl).toBe("https://openrouter.ai/api/v1");
}
- // Both protocols read the same OPENAI_* pair, so the env-fallback hint is unaffected by
- // the split.
+ // The Responses client reads the same OPENAI_* pair as the Chat Completions one the other
+ // gateways pin, so the env-fallback hint is the same across every gateway group.
for (const m of or) {
expect(resolveModelEnv(m.modelId, m.clientType)?.envKey, m.modelId).toBe("OPENAI_API_KEY");
}
@@ -790,10 +792,10 @@ describe("model-catalog", () => {
glm53for.pricing!.output,
]).toEqual([0.015, 0.075, 0.25]);
// Vision agrees on both routes: the direct row's AgentHub GLM client forwards image_url
- // parts for this one id, and the gateway row's generic openai-chat client carries them
- // for any id. It is the only vision-capable row in the direct Z.AI group.
+ // parts for this one id, and the gateway row's generic Responses client carries them for
+ // any id. It is the only vision-capable row in the direct Z.AI group.
expect(glm53f.clientType).toBeUndefined();
- expect(glm53for.clientType).toBe("openai-chat");
+ expect(glm53for.clientType).toBe("openai-responses");
for (const m of MODEL_CATALOG.filter((m) => m.provider === "zhipu")) {
expect(m.supportsVision, m.modelId).toBe(m.modelId === "glm-5.3-flash");
}
@@ -1040,8 +1042,9 @@ describe("resolveModelEnv (PRN-021: env fallback resolved by AgentHub routing ru
expect(resolveModelEnv("deepseek-v4-pro")?.envKey).toBe("DEEPSEEK_API_KEY");
// The dotted V4.1 spelling still carries the deepseek-v4 substring AutoLLMClient routes
// on. It survives in the catalog as a RESOLD id — TokenDance's deepseek-v4.1-flash and
- // OpenRouter's deepseek/deepseek-v4.1-flash, both of which pin openai-chat anyway — so
- // this branch is what the bare spelling would resolve to, not what those rows use.
+ // OpenRouter's deepseek/deepseek-v4.1-flash, both of which pin an OpenAI-protocol client
+ // anyway — so this branch is what the bare spelling would resolve to, not what those
+ // rows use.
expect(resolveModelEnv("deepseek-v4.1-flash")?.envKey).toBe("DEEPSEEK_API_KEY");
expect(resolveModelEnv("deepseek-v4.1-flash")?.envBaseUrlKey).toBe("DEEPSEEK_BASE_URL");
// The released direct id carries no `deepseek-v4` substring, and AgentHub 0.4.11 routes
diff --git a/packages/core/test/state.test.ts b/packages/core/test/state.test.ts
index 9d609839..57df85ce 100644
--- a/packages/core/test/state.test.ts
+++ b/packages/core/test/state.test.ts
@@ -1343,8 +1343,8 @@ describe("project-config round trip", () => {
// every priced catalog entry stores USD pricing.
if (cat.pricing === undefined) expect(entry.pricing).toBeUndefined();
else expect(entry.pricing?.unit).toBe("usd_per_mtok");
- // A model that auto-routes leaves client_type unset; a gateway model (OpenRouter)
- // explicitly sets it to openai.
+ // A model that auto-routes leaves client_type unset; a gateway model pins one
+ // explicitly (OpenRouter pins openai-responses, the other gateways openai-chat).
expect(entry.client_type).toBe(cat.clientType);
// A gateway model has its base URL preset inline (no key included); other models have
// no credential.
diff --git a/packages/docs/content/models.en.md b/packages/docs/content/models.en.md
index 2ddea917..53e2d820 100644
--- a/packages/docs/content/models.en.md
+++ b/packages/docs/content/models.en.md
@@ -76,7 +76,7 @@ Built-in groups and their env-var fallbacks (catalog source: `packages/core/src/
| qwen-token-plan | `OPENAI_API_KEY` | Qwen Token Plan subscription gateway, preset base URL `https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1`; pricing from each model page's official list price (the preview model has only a quota-multiplier promo, no list price) |
| custom | `OPENAI_API_KEY` | Any OpenAI-protocol endpoint |
-The gateway groups (openrouter / fireworks / siliconflow / tokendance / qwen-pay-as-you-go / qwen-token-plan) go through AgentHub's generic OpenAI-protocol clients, so with blank credentials they read `OPENAI_API_KEY` — not a gateway-specific variable. Most gateway presets pin the Chat Completions client (`client_type = "openai-chat"`); the OpenRouter `openai/*` presets pin the Responses client (`client_type = "openai-responses"`) instead, because OpenRouter serves the Responses API at the same base URL and those rows' upstream is OpenAI itself. Both clients read the same `OPENAI_*` variables, so the credential rules are identical either way. The direct MiniMax M3 client reads `MINIMAX_API_KEY`. The built-in MiniMax preset pins `https://api.minimax.io/v1`; `MINIMAX_BASE_URL` is consulted only for entries without an inline `base_url`. M3 pricing records MiniMax's standard pay-as-you-go tier at 512K input tokens or below; every rate doubles above that and the priority tier is 1.5x, so long-context and priority usage is underestimated — the same base-tier convention already used for OpenAI (>272K) and Gemini 3.1 Pro (>200K).
+The gateway groups (openrouter / fireworks / siliconflow / tokendance / qwen-pay-as-you-go / qwen-token-plan) go through AgentHub's generic OpenAI-protocol clients, so with blank credentials they read `OPENAI_API_KEY` — not a gateway-specific variable. The OpenRouter group uses the Responses client (`client_type = "openai-responses"`) throughout — its presets and any model you add to the group alike — because OpenRouter serves the Responses API at that same base URL for every model it resells; the other gateway presets pin the Chat Completions client (`client_type = "openai-chat"`). Both clients read the same `OPENAI_*` variables, so the credential rules are identical either way. The direct MiniMax M3 client reads `MINIMAX_API_KEY`. The built-in MiniMax preset pins `https://api.minimax.io/v1`; `MINIMAX_BASE_URL` is consulted only for entries without an inline `base_url`. M3 pricing records MiniMax's standard pay-as-you-go tier at 512K input tokens or below; every rate doubles above that and the priority tier is 1.5x, so long-context and priority usage is underestimated — the same base-tier convention already used for OpenAI (>272K) and Gemini 3.1 Pro (>200K).
The preset catalog also carries OpenRouter's free tier: the `:free` model variant `nvidia/nemotron-3-ultra-550b-a55b:free` and the `openrouter/free` unified Free Models Router. They cost nothing, but are subject to OpenRouter's free-tier rate limits and data policy.
diff --git a/packages/docs/content/models.zh.md b/packages/docs/content/models.zh.md
index 42706b23..33917839 100644
--- a/packages/docs/content/models.zh.md
+++ b/packages/docs/content/models.zh.md
@@ -76,7 +76,7 @@ api_key = "sk-..."
| qwen-token-plan | `OPENAI_API_KEY` | Qwen Token Plan 订阅网关,预置 base URL `https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1`;定价取各模型页官方牌价(预览模型仅配额倍率促销、无牌价) |
| custom | `OPENAI_API_KEY` | 任意 OpenAI 协议端点 |
-网关分组(openrouter / fireworks / siliconflow / tokendance / qwen-pay-as-you-go / qwen-token-plan)经 AgentHub 的通用 OpenAI 协议客户端请求,因此凭证留空时读取的是 `OPENAI_API_KEY`,而非网关自己的变量名。多数网关预置固定 Chat Completions 客户端(`client_type = "openai-chat"`);OpenRouter 的 `openai/*` 预置则固定 Responses 客户端(`client_type = "openai-responses"`)——OpenRouter 在同一 base URL 上提供 Responses API,且这些条目的上游本就是 OpenAI。两种客户端读取相同的 `OPENAI_*` 变量,凭证规则完全一致。直连 MiniMax M3 客户端读取 `MINIMAX_API_KEY`。内置 MiniMax 预设固定使用 `https://api.minimax.io/v1`;仅当模型条目未内联 `base_url` 时才读取 `MINIMAX_BASE_URL`。M3 价格取 MiniMax 按量付费的标准档、输入不超过 512K Token 的牌价;超过 512K 后各档价格翻倍,priority 档另为 1.5 倍,因此长上下文与 priority 用量会被低估——与 OpenAI(>272K)、Gemini 3.1 Pro(>200K)沿用的基准档口径一致。
+网关分组(openrouter / fireworks / siliconflow / tokendance / qwen-pay-as-you-go / qwen-token-plan)经 AgentHub 的通用 OpenAI 协议客户端请求,因此凭证留空时读取的是 `OPENAI_API_KEY`,而非网关自己的变量名。OpenRouter 分组整体使用 Responses 客户端(`client_type = "openai-responses"`)——预置条目与你自行添加进该分组的模型都是——因为 OpenRouter 为其转售的每一个模型都在同一 base URL 上提供 Responses API;其余网关预置则固定 Chat Completions 客户端(`client_type = "openai-chat"`)。两种客户端读取相同的 `OPENAI_*` 变量,凭证规则完全一致。直连 MiniMax M3 客户端读取 `MINIMAX_API_KEY`。内置 MiniMax 预设固定使用 `https://api.minimax.io/v1`;仅当模型条目未内联 `base_url` 时才读取 `MINIMAX_BASE_URL`。M3 价格取 MiniMax 按量付费的标准档、输入不超过 512K Token 的牌价;超过 512K 后各档价格翻倍,priority 档另为 1.5 倍,因此长上下文与 priority 用量会被低估——与 OpenAI(>272K)、Gemini 3.1 Pro(>200K)沿用的基准档口径一致。
预置目录还收录了 OpenRouter 的免费档:`:free` 模型变体 `nvidia/nemotron-3-ultra-550b-a55b:free` 与统一路由 `openrouter/free`(Free Models Router),零成本可用,但受 OpenRouter 免费档速率限制与数据政策约束。
diff --git a/packages/server/src/services/project-config-service.ts b/packages/server/src/services/project-config-service.ts
index d8111b9a..42fc31e8 100644
--- a/packages/server/src/services/project-config-service.ts
+++ b/packages/server/src/services/project-config-service.ts
@@ -102,8 +102,8 @@ export function maskApiKey(key: string): string {
* official endpoint, so consulting the vendor variable (ANTHROPIC_API_KEY, …) is the intended
* configuration and its value may be previewed masked. Excluded — no detection, no preview:
*
- * - gateway groups and any group pinning a protocol, e.g. vLLM (both reach a generic
- * OpenAI-protocol client whose fallback is OPENAI_API_KEY, the *official OpenAI*
+ * - gateway groups and any group pinning a protocol, e.g. OpenRouter or vLLM (both reach a
+ * generic OpenAI-protocol client whose fallback is OPENAI_API_KEY, the *official OpenAI*
* variable; steering it to a reseller or to the user's own server is exactly the
* misconfiguration the preview must not encourage), and the custom group;
* - user-defined groups (not in MODEL_PROVIDERS at all);
diff --git a/packages/server/test/models.test.ts b/packages/server/test/models.test.ts
index c20efaab..51073ef2 100644
--- a/packages/server/test/models.test.ts
+++ b/packages/server/test/models.test.ts
@@ -126,9 +126,9 @@ describe("models preset & catalog enrichment", () => {
expect(pick(body, "deepseek", "deepseek-flash").isDefault).toBe(true);
// OpenRouter gateway model: the upstream id contains `/`, but under column storage it's just a
- // plain string; openai-chat protocol + a preset base URL inlined on the entry (no secret).
+ // plain string; openai-responses protocol + a preset base URL inlined on the entry (no secret).
const mimo = pick(body, "openrouter", "xiaomi/mimo-v2.5");
- expect(mimo.clientType).toBe("openai-chat");
+ expect(mimo.clientType).toBe("openai-responses");
expect(mimo.credential?.baseUrl).toBe("https://openrouter.ai/api/v1");
expect(mimo.credential?.apiKeyMasked).toBeUndefined();
diff --git a/packages/web/src/features/models/models-page.tsx b/packages/web/src/features/models/models-page.tsx
index bd029a79..96434423 100644
--- a/packages/web/src/features/models/models-page.tsx
+++ b/packages/web/src/features/models/models-page.tsx
@@ -234,8 +234,8 @@ export function decimalOnly(v: string): string {
* Custom keeps a generic protocol client type (protocol detection / the in-field picker
* manage those) and otherwise switches to the generic OpenAI Chat Completions client — an
* unroutable or vendor-pinned type must not leak into a custom group. Every other group
- * keeps the current value: a first-party group auto-routes by id, and a gateway's rows
- * carry the pin their preset already gave them.
+ * keeps the current value: a first-party group auto-routes by id, and the gateways that
+ * pin nothing at group level leave their rows on the pin their preset already gave them.
*/
export function clientTypeAfterProviderChange(provider: string, current: string): string {
const pinned = providerClientType(provider);
@@ -2228,13 +2228,14 @@ function ModelDialog({
output: usdToInput(row.output, currency),
};
}
- // New model: protocol follows group semantics — a group that pins one (vLLM) hands it
- // to the new entry outright; a first-party vendor group doesn't persist client_type
- // (AgentHub auto-routes by upstream id, with env fallback resolved live from the id);
- // custom / user-defined groups / gateways use a fixed openai-chat protocol (env fallback
- // OPENAI_*), and gateways additionally pre-fill their endpoint base URL. provider keeps
- // the entry point's original value (a user-defined group must not collapse into custom),
- // stored as a separate field from model_id, with no concatenation on save.
+ // New model: protocol follows group semantics — a group that pins one (OpenRouter,
+ // vLLM) hands it to the new entry outright; a first-party vendor group doesn't persist
+ // client_type (AgentHub auto-routes by upstream id, with env fallback resolved live from
+ // the id); custom / user-defined groups and the remaining gateways use a fixed
+ // openai-chat protocol (env fallback OPENAI_*), and gateways additionally pre-fill their
+ // endpoint base URL. provider keeps the entry point's original value (a user-defined
+ // group must not collapse into custom), stored as a separate field from model_id, with
+ // no concatenation on save.
const info = providerInfo(addProvider);
const pinnedClientType = providerClientType(addProvider);
const vendorAdd =
@@ -2255,7 +2256,8 @@ function ModelDialog({
fastMode: false,
// No protocol is preselected for a custom / user-defined group: it is detected from
// the endpoint (on demand, or on save while still unset) or picked by hand. Vendor
- // groups auto-route by model id, and gateways keep their preset Chat Completions pin.
+ // groups auto-route by model id; a gateway takes the protocol its group pins, or the
+ // preset Chat Completions pin where the group pins nothing.
clientType:
pinnedClientType ?? (vendorAdd || isCustomLikeGroup(addProvider) ? "" : "openai-chat"),
cacheRead: "",
@@ -2673,8 +2675,9 @@ function ModelDialog({
form.modelId.trim(),
envHintClientType(form.provider, form.clientType),
)?.envKey;
- // The protocol this group pins on every entry, user-added ones included (vLLM); undefined
- // for every group that leaves the protocol to auto-routing, a gateway preset, or detection.
+ // The protocol this group pins on every entry, user-added ones included (OpenRouter,
+ // vLLM); undefined for every group that leaves the protocol to auto-routing, a gateway
+ // preset, or detection.
const pinnedGroupClientType = providerClientType(form.provider);
// First-party provider group (built-in, non-gateway, non-custom, no group-level pin):
// adding goes through auto-routing — show a hint when the id can't be routed
@@ -2935,9 +2938,10 @@ function ModelDialog({
{/* Adding a model: protocol note first (preset direct-vendor group = only the
vendor's official protocol, named via the group label — the in-field suffix
on the base URL below says which path; a group that pins a protocol = that
- protocol, named outright, plus its own endpoint; custom / self-defined group /
- gateway = fixed OpenAI protocol), then the identity fields ("get model id /
- API key" links next to the respective inputs; fill in the id to test
+ protocol, named outright, with the endpoint the user's own for a self-hosted
+ group and already filled in for a gateway; custom / self-defined group / an
+ unpinned gateway = fixed OpenAI protocol), then the identity fields ("get model
+ id / API key" links next to the respective inputs; fill in the id to test
connectivity — verify before saving). */}
{isNew && (
<>
@@ -2945,7 +2949,9 @@ function ModelDialog({
{vendorGroup && dialogProvider
? S.models.vendorProtocolHint(dialogProvider.label)
: pinnedGroupClientType !== undefined
- ? S.models.addProtocolHintPinned(pinnedGroupClientType)
+ ? dialogProvider?.gatewayBaseUrl !== undefined
+ ? S.models.addProtocolHintPinnedGateway(pinnedGroupClientType)
+ : S.models.addProtocolHintPinned(pinnedGroupClientType)
: customLikeGroup
? S.models.addProtocolHintDetect
: S.models.addProtocolHint}
diff --git a/packages/web/src/features/models/protocol-path.ts b/packages/web/src/features/models/protocol-path.ts
index 53ca9de5..535d96a3 100644
--- a/packages/web/src/features/models/protocol-path.ts
+++ b/packages/web/src/features/models/protocol-path.ts
@@ -10,7 +10,8 @@
* - OpenAI direct (gpt-* clients): the Responses API, POST {base}/responses (the SDK's
* default base URL https://api.openai.com/v1 already ends in /v1, and a custom base
* URL replaces it whole). The generic Responses protocol client
- * (`client_type: "openai-responses"`) serves the same shape.
+ * (`client_type: "openai-responses"`) serves the same shape — and it is what every
+ * OpenRouter row pins, OpenRouter serving the Responses API for all of its upstreams.
* - Google direct (gemini-* clients, `@google/genai`): {base}/v1beta/models/<id>:… —
* the SDK joins base URL + API version (v1beta) + the models path.
* - MiniMax direct (minimax-m3 client): MiniMax's Responses API, POST {base}/responses
@@ -19,8 +20,8 @@
* (agenthub 0.4.6 moved this client off Chat Completions; its default base URL
* https://api.deepseek.com carries no /v1, and the request path adds none).
* - Every OpenAI Chat Completions compatible client — explicit
- * `client_type: "openai-chat"` (gateways, custom and user-defined groups; the bare
- * "openai" spelling is a deprecated pre-0.4.2 alias),
+ * `client_type: "openai-chat"` (the gateways other than OpenRouter, custom and
+ * user-defined groups; the bare "openai" spelling is a deprecated pre-0.4.2 alias),
* `client_type: "openai-chat-vllm-adapter"` (the vLLM group; an openai-chat subclass that
* differs only in the thinking switch it sends), plus the GLM / Kimi direct clients —
* POST {base}/chat/completions.
diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.ts
index 52063455..1453f96e 100644
--- a/packages/web/src/lib/strings-en.ts
+++ b/packages/web/src/lib/strings-en.ts
@@ -820,6 +820,8 @@ export const en: Strings = {
`Only ${vendor}'s official API protocol is supported; use a custom model group for OpenAI-compatible endpoints.`,
addProtocolHintPinned: (protocol: string): string =>
`Models in this group always use the ${protocol} protocol; set the base URL to your own server`,
+ addProtocolHintPinnedGateway: (protocol: string): string =>
+ `Models in this group always use the ${protocol} protocol; the base URL is preset to the gateway's endpoint`,
autoRouteNone:
"This model ID cannot be routed with the current provider protocol. If it uses an OpenAI-compatible endpoint, move it to Custom.",
useCustomGroup: "Move to Custom",
diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.ts
index 8b211cf0..5b7e342a 100644
--- a/packages/web/src/lib/strings.ts
+++ b/packages/web/src/lib/strings.ts
@@ -797,6 +797,9 @@ export const zh = {
/** Add-dialog note for a group that pins one protocol on every entry (fed the client type): the protocol is not a choice here, and the endpoint is the user's own. */
addProtocolHintPinned: (protocol: string): string =>
`本分组的模型固定使用 ${protocol} 协议,base URL 填你自己的服务地址`,
+ /** The same note for a gateway group that pins a protocol: the endpoint is the gateway's, already filled in. */
+ addProtocolHintPinnedGateway: (protocol: string): string =>
+ `本分组的模型固定使用 ${protocol} 协议,base URL 已预填网关端点`,
autoRouteNone: "该模型 ID 无法按当前厂商协议识别;若使用 OpenAI 兼容接口,可转为自定义模型。",
useCustomGroup: "转为自定义模型",
addGroup: "新增分组",
diff --git a/packages/web/test/protocol-detect.test.ts b/packages/web/test/protocol-detect.test.ts
index 9fd8b410..27df393c 100644
--- a/packages/web/test/protocol-detect.test.ts
+++ b/packages/web/test/protocol-detect.test.ts
@@ -107,6 +107,10 @@ describe("clientTypeAfterProviderChange (protocol family kept on move to Custom)
expect(clientTypeAfterProviderChange("vllm", "openai-chat")).toBe("openai-chat-vllm-adapter");
expect(clientTypeAfterProviderChange("vllm", "ant-messages")).toBe("openai-chat-vllm-adapter");
expect(clientTypeAfterProviderChange("vllm", "deepseek-v4")).toBe("openai-chat-vllm-adapter");
+ // A gateway can pin too: OpenRouter speaks the Responses API for every upstream it
+ // serves, so an entry dragged in is rewritten off whatever it carried before.
+ expect(clientTypeAfterProviderChange("openrouter", "")).toBe("openai-responses");
+ expect(clientTypeAfterProviderChange("openrouter", "openai-chat")).toBe("openai-responses");
// And moving back out of it does not carry the pin along.
expect(clientTypeAfterProviderChange("custom", "openai-chat-vllm-adapter")).toBe("openai-chat");
});
diff --git a/packages/web/test/protocol-path.test.ts b/packages/web/test/protocol-path.test.ts
index 1a1a388a..b73c51b9 100644
--- a/packages/web/test/protocol-path.test.ts
+++ b/packages/web/test/protocol-path.test.ts
@@ -34,9 +34,10 @@ describe("protocolPathForModel", () => {
expect(protocolPathForModel("moonshot", "")).toBe("/chat/completions");
});
- it("gateway groups always carry client_type openai-chat and get /chat/completions", () => {
+ it("the gateway groups that pin openai-chat get /chat/completions", () => {
+ // OpenRouter is the one gateway missing here: it pins openai-responses on every row, and
+ // the Responses case below covers it.
for (const provider of [
- "openrouter",
"fireworks",
"siliconflow",
"tokendance",
@@ -78,8 +79,8 @@ describe("protocolPathForModel", () => {
expect(protocolPathForModel("custom", "ant-messages")).toBe("/v1/messages");
expect(protocolPathForModel("deepseek", "openai-responses")).toBe("/responses");
expect(protocolPathForModel("myproxy", " Ant-Messages ")).toBe("/v1/messages");
- // The built-in OpenRouter openai/* presets pin openai-responses, so the gateway's base
- // URL must be hinted with /responses rather than the group's usual /chat/completions.
+ // Every built-in OpenRouter preset pins openai-responses, so the gateway's base URL is
+ // hinted with /responses rather than the /chat/completions the other gateways get.
expect(protocolPathForModel("openrouter", "openai-responses")).toBe("/responses");
});
diff --git a/plugins/agent-development/skills/unified-llm-api/SKILL.md b/plugins/agent-development/skills/unified-llm-api/SKILL.md
index dc29f4fc..0224827d 100644
--- a/plugins/agent-development/skills/unified-llm-api/SKILL.md
+++ b/plugins/agent-development/skills/unified-llm-api/SKILL.md
@@ -108,7 +108,7 @@ The registry is the curated current line-up, so prefer it when picking a model o
- `clientType: "openai-responses"` — OpenAI Responses-compatible endpoints (OpenAI, OpenRouter, DeepSeek, Z.AI, MiniMax all serve one).
- `clientType: "ant-messages"` — Anthropic Messages-compatible endpoints (Anthropic, OpenRouter `https://openrouter.ai/api`, DeepSeek `https://api.deepseek.com/anthropic`, Z.AI, MiniMax).
- Exception: an id served by an OpenAI-compatible gateway that still matches a first-party substring (e.g. OpenRouter's `google/gemini-3.7-flash`, `anthropic/claude-sonnet-5` or `openai/gpt-5.6-sol` on the `/api/v1` endpoint) would auto-route to the vendor protocol client — and a dotted id like `anthropic/claude-opus-4.8` matches nothing and throws. Always pass an explicit `clientType` for gateway ids; never rely on the id. Routing reads `clientType` (or the model id) as a plain lowercased string and never looks at `baseUrl`, so the vendor prefix gives no protection.
-- OpenRouter serves both protocols at `https://openrouter.ai/api/v1`, so its `openai/*` ids work with `clientType: "openai-responses"` as well as `"openai-chat"`; use Responses when you want reasoning items round-tripped.
+- OpenRouter serves both protocols at `https://openrouter.ai/api/v1`, for every upstream it resells and not just its `openai/*` ids, so any id it serves works with `clientType: "openai-responses"` as well as `"openai-chat"`; use Responses when you want reasoning items round-tripped.
- The first-party `deepseek-v4` client posts to `{baseUrl}/responses` (AgentHub 0.4.6 moved it off Chat Completions). A self-hosted endpoint serving a `deepseek-v4*` id over Chat Completions must therefore pass `clientType: "openai-chat"` explicitly rather than rely on id routing.
- API key: constructor parameter first, then the provider environment variable — `DEEPSEEK_API_KEY`, `ANTHROPIC_API_KEY` (also for `ant-messages`), `OPENAI_API_KEY` (also for `openai-chat`/`openai-responses`), `GEMINI_API_KEY`, `ZAI_API_KEY`, `MOONSHOT_API_KEY`, `MINIMAX_API_KEY`. Base URLs read the same names with `_BASE_URL`.