Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(reasoning): stop gpt-oss on Tinfoil failing every request with a 400 (#1611)

Joshua5cf8b2511326
diff --git a/src/services/ai/thinkingSuppressionDialects.ts b/src/services/ai/thinkingSuppressionDialects.ts
index ff754e33f..215607fc9 100644
--- a/src/services/ai/thinkingSuppressionDialects.ts
+++ b/src/services/ai/thinkingSuppressionDialects.ts
@@ -32,6 +32,11 @@ export function suppressThinking(
providerKey: string,
model: string
): void {
+ const modelFamily = (model || "").toLowerCase();
+ // gpt-oss accepts low|medium|high only; it has no off switch. A property of the
+ // model family, not the provider — Tinfoil 400s on "none" just like Groq would.
+ const isGptOss = modelFamily.includes("gpt-oss");
+
if (providerKey === "gemini") {
requestBody.reasoning_effort = "minimal";
return;
@@ -47,12 +52,10 @@ export function suppressThinking(
// Groq rejects unknown fields outright and takes a different reasoning_effort
// enum per model family, so send nothing unless the family is known.
if (providerKey === "groq") {
- const groqModel = (model || "").toLowerCase();
- if (groqModel.includes("qwen")) {
+ if (modelFamily.includes("qwen")) {
// qwen3 accepts none|default only.
requestBody.reasoning_effort = "none";
- } else if (groqModel.includes("gpt-oss")) {
- // gpt-oss accepts low|medium|high only; it has no off switch.
+ } else if (isGptOss) {
requestBody.reasoning_effort = "low";
}
return;
@@ -61,7 +64,7 @@ export function suppressThinking(
// Mistral rejects unknown fields with a 422; reasoning_effort is its native switch.
if (providerKey === "mistral") {
// Legacy magistral models reason natively and may reject reasoning_effort.
- if ((model || "").toLowerCase().includes("magistral")) return;
+ if (modelFamily.includes("magistral")) return;
requestBody.reasoning_effort = "none";
return;
}
@@ -73,7 +76,7 @@ export function suppressThinking(
// disables Ollama thinking; other backends drop it (flat reasoning_effort trips vLLM).
requestBody.reasoning = { effort: "none" };
} else {
- requestBody.reasoning_effort = "none";
+ requestBody.reasoning_effort = isGptOss ? "low" : "none";
}
requestBody.chat_template_kwargs = { enable_thinking: false };
}
diff --git a/test/helpers/thinkingSuppressionDialects.test.js b/test/helpers/thinkingSuppressionDialects.test.js
index c1ee4c6f9..914ade218 100644
--- a/test/helpers/thinkingSuppressionDialects.test.js
+++ b/test/helpers/thinkingSuppressionDialects.test.js
@@ -107,6 +107,30 @@ test("unlisted providers keep the legacy reasoning_effort none plus chat_templat
});
});
+test("generic-dialect providers send gpt-oss the low floor, not the rejected none", async () => {
+ const { suppressThinking } = await load();
+
+ const body = {};
+ suppressThinking(body, "tinfoil", "gpt-oss-120b");
+
+ assert.deepEqual(body, {
+ reasoning_effort: "low",
+ chat_template_kwargs: { enable_thinking: false },
+ });
+});
+
+test("the gpt-oss floor covers the whole family case-insensitively", async () => {
+ const { suppressThinking } = await load();
+
+ const safeguard = {};
+ suppressThinking(safeguard, "tinfoil", "gpt-oss-safeguard-120b");
+ assert.equal(safeguard.reasoning_effort, "low");
+
+ const mixedCase = {};
+ suppressThinking(mixedCase, "openai", "GPT-OSS-20B");
+ assert.equal(mixedCase.reasoning_effort, "low");
+});
+
test("mistral gets reasoning_effort none and never chat_template_kwargs", async () => {
const { suppressThinking } = await load();