From 0342d4c4a4fdc86f85ccc2e5b08cac8ea0269638 Mon Sep 17 00:00:00 2001 From: HybridTalentComputing <1316645276@qq.com> Date: Tue, 27 Jan 2026 23:05:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dopenai=20compatible=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=95=88=E6=9E=9C=E4=B8=8D=E5=A5=BD=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/api/providers/openai.ts | 12 +++--------- src/utils/model-utils.ts | 3 ++- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/core/api/providers/openai.ts b/src/core/api/providers/openai.ts index ec1b46e1..9a6ae696 100644 --- a/src/core/api/providers/openai.ts +++ b/src/core/api/providers/openai.ts @@ -103,14 +103,8 @@ export class OpenAiHandler implements ApiHandler { reasoningEffort = (this.options.reasoningEffort as ChatCompletionReasoningEffort) || "medium" } - const isOfficialOpenAi = - !this.options.openAiBaseUrl || - this.options.openAiBaseUrl.toLowerCase().includes("api.openai.com") || - this.options.openAiBaseUrl.toLowerCase().includes("azure.com") || - this.options.openAiBaseUrl.toLowerCase().includes("azure.us") - - const effectiveTools = isOfficialOpenAi ? tools : undefined - + // Tools are passed through directly - the system prompt variant selection + // determines whether to use native tools or XML-based tools const stream = await client.chat.completions.create({ model: modelId, messages: openAiMessages, @@ -119,7 +113,7 @@ export class OpenAiHandler implements ApiHandler { reasoning_effort: reasoningEffort, stream: true, stream_options: { include_usage: true }, - ...getOpenAIToolParams(effectiveTools), + ...getOpenAIToolParams(tools), }) const toolCallProcessor = new ToolCallProcessor() diff --git a/src/utils/model-utils.ts b/src/utils/model-utils.ts index 99307aeb..96926a11 100644 --- a/src/utils/model-utils.ts +++ b/src/utils/model-utils.ts @@ -11,7 +11,8 @@ export function isNextGenModelProvider(providerInfo: ApiProviderInfo): boolean { "gemini", "vertex", "openrouter", - "openai", + // Note: "openai" is excluded to use XML-based tool parsing for better compatibility + // with OpenAI-compatible providers. Use "openai-native" for native tool calling with official OpenAI. "minimax", "openai-native", "baseten",