Skip to content

Commit f7d6dae

Browse files
Fix OpenAI Native parallel tool calls for native protocol (#9433)
Fixes an issue where using the OpenAI Native provider together with Native Tool Calling could cause OpenAI’s Responses API to fail with errors like:
1 parent 1201b0f commit f7d6dae

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/api/providers/openai-native.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
244244
strict?: boolean
245245
}>
246246
tool_choice?: any
247+
parallel_tool_calls?: boolean
247248
}
248249

249250
// Validate requested tier against model support; if not supported, omit.
@@ -302,6 +303,12 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
302303
...(metadata?.tool_choice && { tool_choice: metadata.tool_choice }),
303304
}
304305

306+
// For native tool protocol, explicitly disable parallel tool calls.
307+
// For XML or when protocol is unset, omit the field entirely so the API default applies.
308+
if (metadata?.toolProtocol === "native") {
309+
body.parallel_tool_calls = false
310+
}
311+
305312
// Include text.verbosity only when the model explicitly supports it
306313
if (model.info.supportsVerbosity === true) {
307314
body.text = { verbosity: (verbosity || "medium") as VerbosityLevel }

0 commit comments

Comments
 (0)