Fix invalid parallel_tool_calls field in Anthropic requests (#11) - #12
Open
benwoody wants to merge 1 commit into
Open
Fix invalid parallel_tool_calls field in Anthropic requests (#11)#12benwoody wants to merge 1 commit into
benwoody wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #11.
Problem
The Claude (OAuth) provider was failing every request with HTTP 400:
{ "type": "error", "error": { "type": "invalid_request_error", "message": "parallel_tool_calls: Extra inputs are not permitted" }, "request_id": "<...>" }AnthropicClient.serializeRequest was unconditionally adding parallel_tool_calls to every Anthropic request whenever tools was non-null. That field belongs to OpenAI's Chat Completions API — Anthropic's
Messages API rejects it as an unknown input.
Fix
Translate to Anthropic's equivalent: tool_choice.disable_parallel_tool_use (inverted). Only set when the user has opted out of parallel tool calls, so the default (parallel allowed) stays implicit in
the request body.
This preserves the existing Budget Mode "parallel tool calls" toggle behavior — when the user disables parallel tools in the UI, it now correctly translates to the Anthropic API's serial-tool-use
directive instead of being silently malformed.
Notes
private to internal) if you'd prefer.
Verified
Tested locally on a dGEN1 with the Claude (OAuth) provider and claude-sonnet-4-6: tool-using requests now complete instead of failing at body validation.