Skip to content

[Feature Request] Add Support for extra_headers in Azure OpenAI Client #2432

@Zihan-Zhu

Description

@Zihan-Zhu

Required prerequisites

Motivation

Hello Team,

Some enterprise users of Azure OpenAI are required to include additional HTTP headers—such as custom correlation IDs or subscription keys—when making requests to the endpoint. Currently, the camel-ai does not support a straightforward way to customize or inject these headers.

I propose adding support for an extra_headers parameter in the client call to allow users to specify additional headers as needed.

Example Use Case:

completion = client.chat.completions.create(
    model="gpt-35-turbo",
    messages=[
        {
            "role": "user",
            "content": "Hello OpenAI",
        },
    ],
    extra_headers={
        'x-correlation-id': str(uuid.uuid4()),
        'x-subscription-key': os.getenv("SUBSCRIPTION_KEY")
    }
)

Thank you for your time and for the great work on this project!

Solution

No response

Alternatives

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

P1Task with middle level priorityenhancementNew feature or requestgood first issueGood for newcomers

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions