Add Workflow ID Header to AI Model Requests

Add an X-n8n-Workflow-ID HTTP header to outbound requests from AI/LLM nodes, containing the workflow ID that invoked the AI request.

Problem / Use Case

When routing AI requests through an AI Gateway (e.g., for cost management, rate limiting, or request routing), there’s no way to identify which n8n workflow originated each request.

This makes it impossible to:

  • Count requests per workflow for usage tracking and billing

  • Attribute AI costs to specific workflows or teams

  • Apply workflow-specific policies (rate limits, model routing, budgets)

  • Generate usage reports broken down by workflow

Proposed Solution

Include the workflow ID as a custom HTTP header (X-n8n-Workflow-ID) in all outbound requests made by AI/LLM nodes.

Example header:

X-n8n-Workflow-ID: abc123-def456-ghi789

This allows AI Gateways and proxies to intercept the header and use it for request attribution, logging, and policy enforcement.

Benefits

  • Request attribution: AI Gateways can count and attribute requests to specific workflows

  • Cost allocation: Enables per-workflow billing and budget tracking

  • Usage analytics: Build dashboards showing AI usage patterns across workflows

  • Policy enforcement: Apply workflow-specific rate limits or model routing rules