What CostGraph scrapes
Read the labels off the running data plane pods and narrow the selector until it
matches them and nothing else:
How the metric maps
agentgateway_gen_ai_client_token_usage becomes
costgraph_gen_ai_usage_total:
The unit is always
tokens.
Attribute usage to your customers
Add a metric attribute computed from the request. On Kubernetes this goes in an AgentgatewayPolicy. The value is a CEL expression, so the identifier can come from a header, a JWT claim, or anything else in the request.A policy applies only where it is targeted, so it needs
targetRefs or
targetSelectors naming your Gateway. It must also live in that Gateway’s
namespace, because a policy cannot reach across namespaces. If a policy
already targets the Gateway, add the attributes block to that one instead
of creating a second.AI gateways
Connecting, pricing, and sending usage yourself.