Skip to content

openai options support extra params #3409

@YunKuiLu

Description

@YunKuiLu

Expected Behavior

I noticed that the chat.completions.create method in version 1.82.1 of the Python OpenAI package includes support for extra_headers, extra_query, and extra_body.

completion = client.chat.completions.create(
        model="qwen-plus-2025-04-28",
        messages=messages,
        extra_headers={
            "Authorization": f"Bearer {os.getenv('DASHSCOPE_API_KEY')}"
        },
        extra_body={"enable_thinking": True},
        stream=True
    )

In OpenAiChatOptions, we already have the httpHeaders parameter which can serve as an alternative to extra_headers. However, there are no corresponding alternatives for extra_query and extra_body.

Will Spring AI support these two parameters? Doing so might avoid the need for a lot of model-specific implementations.

Context
https://pypi.org/project/openai/

Image

Related
#4324
#4309

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions