Attribute AI costs to steps that share one API key
Attach a safe stage label to each request and group usage by that label. A shared key identifies the credential but does not identify which step initiated the call.
Example
A support workflow classifies and then summarizes the same case. Both requests use one gateway key, but only one runs on every case.
What to do
- List the workflow stages that send model requests and assign an approved label to each.
- Record the stage and a generated run ID with the usage event.
- Reconcile a synthetic run that exercises both the common path and a conditional stage.
How to verify
The report attributes each model call to the correct stage while the full run total still agrees with observed spend.
Limits
Existing events without a stage label require a separate estimate. Avoid classifying them from private input text.