Authorization, Content-Type, etc.) pass through unchanged.
Request headers
Provider values
Provider inference
IfX-Majordomo-Provider is not set, the gateway infers the provider:
Set the header explicitly when your path doesn’t match the defaults, or when routing the same path to multiple providers.
Data policy headers
These constrain which provider endpoints routing may select. They apply to routed requests; a request that pins a provider goes where you sent it.
Most restrictive wins. Each request’s policy is the union of three layers: the deployment default, the per-API-key floor (
require_zdr / require_no_data_collection, see API Keys), and these headers. A header can add a requirement but never remove one, so a key configured to require ZDR cannot opt out of it per request.
Both fail closed. An endpoint with no explicit guarantee never satisfies a requirement. If nothing qualifies, the request returns 502 rather than falling back to a non-compliant provider.
Response headers
The gateway sets these on the response when the corresponding behavior applied.Metadata headers
Any header prefixed withX-Majordomo- is stored as metadata on the request log, except the reserved headers that carry dedicated behavior: X-Majordomo-Key, X-Majordomo-Provider, X-Majordomo-Provider-Alias, X-Majordomo-Client, the data policy headers (X-Majordomo-ZDR, X-Majordomo-Data-Collection), and the agent run tracking headers (X-Majordomo-Trace-Id, X-Majordomo-Span-Path, X-Majordomo-Span-Name).
raw_metadata JSONB column on llm_requests. Keys can be promoted to the indexed_metadata column (GIN-indexed) via the dashboard for fast @> queries.
Naming convention: The X-Majordomo- prefix is stripped and the remainder is stored as-is. X-Majordomo-Feature becomes Feature in the metadata map.
No schema changes required. New keys are stored immediately. You can add metadata dimensions without touching the database.
Recommended metadata dimensions
See Cost Attribution for query examples.
Agent run tracking
When one logical task, a conversation or an agent/workflow run, makes several LLM calls, these headers group those calls into a single run so the dashboard can show a rolled-up cost and a nested waterfall instead of unrelated requests. They are reserved (consumed by the gateway, not stored inraw_metadata) and stored as first-class columns on llm_requests.
Graceful degradation: a trace id alone gives a flat run rollup (all the run’s calls + total cost); adding a span path gives the nested waterfall (which tool/agent step drove which calls, and what each cost). No SDK is required. Any client that can set headers works.
Full example
Header forwarding
Headers prefixed withX-Majordomo- are not forwarded to upstream providers. They are consumed by the gateway and stripped before the request is proxied. All other headers (including custom X-* headers your provider supports) are forwarded as-is.