fix: force tool parameter passthrough for OpenRouter models#11970
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: force tool parameter passthrough for OpenRouter models#11970roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
When OpenRouter metadata does not list "tools" in supported_parameters for a model, OpenRouter may strip tool parameters or apply prompt-based transforms that produce poor results. This affects models like Nemotron 3 Super 120b-a12b that actually support native tool calling. By adding require_parameters: ["tools", "tool_choice"] to the provider config, we tell OpenRouter to always pass these parameters through to the model regardless of its metadata. Fixes #11968
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.
Related GitHub Issue
Closes: #11968
Description
This PR attempts to address Issue #11968 where Nemotron 3 Super 120b-a12b (and potentially other models) produce broken output when used through OpenRouter.
Root cause: When OpenRouter's metadata does not list
toolsin a model'ssupported_parameters, OpenRouter may either strip the tool parameters or apply prompt-based transforms that produce poor results (e.g. wrapping output in[{code here}]formatting). This happens even for models like Nemotron 3 Super that actually support native tool calling.Fix: Added
require_parameters: ["tools", "tool_choice"]to the OpenRouter provider configuration increateMessage. This tells OpenRouter to always pass tool-calling parameters through to the underlying model, regardless of what the model's metadata says about supported parameters. This is done via the OpenRouter provider routing API.Key changes:
providerfield toOpenRouterChatCompletionParamstypeprovider.require_parameters: ["tools", "tool_choice"]increateMessagerequestsorder,only,allow_fallbacks) is merged withrequire_parametersFeedback and guidance are welcome.
Test Procedure
require_parametersis always present in the provider configrequire_parametersmerges correctly with specific provider routingcd src && npx vitest run api/providers/__tests__/openrouter.spec.tsPre-Submission Checklist
Interactively review PR in Roo Code Cloud