Skip to content

feat: Add 'extra_body' parameter support for provider and model options - #6761

Closed
yuguorui wants to merge 1 commit into
anomalyco:devfrom
yuguorui:feat/extra-body-param
Closed

feat: Add 'extra_body' parameter support for provider and model options#6761
yuguorui wants to merge 1 commit into
anomalyco:devfrom
yuguorui:feat/extra-body-param

Conversation

@yuguorui

Copy link
Copy Markdown
Contributor

In the OpenAI Python SDK, the Completions.create method includes an extra_body parameter that lets users add custom JSON properties to the request payload. This feature is particularly useful in various scenarios—such as enabling capabilities like thinking [1][2], search, topP, temperature, and more, across different LLM providers.

Here[3] is the implementation in the Python SDK for reference.

[1] https://bailian.console.alibabacloud.com/?tab=api#/api/?type=model&url=2712576
[2] https://docs.z.ai/api-reference/llm/chat-completion
[3] https://github.com/openai/openai-python/blob/af8f606b3eef1af99f98929847f1b5baf19171ae/src/openai/resources/chat/completions.py#L76

CopilotAI review requested due to automatic review settings January 3, 2026 16:59

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds support for an extraBody parameter to both provider-level and model-level options, allowing users to add custom JSON properties to request payloads. This feature mirrors the OpenAI Python SDK's extra_body parameter and enables capabilities like thinking, search, topP, and temperature across different LLM providers.

Key changes:

  • Adds extraBody configuration option to provider and model options
  • Implements logic to merge provider-level and model-level extraBody properties into the request
  • Updates documentation with examples showing how to configure extraBody

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

FileDescription
packages/web/src/content/docs/providers.mdxAdds documentation and examples for the new extraBody configuration option at both provider and model levels
packages/opencode/src/provider/transform.tsImplements the merging logic for extraBody properties from provider and model options into the request parameters

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/web/src/content/docs/providers.mdx Outdated
Comment threadpackages/opencode/src/provider/transform.ts Outdated
Comment threadpackages/opencode/src/provider/transform.ts Outdated
In the OpenAI Python SDK, the `Completions.create` method includes an
`extra_body` parameter that lets users add custom JSON properties to the
request payload. This feature is particularly useful in various scenarios—such
as enabling capabilities like thinking [1][2], search, topP, temperature, and
more, across different LLM providers.
Here[3] is the implementation in the Python SDK for reference.
Signed-off-by: yuguorui <yuguorui@pku.edu.cn>
[1] https://bailian.console.alibabacloud.com/?tab=api#/api/?type=model&url=2712576
[2] https://docs.z.ai/api-reference/llm/chat-completion
[3] https://github.com/openai/openai-python/blob/af8f606b3eef1af99f98929847f1b5baf19171ae/src/openai/resources/chat/completions.py#L76
@yuguorui
yuguoruiforce-pushed the feat/extra-body-param branch from 43ec371 to 554ee32CompareJanuary 3, 2026 17:17
@yuguorui

Copy link
Copy Markdown
ContributorAuthor

Some typical LLM service providers (such as Alibaba BaiLian, one of Asia's largest cloud service providers) enable the thinking feature through non-standard OpenAI-compatible request body parameters. By adding support for extra_body, users can manually turn thinking on or off.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/web/src/content/docs/providers.mdx
Comment threadpackages/web/src/content/docs/providers.mdx
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@yuguorui