Repository navigation
feat: add extra_body support for OpenAI-compatible providers - #1654
Merged
Merged
Conversation
Add extra_body configuration option to model.generationConfig for passing custom parameters to OpenAI-compatible API request bodies. - Add extra_body to ContentGeneratorConfig type - Add extra_body to MODEL_GENERATION_CONFIG_FIELDS and ModelGenerationConfig - Implement extra_body merging in DefaultOpenAICompatibleProvider - Implement extra_body merging in DashScopeOpenAICompatibleProvider - Update documentation with examples and provider compatibility notes - Note: This feature is only for OpenAI-compatible providers (openai, qwen-oauth) Resolves #1647 Resolves #1644 Co-authored-by: Qwen-Coder <[email protected]>
tanzhenxin
requested review from
DennisYu07,
LaZzyMan,
Mingholy,
gwinthis and
pomelo-nwu
as code owners
January 29, 2026 04:34
Contributor
📋 Review SummaryThis PR adds support for an 🔍 General Feedback
🎯 Specific FeedbackNo specific issues identified in this review. ✅ Highlights
|
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
xaelistic
pushed a commit
to xaelistic/qwen-code
that referenced
this pull request
Jun 7, 2026
feat: add extra_body support for OpenAI-compatible providers
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.
TLDR
This PR adds support for the
extra_bodyconfiguration option inmodel.generationConfig. This allows users to pass custom parameters to the request body for OpenAI-compatible API providers (openai, qwen-oauth).Dive Deeper
The
extra_bodyfield is a new addition toContentGeneratorConfigthat enables users to specify additional parameters to be merged into the API request body. This is particularly useful for provider-specific options that are not covered by the standard configuration fields.Key implementation details:
extra_body?: Record<string, unknown>toContentGeneratorConfigtypeextra_bodytoMODEL_GENERATION_CONFIG_FIELDSandModelGenerationConfigfor proper configuration resolutionextra_bodymerging in OpenAI-compatible providers:DefaultOpenAICompatibleProvider: Merges into request body inbuildRequest()DashScopeOpenAICompatibleProvider: Merges into request body for both regular and vision model requests{ "enable_thinking": true }The implementation follows the same pattern as
customHeaders- values are treated atomically, with provider-level config taking precedence over global config.Reviewer Test Plan
Configure a model provider with
extra_body:{ "modelProviders": { "openai": [{ "id": "custom-model", "envKey": "OPENAI_API_KEY", "generationConfig": { "extra_body": { "enable_thinking": true } } }] } }Use the /model command to switch to that provider
Make a request and verify the extra_body parameters are included in the API call
Test with both regular and vision models for DashScope provider
Testing Matrix
Tests were run on macOS and all 72 affected tests pass.
Linked issues / bugs
Resolves #1647
Resolves #1644
🤖 Generated with Qwen Code