A small Hermes Agent plugin that injects configurable User-Agent and extra HTTP headers into OpenAI-compatible clients created by Hermes.
It is useful when a custom OpenAI-compatible proxy or upstream expects a specific client identity header, such as Codex CLI-like headers.
- The plugin patches
openai.OpenAIandopenai.AsyncOpenAIclient construction inside Hermes. - It injects headers only when:
- the plugin is enabled in Hermes config;
- the plugin config is enabled;
- the active API mode is allowed, defaulting to
codex_responses; - the client
base_urlmatchesbase_urls, if configured.
- It does not inject a default browser User-Agent. Set
user_agentexplicitly. - Extra headers are configured through
headers,default_headers, orextra_headers.
From a GitHub shorthand:
hermes plugins install owner/hermes-plugin-custom-user-agent --enableOr from a full Git URL:
hermes plugins install https://github.com/owner/hermes-plugin-custom-user-agent.git --enableThen restart Hermes / the gateway so the plugin is loaded.
Add this to $HERMES_HOME/config.yaml:
plugins:
enabled:
- custom-user-agent
disabled: []
custom_user_agent:
enabled: true
api_modes: [codex_responses]
base_urls:
- http://your-openai-compatible-endpoint/v1
user_agent: "codex_cli_rs/0.132.0 (Ubuntu 24.04; x86_64) WindowsTerminal"
headers:
originator: codex_cli_rs| Option | Type | Default | Notes |
|---|---|---|---|
enabled |
bool/string | true |
Set false, off, no, or disabled to turn the plugin off internally. |
api_modes / apply_to_api_modes / api_mode |
string/list | [codex_responses] |
Use "*" to apply to all API modes. |
base_urls / base_url |
string/list | all endpoints | Strongly recommended so the plugin does not affect unrelated providers. Trailing slash is ignored. |
user_agent / User-Agent / user-agent |
string | none | Explicit User-Agent value to inject. |
headers / default_headers / extra_headers |
mapping | none | Extra headers to inject, e.g. originator: codex_cli_rs. |
export HERMES_CUSTOM_USER_AGENT='codex_cli_rs/0.132.0 (Ubuntu 24.04; x86_64) WindowsTerminal'The environment value overrides the configured user_agent value.
Some Codex-style endpoints reject browser-like User-Agent values with HTTP 403. Prefer a Codex-shaped value and restrict the plugin to the endpoint that needs it.
Real Codex CLI headers are shaped like:
User-Agent: codex_cli_rs/<codex-version> (<system-type> <system-version>; <arch>) <terminal-identifier>
originator: codex_cli_rsExample:
User-Agent: codex_cli_rs/0.132.0 (Ubuntu 24.04; x86_64) WindowsTerminal
originator: codex_cli_rsBad idea for Codex-style upstreams:
user_agent: Mozilla/5.0hermes plugins listFor network-level verification, point the OpenAI-compatible base URL at a temporary HTTP capture or reverse proxy and inspect the request headers there.
If headers do not appear, check:
base_urlsmatches the endpoint exactly apart from trailing slash.api_modesincludes the active mode, usuallycodex_responses.user_agentis not empty.- Extra upstream-required headers, such as
originator: codex_cli_rs, are present if needed. - Hermes / the gateway was restarted after changing plugin files or config.
This plugin is a standalone Hermes user plugin. The repository root should contain:
plugin.yaml
__init__.py
README.md
after-install.md
LICENSE
examples/config.yaml
Before publishing, remove generated files such as __pycache__ and do not include private endpoints or credentials.