Skip to main content
Every request through the gateway can carry custom metadata via X-Majordomo-* headers. This metadata is stored with the request log and queryable in the dashboard and directly in Postgres.

Adding metadata

Any header prefixed with X-Majordomo- (except -Key and -Provider) is stored as metadata:
Start with the dimensions you’ll actually query. You can add more over time — new keys are stored immediately without any schema changes.

Querying spend

By feature

By team (monthly)

By model

Top spenders this week

Indexed metadata

High-cardinality metadata keys (user IDs, experiment names) can be activated for GIN indexing in the dashboard. Activated keys are copied to the indexed_metadata JSONB column, which supports fast @> queries.
Non-indexed keys are still queryable via raw_metadata — just without the index. Activate keys for dimensions you query frequently.

Grouping an agent’s calls

Metadata attributes cost across dimensions (feature, team, user). To instead group the multiple LLM calls of one conversation or agent run into a single run — with a rolled-up cost and a nested waterfall — use Agent Run Tracking. The two compose: tag a run with a trace id and an X-Majordomo-Feature to both drill into one run and roll runs up by feature.