From 7028f7e5116929a978066df6517b2f0ab832ea4f Mon Sep 17 00:00:00 2001 From: XZH Date: Wed, 26 Aug 2026 17:16:34 -0700 Subject: [PATCH] feat(settings): expose custom reasoning effort --- web/lib/reasoning-effort.ts | 11 ++++++++-- web/tests/reasoning-effort.test.ts | 35 ++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/web/lib/reasoning-effort.ts b/web/lib/reasoning-effort.ts index bb70f5d69..b9b34bb3e 100644 --- a/web/lib/reasoning-effort.ts +++ b/web/lib/reasoning-effort.ts @@ -129,7 +129,14 @@ export function reasoningEffortOptions( : options([], current); } - if (BINARY_THINKING_PROVIDERS.has(provider) || provider === "custom") { + if (provider === "custom") { + // A user-supplied OpenAI-compatible endpoint may route to any upstream + // model, so expose the common cross-gateway levels and let Auto handle + // providers without an explicit control. + return options(["none", "low", "medium", "high"], current); + } + + if (BINARY_THINKING_PROVIDERS.has(provider)) { const supported = provider === "minimax" || includesAny(modelName, [ @@ -152,7 +159,7 @@ export function reasoningEffortOptions( } } - if (OPENAI_PROVIDERS.has(provider) || provider === "custom") { + if (OPENAI_PROVIDERS.has(provider)) { const isGpt5OrCodex = includesAny(modelName, ["gpt-5", "codex"]); if (isGpt5OrCodex) { return options(["minimal", "low", "medium", "high", "xhigh"], current); diff --git a/web/tests/reasoning-effort.test.ts b/web/tests/reasoning-effort.test.ts index 4a0eb2e28..c9e53db06 100644 --- a/web/tests/reasoning-effort.test.ts +++ b/web/tests/reasoning-effort.test.ts @@ -92,11 +92,42 @@ test("known reasoning families get conservative provider-specific choices", () = "high", ]); assert.deepEqual(values("dashscope", "qwen3-max"), ["", "minimal", "high"]); - assert.deepEqual(values("custom", "deepseek-reasoner"), [ +}); + +test("OpenAI-compatible gateways expose explicit effort levels", () => { + assert.deepEqual(values("custom", "idrouter/qd/lite"), [ "", - "minimal", + "none", + "low", + "medium", "high", ]); + assert.deepEqual(values("openai-compatible", "gateway/model"), [ + "", + "none", + "low", + "medium", + "high", + ]); + assert.deepEqual(values("custom", "gateway/model", "vendor-level"), [ + "", + "none", + "low", + "medium", + "high", + "vendor-level", + ]); +}); + +test("Anthropic-compatible aliases follow the Anthropic model rules", () => { + assert.deepEqual( + values("anthropic-compatible", "claude-sonnet-4-5"), + ["", "none", "low", "medium", "high"], + ); + assert.deepEqual( + values("anthropic_compatible", "claude-opus-4-6").includes("adaptive"), + false, + ); }); test("unknown models stay hidden unless they already carry an override", () => {