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