feat(config): support user-defined custom HTTP headers for LLM API requests - #9454
Open
minimAluminiumalism wants to merge 1 commit into
Open
Conversation
Collaborator
Collaborator
|
Related to open PR #9518. |
teknium1
reviewed
Jul 12, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the contribution. The native Anthropic portion addresses a gap that still exists on current main, but this patch needs a focused salvage onto the established header configuration path.
Problems
- The new top-level
custom_headersconfig duplicates the existing model-level request-header surface. Current docs exposemodel.default_headersandmodel.extra_headersatcli-config.yaml.example:77-91; the issue itself proposedmodel.custom_headers. - The diff does not update the primary OpenAI construction path. Current primary construction is
agent/agent_init.py:892-1105, so direct-agent and child-agent OpenAI requests would not consume this new setting. - Current native Anthropic construction still has the requested gap:
agent/anthropic_adapter.py:780-829assembles required headers and creates the SDK client without merging user configuration. The current OpenAI-only exclusion is explicit atcli-config.yaml.example:77-84.
Suggested changes
- Extend the existing model-level header helper into
build_anthropic_client, preserving required Anthropic headers across construction and rebuild paths. - Reuse the current
model.default_headers/model.extra_headersschema instead of adding a top-level key. - Cover native Anthropic and rebuild behavior with a temporary
HERMES_HOMEregression test.
This is an automated hermes-sweeper review.
|
|
||
| DEFAULT_CONFIG = { | ||
| "model": "", | ||
| "custom_headers": {}, |
Contributor
There was a problem hiding this comment.
This introduces a second global header schema, while current main documents model.default_headers / model.extra_headers for request headers (cli-config.yaml.example:77-91). Please extend that existing model-level contract instead of adding a top-level custom_headers key; the PR also needs to wire the setting into the primary client path, not only the auxiliary and Anthropic constructors.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
custom_headersconfig field in config.yaml, merged into all outgoing LLM API requests (Anthropic + OpenAI/OpenRouter)Closes #9398
Test plan