What CostGraph scrapes
Connect the gateway in Settings > Integrations and CostGraph serves this
target to the operator. Override the namespace or selector on the connection if
you run it somewhere else.
How the metric maps
gen_ai_client_token_usage becomes
costgraph_gen_ai_usage_total:
The unit is always
tokens.
Envoy AI Gateway also reports gen_ai_token_type="total". CostGraph reads the
input and output series and drops the total, so the same tokens are never
counted twice.
Attribute usage to your customers
Map a request header onto the metrics. This is a controller-wide setting, so every gateway that controller manages shares the mapping.customer.id arrives as the label customer_id: dots become
underscores on the Prometheus side.
Group usage by agent run
Add the run header to the same setting, so a run’s model cost appears next to its sandbox cost on AutoPilot > Sandboxes > Runs. Separate the mappings with a comma, escaped as\, for Helm:
x-costgraph-run-id on each request, set to the run tag of
the run’s sandboxes. Refer to
Group cost by run.
AI gateways
Connecting, pricing, and sending usage yourself.