From 431f65d7302f0770318a94c4bdb3b1693b0c696e Mon Sep 17 00:00:00 2001 From: Roo Code Date: Sun, 21 Dec 2025 09:34:22 +0000 Subject: [PATCH] fix: default OpenAI Compatible provider to XML protocol for better third-party proxy compatibility --- packages/types/src/providers/openai.ts | 5 ++++- src/utils/__tests__/resolveToolProtocol.spec.ts | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/types/src/providers/openai.ts b/packages/types/src/providers/openai.ts index 47b883e0e10..ed4801fd168 100644 --- a/packages/types/src/providers/openai.ts +++ b/packages/types/src/providers/openai.ts @@ -551,7 +551,10 @@ export const openAiModelInfoSaneDefaults: ModelInfo = { inputPrice: 0, outputPrice: 0, supportsNativeTools: true, - defaultToolProtocol: "native", + // Default to XML for OpenAI Compatible providers since third-party proxies + // have varying levels of support for native tool calling. Users who want + // native tool calling can explicitly enable it in Advanced Settings. + defaultToolProtocol: "xml", } // https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation diff --git a/src/utils/__tests__/resolveToolProtocol.spec.ts b/src/utils/__tests__/resolveToolProtocol.spec.ts index 5fbc5344382..235f08a38cd 100644 --- a/src/utils/__tests__/resolveToolProtocol.spec.ts +++ b/src/utils/__tests__/resolveToolProtocol.spec.ts @@ -376,13 +376,15 @@ describe("resolveToolProtocol", () => { expect(result).toBe(TOOL_PROTOCOL.XML) // Model default wins }) - it("should use native tools for OpenAI compatible provider with default model info", () => { + it("should use XML for OpenAI compatible provider with default model info", () => { const settings: ProviderSettings = { apiProvider: "openai", } - // Using the actual openAiModelInfoSaneDefaults to verify the fix + // OpenAI Compatible defaults to XML protocol since third-party proxies + // have varying levels of support for native tool calling. + // Users who want native can explicitly enable it in Advanced Settings. const result = resolveToolProtocol(settings, openAiModelInfoSaneDefaults) - expect(result).toBe(TOOL_PROTOCOL.NATIVE) // Should use native tools by default + expect(result).toBe(TOOL_PROTOCOL.XML) // Should use XML by default for better compatibility }) }) })