hermes - 💡(How to fix) Fix [Feature]: configurable default headers / User-Agent for third-party API [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#12785Fetched 2026-04-20 12:17:00
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×1renamed ×1subscribed ×1unsubscribed ×1

Fix Action

Fix / Workaround

  • patching the source code
  • adding a local reverse proxy to inject headers
  • using environment-specific hacks
RAW_BUFFERClick to expand / collapse

Problem or Use Case

Many third-party API relays are placed behind Cloudflare, whose WAF often intercepts and blocks requests with default or missing User-Agents. Currently, Hermes instantiates OpenAI-compatible clients directly in code (e.g., OpenAI(api_key=..., base_url=...)), leaving no supported way to inject custom headers like a custom User-Agent to bypass these Cloudflare restrictions. This forces users to modify the source code or deploy an additional reverse proxy, which is far from ideal.

Proposed Solution

Expose an optional config field for default headers, for example: yaml model: base_url: https://example.com/v1 api_key: sk-... default_headers: User-Agent: HermesAgent/1.0 X-Client-Name: Hermes Implementation idea:

  • pass default_headers=... when constructing coustom
  • support the same for custom endpoint paths and other OpenAI-compatible client creation points
  • merge user headers with provider defaults; user config should win on conflicts

Alternatives Considered

  • patching the source code
  • adding a local reverse proxy to inject headers
  • using environment-specific hacks

These work, but a built-in config option would be cleaner and easier to maintain.

Feature Type

Gateway / messaging improvement

Scope

Small (single file, < 50 lines)

Contribution

  • I'd like to implement this myself and submit a PR

Debug Report (optional)

extent analysis

TL;DR

Add an optional default_headers config field to allow custom headers, such as a User-Agent, to be injected into API requests.

Guidance

  • Expose a default_headers field in the configuration to allow users to specify custom headers.
  • Pass the default_headers to the API client constructor to inject the custom headers into requests.
  • Merge user-provided headers with provider defaults, ensuring user config takes precedence in case of conflicts.
  • Consider supporting custom headers for custom endpoint paths and other OpenAI-compatible client creation points.

Example

model:
  base_url: https://example.com/v1
  api_key: sk-...
  default_headers:
    User-Agent: HermesAgent/1.0
    X-Client-Name: Hermes

Notes

This solution assumes that the API client constructor can accept custom headers. If this is not the case, additional modifications may be necessary.

Recommendation

Apply workaround by adding the proposed default_headers config field, as it provides a clean and maintainable solution to bypass Cloudflare restrictions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix [Feature]: configurable default headers / User-Agent for third-party API [1 participants]