From 3d7fa475cc0bc3c535964d04a7992f858842ab80 Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Wed, 17 Jun 2026 11:34:47 +0200 Subject: [PATCH] Fix reasoning not working for MiniMax Coding Plan Seems to be a Vercel bug: reasoning does not show when using chat completions --- .../providers/apply-provider-specific-logic.ts | 11 +++++++++++ .../src/lib/ai-gateway/providers/model-settings.ts | 6 ++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts b/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts index c0dcfff32..47bd61b84 100644 --- a/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts +++ b/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts @@ -32,6 +32,7 @@ import { addCacheBreakpoints, enableReasoningSummaries, fixResponsesRequest, + isReasoningExplicitlyEnabled, scrubOpenCodeSpecificProperties, } from '@/lib/ai-gateway/providers/openrouter/request-helpers'; import { isQwenExplicitCacheModel, isQwenModel } from '@/lib/ai-gateway/providers/qwen'; @@ -180,6 +181,16 @@ export function applyProviderSpecificLogic( addCacheBreakpoints(requestToMutate); } + if ( + isMinimaxModel(requestedModel) && + !isReasoningExplicitlyEnabled(requestToMutate) && + requestToMutate.kind === 'messages' + ) { + // MiniMax defaults to thinking, but the Anthropic provider does not include thinking:disabled in the request, creating a mismatch. + // https://github.com/vercel/ai/blob/4a441d8fb584b231f771348de3e7f383ab7aa95b/packages/anthropic/src/anthropic-language-model.ts#L421-L453 + requestToMutate.body.thinking = { type: 'disabled' }; + } + provider.transformRequest({ provider, model: requestedModel, diff --git a/apps/web/src/lib/ai-gateway/providers/model-settings.ts b/apps/web/src/lib/ai-gateway/providers/model-settings.ts index 2e1295b8c..89c5a3dee 100644 --- a/apps/web/src/lib/ai-gateway/providers/model-settings.ts +++ b/apps/web/src/lib/ai-gateway/providers/model-settings.ts @@ -143,8 +143,10 @@ export function getAiSdkProvider( if (isOpenCodeGoAnthropicMessagesModel(model)) { return 'anthropic'; } - if (isClaudeModel(model)) { - // on Vercel AI Gateway, this is necessary to support document attachments + if ( + isClaudeModel(model) || // on Vercel AI Gateway, this is necessary to support document attachments + isMinimaxModel(model) // on Vercel AI Gateway, this is necessary for reasoning to show + ) { return 'anthropic'; } if (isOpenAiModel(model) || isGrokModel(model)) {