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.
i’d love to have this new feature i’ve got exactly the same issue right now and this would help me a lot !
+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.
Also came here trying to find how to add “application-axis” for cost tracking when working through OpenRouter.
It would be useful when troubleshooting/optimizing/refactoring separate AI nodes when there’re multiple AI nodes in the same workflow (or in a group of n8n workflows, which constitute some bigger logic/process workflow). For example, if I optimize one AI node and what to see the impact on this node’s cost. To do this currently, it would require to assign different API keys per each AI node, which is tiresome when there’re multiple AI nodes and probably an overkill. It becomes even less convenient when we have multiple logical/process workflows - OpenRouter usage dashboard will list them all, which won’t allow to see cumulative impact of a single workflow. The latter can be solved by having OpenRouter’s Workspaces per process workflow, but in many cases it’s also an overkill and can reduce observability.
However, I’m not sure that adding ability to specify custom headers is the way to solve the problem of passing application name to OpenRouter. When there’re multiple AI nodes in a workflow (or in a group of interconnected workflows), specifying headers in all AI nodes would quickly turn to a mess. Maybe, the more appropriate solution is to add a dedicated optional “application name” property either to the “OpenRouter Model” node, or to the “OpenRouter” credential type.
Seconded - and @dmitrillobanov’s point about multiple AI nodes is valid. A practical middle ground: support custom headers at the credential level rather than per-node. If you can set X-Title: my-workflow on the OpenAI credential config itself, it propagates to every node using that credential without per-node config. For multi-node cost tracking, you’d just create separate credentials per workflow and let OpenRouter aggregate by credential/header.