Skip to content

fix(model/openai): add CustomHeaders to ChatModelConfig#868

Open
Dennisadira wants to merge 1 commit into
cloudwego:mainfrom
Dennisadira:fix/openai-chat-model-custom-headers
Open

fix(model/openai): add CustomHeaders to ChatModelConfig#868
Dennisadira wants to merge 1 commit into
cloudwego:mainfrom
Dennisadira:fix/openai-chat-model-custom-headers

Conversation

@Dennisadira

Copy link
Copy Markdown

Problem

components/model/openai.ChatModelConfig lacks a CustomHeaders field, while agenticopenai.ChatConfig and the underlying libs/acl/openai.Config both support it. This inconsistency means users of the openai package cannot pass custom HTTP headers per request.

Closes #1048

Changes

  • Added CustomHeaders map[string]string field to ChatModelConfig with an // Optional. doc comment matching the struct's existing style.
  • Threaded config.CustomHeaders into the openai.Config{} struct literal inside NewChatModel.
  • Bumped libs/acl/openai dependency from v0.1.17 to v0.1.18-0.20260527084435-846f52bd97c6 (the pseudo-version that introduced CustomHeaders in Config), matching what agenticopenai already uses.
  • Added a unit test TestOpenAIGenerate/custom headers preserved in config that constructs a ChatModelConfig with CustomHeaders set and verifies the field is preserved and that NewChatModel accepts the config without error.

Test plan

  • go build ./components/model/openai/... passes
  • go vet ./components/model/openai/... passes
  • New sub-test custom headers preserved in config added

Signed-off-by: Adira Denis Muhando dennisadira@gmail.com
Assisted-by: Claude Sonnet 4.6 [claude-code]

components/model/openai.ChatModelConfig was missing the CustomHeaders
field supported by agenticopenai.ChatConfig and libs/acl/openai.Config,
causing inconsistency across the openai model packages. This adds the
field and threads it through to the underlying openai.Config in
NewChatModel, and bumps the libs/acl/openai dependency to the
pseudo-version that introduced the field.

Fixes #1048

Signed-off-by: Adira Denis Muhando <dennisadira@gmail.com>
Assisted-by: Claude Sonnet 4.6 [claude-code]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant