diff --git a/src/api/transform/__tests__/reasoning.spec.ts b/src/api/transform/__tests__/reasoning.spec.ts index b6fb4816fc..078d2a3549 100644 --- a/src/api/transform/__tests__/reasoning.spec.ts +++ b/src/api/transform/__tests__/reasoning.spec.ts @@ -530,8 +530,8 @@ describe("reasoning.ts", () => { expect(result).toEqual({ reasoning_effort: undefined }) }) - it("should handle all reasoning effort values including minimal", () => { - const efforts: Array = ["minimal", "low", "medium", "high"] + it("should handle standard reasoning effort values", () => { + const efforts: Array<"low" | "medium" | "high"> = ["low", "medium", "high"] efforts.forEach((effort) => { const modelWithEffort: ModelInfo = { @@ -550,12 +550,11 @@ describe("reasoning.ts", () => { reasoningEffort: effort, } const result = getOpenAiReasoning(options) - // All effort values including "minimal" should be passed through for OpenAI (e.g., GPT-5) expect(result).toEqual({ reasoning_effort: effort }) }) }) - it("should handle minimal reasoning effort specifically", () => { + it("should filter out minimal reasoning effort for OpenAI SDK compatibility", () => { const modelWithEffort: ModelInfo = { ...baseModel, supportsReasoningEffort: true, @@ -574,8 +573,9 @@ describe("reasoning.ts", () => { const result = getOpenAiReasoning(options) - // "minimal" should be passed through for OpenAI models like GPT-5 - expect(result).toEqual({ reasoning_effort: "minimal" }) + // "minimal" is filtered out for OpenAI SDK compatibility + // OpenRouter handles "minimal" correctly in its own function + expect(result).toBeUndefined() }) it("should not be affected by reasoningBudget parameter", () => { diff --git a/src/api/transform/reasoning.ts b/src/api/transform/reasoning.ts index 367c463662..2e95c52591 100644 --- a/src/api/transform/reasoning.ts +++ b/src/api/transform/reasoning.ts @@ -62,8 +62,14 @@ export const getOpenAiReasoning = ({ return undefined } - // If model has reasoning effort capability, return object with the effort - // OpenAI models (including GPT-5) support all effort levels including "minimal" + // Note: The OpenAI SDK doesn't include "minimal" in its type definitions, + // but GPT-5 via OpenRouter does support it. Since this function is for + // direct OpenAI API usage (not OpenRouter), we filter out "minimal" here. + // OpenRouter handles "minimal" correctly in getOpenRouterReasoning. + if (reasoningEffort === "minimal") { + return undefined + } + return { reasoning_effort: reasoningEffort } }