Skip to content

openai: add CustomHeaders to ChatModelConfig for parity with agenticopenai#905

Open
MOWmsc wants to merge 1 commit into
cloudwego:mainfrom
MOWmsc:feat/add-custom-headers-to-chatmodel-config
Open

openai: add CustomHeaders to ChatModelConfig for parity with agenticopenai#905
MOWmsc wants to merge 1 commit into
cloudwego:mainfrom
MOWmsc:feat/add-custom-headers-to-chatmodel-config

Conversation

@MOWmsc

@MOWmsc MOWmsc commented Jul 4, 2026

Copy link
Copy Markdown

ChatModelConfig now exposes CustomHeaders to set extra HTTP headers on every request. The underlying openai.Config and genRequest() already support CustomHeaders mapping, so no changes are needed in the acl library.

Changes

  • chatmodel.go: Add CustomHeaders map[string]string field to ChatModelConfig, and map it to openai.Config.CustomHeaders in NewChatModel
  • option.go: Add WithCustomHeaders option function for per-request header overrides (consistent with agenticopenai.ChatConfig naming)
  • chatmodel_test.go: Add unit tests verifying config mapping

How it works

The full CustomHeaders pipeline already exists in the lower layers — this PR just exposes the configuration entry point:

ChatModelConfig.CustomHeaders (NEW)
    ↓
openai.Config.CustomHeaders (already exists)
    ↓
genRequest().specOptions.ExtraHeader (already works)
    ↓
openai.WithExtraHeader() → reqOpts (already works)
    ↓
HTTP Request Headers (already works)

Fixes #1048

…penai

ChatModelConfig now exposes CustomHeaders to set extra HTTP headers
on every request. The underlying openai.Config and genRequest()
already support CustomHeaders mapping, so no changes are needed
in the acl library.

Also adds WithCustomHeaders option function for per-request header
overrides, consistent with agenticopenai.ChatConfig naming.

Fixes cloudwego/eino-ext#1048
@MOWmsc
MOWmsc force-pushed the feat/add-custom-headers-to-chatmodel-config branch from a63b545 to a67171b Compare July 4, 2026 15:29
@CLAassistant

CLAassistant commented Jul 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

2 participants