Skip to content

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

fix(models): route unknown IDs through Custom (#282)

Yiru Dong3c210fc7abb8
diff --git a/changelog/unreleased/2026-08-14-model-group-protocol.md b/changelog/unreleased/2026-08-14-model-group-protocol.md
new file mode 100644
index 00000000..b8b5ca06
--- /dev/null
+++ b/changelog/unreleased/2026-08-14-model-group-protocol.md
@@ -0,0 +1,5 @@
+# Models: use the OpenAI-compatible client when moving to Custom
+
+Moving an existing model to the Custom group now sets `client_type` to `openai`, matching models added directly to that group and preventing unsupported-model errors for custom IDs.
+
+Unknown IDs in first-party groups now offer a one-click move to Custom while preserving the entered settings.
diff --git a/changelog/unreleased/README.md b/changelog/unreleased/README.md
index 78977f4b..1f3ae86c 100644
--- a/changelog/unreleased/README.md
+++ b/changelog/unreleased/README.md
@@ -1,3 +1,4 @@
# Unreleased
- [2026-08-14] Match the macOS app icon's visual size to neighbouring apps. ([details](2026-08-14-macos-app-icon-size.md))
+- [2026-08-14] Unknown model IDs can be moved to Custom with the OpenAI-compatible client. ([details](2026-08-14-model-group-protocol.md))
diff --git a/packages/web/src/features/models/models-page.tsx b/packages/web/src/features/models/models-page.tsx
index ad77bef4..1f0f04af 100644
--- a/packages/web/src/features/models/models-page.tsx
+++ b/packages/web/src/features/models/models-page.tsx
@@ -158,6 +158,11 @@ export function decimalOnly(v: string): string {
return i === -1 ? cleaned : cleaned.slice(0, i + 1) + cleaned.slice(i + 1).replace(/\./g, "");
}
+/** Moving an existing model to Custom switches it to the OpenAI-compatible client. */
+export function clientTypeAfterProviderChange(provider: string, current: string): string {
+ return provider === "custom" ? "openai" : current;
+}
+
/** Local edit state for one model row (string-typed for form use; parsed uniformly on save). */
export interface RowState {
/**
@@ -1257,7 +1262,6 @@ function ModelDialog({
dialogProvider.id !== "custom" &&
dialogProvider.gatewayBaseUrl === undefined;
const autoRouteMiss =
- isNew &&
vendorGroup &&
!form.clientType.trim() &&
form.modelId.trim() !== "" &&
@@ -1304,13 +1308,27 @@ function ModelDialog({
placeholder={S.models.modelIdHint}
/>
{fieldErrors.modelId && <FieldError>{fieldErrors.modelId}</FieldError>}
- {/* Hint when auto-routing misses (first-party provider group, adding): warns without blocking. */}
- {autoRouteMiss && (
- <span className="mt-1 block text-xs text-amber-600 dark:text-amber-400">
- {S.models.autoRouteNone}
- </span>
- )}
</label>
+ {autoRouteMiss && (
+ <div
+ role="alert"
+ className="flex items-center justify-between gap-3 rounded-md border border-amber-200 bg-amber-50 px-2.5 py-2 text-xs text-amber-800 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-300"
+ >
+ <span>{S.models.autoRouteNone}</span>
+ <Button
+ size="sm"
+ className="shrink-0"
+ onClick={() =>
+ set({
+ provider: "custom",
+ clientType: clientTypeAfterProviderChange("custom", form.clientType),
+ })
+ }
+ >
+ {S.models.useCustomGroup}
+ </Button>
+ </div>
+ )}
<div className="grid grid-cols-2 gap-2">
<Input
size="sm"
@@ -1325,7 +1343,10 @@ function ModelDialog({
label={S.models.providerGroup}
value={form.provider}
disabled={!canEdit}
- onChange={(e) => set({ provider: e.target.value })}
+ onChange={(e) => {
+ const provider = e.target.value;
+ set({ provider, clientType: clientTypeAfterProviderChange(provider, form.clientType) });
+ }}
>
{MODEL_PROVIDERS.map((p) => (
<option key={p.id} value={p.id}>
diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.ts
index adf4f7f1..ee242ed4 100644
--- a/packages/web/src/lib/strings-en.ts
+++ b/packages/web/src/lib/strings-en.ts
@@ -461,7 +461,8 @@ export const en: Strings = {
vendorProtocolHint: (vendor: string): string =>
`Only ${vendor}'s official API protocol is supported; use a custom model group for OpenAI-compatible endpoints.`,
autoRouteNone:
- "This id is not a recognized official model id: double-check it, or add the model under Custom / a user-defined group with an OpenAI-compatible endpoint",
+ "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",
addGroup: "Add group",
addGroupTitle: "Add group",
addGroupDesc:
diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.ts
index 9939cd96..518ae6a7 100644
--- a/packages/web/src/lib/strings.ts
+++ b/packages/web/src/lib/strings.ts
@@ -433,9 +433,8 @@ export const zh = {
/** Add-dialog note for preset direct-vendor groups (fed the provider label): states whose protocol the group speaks — the in-field suffix on the base URL shows which path. */
vendorProtocolHint: (vendor: string): string =>
`仅支持 ${vendor} 官方接口协议,OpenAI 兼容接口请使用自定义模型分组`,
- /** Non-blocking warning under the model id (preset direct-vendor groups, adding): the typed id is not a recognized official model id. */
- autoRouteNone:
- "该 id 不是可识别的官方模型 id:请核对,或改在 Custom / 自建分组以 OpenAI 兼容接口接入",
+ autoRouteNone: "该模型 ID 无法按当前厂商协议识别;若使用 OpenAI 兼容接口,可转为自定义模型。",
+ useCustomGroup: "转为自定义模型",
addGroup: "新增分组",
addGroupTitle: "新增分组",
addGroupDesc:
diff --git a/packages/web/test/models-input.test.ts b/packages/web/test/models-input.test.ts
index cb3640fd..df174a51 100644
--- a/packages/web/test/models-input.test.ts
+++ b/packages/web/test/models-input.test.ts
@@ -12,6 +12,7 @@
*/
import { describe, expect, it } from "vitest";
import {
+ clientTypeAfterProviderChange,
decimalOnly,
digitsOnly,
nextPointers,
@@ -41,6 +42,14 @@ describe("decimalOnly (price)", () => {
});
});
+describe("clientTypeAfterProviderChange", () => {
+ it("uses openai when moving to Custom and otherwise preserves the current client", () => {
+ expect(clientTypeAfterProviderChange("custom", "")).toBe("openai");
+ expect(clientTypeAfterProviderChange("custom", "claude-5")).toBe("openai");
+ expect(clientTypeAfterProviderChange("google", "openai")).toBe("openai");
+ });
+});
+
describe("toRow (DTO → row edit state)", () => {
it("provider and modelId are both plain entry fields (zero parsing); the loaded identity is a paired reference", () => {
const row = toRow({