Skip to main content
This page documents the columns you’ll see when querying usage directly. Steward writes locally first and batches metadata to Butler; the dashboard reads from Butler’s database.
  • Steward (gateway) writes request rows immediately to its local DB and uploads bodies to your S3/GCS when configured.
  • Butler (control plane) ingests usage/metadata in batches from Steward and serves the dashboard/API.
  • The Web dashboard queries Butler. If you query directly, prefer Butler’s DB for analytics consistency.

llm_requests

One row per proxied request.
ColumnTypeDescription
iduuidRequest id.
majordomo_api_key_iduuidOwning Majordomo API key.
provider_api_key_hashvarchar(64)Hash of upstream provider Authorization header.
provider_api_key_aliasvarchar(255)Optional alias from X-Majordomo-Provider-Alias.
providervarchar(100)openai, anthropic, or gemini.
modelvarchar(100)Model name as reported (or translated).
request_pathtextUpstream path (e.g., /v1/chat/completions).
request_methodtextHTTP method.
requested_attimestamptzTimestamp when request was received.
responded_attimestamptzTimestamp when response was fully sent.
response_time_msintWall-clock response time.
input_tokensintCount parsed from provider response.
output_tokensintCount parsed from provider response.
cached_tokensintPrompt caching read tokens (if applicable).
cache_creation_tokensintTokens charged to create cache entries.
input_costnumeric(12,8)Calculated cost for input tokens.
output_costnumeric(12,8)Calculated cost for output tokens.
total_costnumeric(12,8)Sum of input/output (and cache) costs.
status_codeintUpstream HTTP status.
error_messagetextTruncated error body when status ≥ 400.
raw_metadatajsonbAll custom headers (X-Majordomo-*, minus reserved) without indexing.
indexed_metadatajsonbSubset of active keys copied for fast @> queries (GIN index).
request_bodytextOptional local body copy when Postgres body storage is enabled.
response_bodytextOptional local body copy when Postgres body storage is enabled.
body_s3_keytextObject key when uploaded to S3/GCS via personal/org config.
model_alias_foundboolTrue if pricing alias resolved for the model.
org_iduuidOwning org (shadow for filtering/joins).
created_attimestamptzRow creation timestamp.
synced_to_butlerboolSteward-only: batched to Butler yet.
Indexes: by (majordomo_api_key_id, requested_at DESC), and a GIN index on indexed_metadata.

llm_requests_metadata_keys

Per-API-key registry of discovered metadata keys and their indexing state.
ColumnTypeDescription
majordomo_api_key_iduuidAPI key owner. Part of PK.
key_namevarchar(255)Stored name (prefix X-Majordomo- is stripped). Part of PK.
display_namevarchar(255)UI label.
key_typevarchar(50)Semantic hint, default string.
is_requiredboolReserved for future validation.
is_activeboolIf true, key is copied into indexed_metadata.
activated_attimestamptzWhen indexing was enabled.
request_countbigintHow many requests carried this key.
last_seen_attimestamptzMost recent occurrence.
hll_statebyteaHyperLogLog state.
approx_cardinalityintApprox unique values for the key.
hll_updated_attimestamptzLast HLL update.
created_attimestamptzRow creation timestamp.
Index: is_active per API key for fast lookups.

Notes

  • Reserved headers that do not enter raw_metadata: X-Majordomo-Key, X-Majordomo-Provider, X-Majordomo-Provider-Alias.
  • Bodies in Postgres are off by default; prefer S3/GCS via Cloud Body Storage.

SQL primer

For end‑to‑end examples, see Cost Attribution. A few quick patterns:
-- Last 7 days by day
SELECT date_trunc('day', requested_at) AS day,
       COUNT(*) AS requests,
       SUM(total_cost) AS total_cost
FROM llm_requests
WHERE requested_at >= now() - interval '7 days'
GROUP BY 1
ORDER BY 1;
-- Filter by an indexed metadata key (fast)
SELECT COUNT(*), SUM(total_cost)
FROM llm_requests
WHERE indexed_metadata @> '{"Feature": "document-review"}';
-- Filter by a non‑indexed key (works, slower)
SELECT COUNT(*), SUM(total_cost)
FROM llm_requests
WHERE raw_metadata->>'Team' = 'platform';