Sooner or later a usage event arrives that you can't price: a new model name, a missing cached-input rate, a provider response without usage. The easy option is to count it as zero. AgentMargin deliberately doesn't.
Three ways to know a cost
| State | Where it comes from |
|---|---|
| Reported | The provider reported the cost. A reported $0 is valid. |
| Estimated | Tokens × the workspace price version in effect at the event's timestamp. |
| Unknown | Neither of the above was available when the event was ingested. |
Why not assume zero?
Counting an unpriced event as $0 makes that customer look cheaper than they are, and the margin reads as complete when it isn't. So unknown events suppress the final AI contribution and margin for the customers they affect. Only known-cost events count towards the known AI cost.
The same rule covers the edges. A missing cached-input rate means unknown cost for events with cached tokens, not free cached tokens. A response without usage is rejected by the OpenAI helpers instead of being counted as free.
Seeing what's unknown
Analytics lists the models behind unknown-cost events for the selected workspace and time window:
{
"unknownModels": [
{ "model": "example-model", "eventCount": 4 }
],
"unknownModelsTruncated": false
}The list holds up to 20 models, ordered by event count. When unknownModelsTruncated is true, more models are affected than shown. Counts are events, not dollars or customers.
Fixing it
- Check that the provider response actually contains usage and that the model name is mapped correctly.
- Prefer the provider's reported cost where it's trustworthy.
- Otherwise add a verified price version with the right effective dates.
- Retry only new, distinct events. Stored events and their costs are immutable.


