diff --git a/src/renderer/src/aiCore/utils/options.ts b/src/renderer/src/aiCore/utils/options.ts index 8dc7a10af9..1a16ea05da 100644 --- a/src/renderer/src/aiCore/utils/options.ts +++ b/src/renderer/src/aiCore/utils/options.ts @@ -3,7 +3,7 @@ import { type AnthropicProviderOptions } from '@ai-sdk/anthropic' import type { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google' import type { OpenAIResponsesProviderOptions } from '@ai-sdk/openai' import type { XaiProviderOptions } from '@ai-sdk/xai' -import { baseProviderIdSchema, customProviderIdSchema } from '@cherrystudio/ai-core/provider' +import { baseProviderIdSchema, customProviderIdSchema, hasProviderConfig } from '@cherrystudio/ai-core/provider' import { loggerService } from '@logger' import { getModelSupportedVerbosity, @@ -616,9 +616,14 @@ function buildGenericProviderOptions( } if (enableReasoning) { if (isInterleavedThinkingModel(model)) { - providerOptions = { - ...providerOptions, - sendReasoning: true + // sendReasoning is a patch specific to @ai-sdk/openai-compatible + // Only apply when provider will actually use openai-compatible SDK + // (i.e., no dedicated SDK registered OR explicitly openai-compatible) + if (!hasProviderConfig(providerId) || providerId === 'openai-compatible') { + providerOptions = { + ...providerOptions, + sendReasoning: true + } } } }