Support custom HTTP headers in the AI Agent (Chat Models) node

The idea is:

Add a Custom headers parameter to the AI Agent → Chat Models sub-node so users can pass arbitrary HTTP headers (name / value, supports expressions) to the underlying request.


My use case:

I run several n8n workflows against OpenRouter.

OpenRouter lets you group usage in their dashboard and billing by sending two optional headers:

Header Purpose
HTTP-Referer Identifies the calling app / workflow for cost tracking
X-Title Human-readable label shown in the dashboard

Without header support every call made by the Agent node gets lumped together, so it’s impossible to see which workflow burned through the token budget. Having per-workflow headers would fix that.

(OpenRouter header docs: see “HTTP-Referer” and “X-Title” here) → https://openrouter.ai/docs/api-reference/overview#headers


I think it would be beneficial to add this because:

  • Granular cost & usage accounting for anyone using the Agent node with OpenRouter (or any future provider that supports custom headers).
  • Mirrors the flexibility already available in the HTTP Request node—so the behaviour is consistent across n8n.

Any resources to support this?


Are you willing to work on this?

I’m not familiar with the n8n codebase, but if someone points me at the relevant files I can try a PR.

Good one! This will be helpful

1 Like

is there a resolution or new functionality to this issue ?

i’d love to have this new feature i’ve got exactly the same issue right now and this would help me a lot ! :grinning_face_with_smiling_eyes:

+1, this is still a real blocker in production use cases.

We are using n8n AI Agent nodes with OpenRouter in a multi-tenant environment.
LLM providers already expose detailed activity exports (CSV) with request-level metadata,
but without the ability to attach custom headers or request identifiers from the AI Agent node,
it is impossible to reliably correlate LLM usage with:

  • workflow executions
  • end users
  • tenants / accounts

Injecting correlation IDs into the prompt works only as a workaround and is not suitable for:

  • cost attribution
  • auditing
  • billing
  • enterprise observability

Allowing optional custom headers (expression-based, advanced section) would fully solve this
in a provider-agnostic way and unlock much better AI observability in n8n.