The single highest-leverage move in AI spend tracking takes about an hour and requires no application code: structuring your API keys so that spend attributes itself. Shared keys make attribution impossible after the fact. Well-structured keys make it automatic.
Why shared keys defeat tracking
When every team and workload uses one API key, the vendor bill is a single undifferentiated total. There is no way to tell which team, feature, or project drove the spend, because the only identifier the vendor sees is the key, and the key is shared. Every attribution problem downstream traces back to this.
One key per meaningful unit
Issue a separate API key for each unit you want to track: per team, per major feature, or per environment. Name each key so the owner is obvious. Now the vendor's own per-key usage reporting becomes your attribution layer, no tagging or instrumentation required for the basic breakdown.
Maintain a key registry
Keys only work as an attribution mechanism if you know what each one is for. Keep a simple registry that maps every active key to its owner, its purpose, and its expected monthly spend. This registry is what you reconcile the vendor billing against each month, and it is what surfaces keys that are spending with no clear owner.
Rotate and revoke deliberately
Key hygiene is spend hygiene. A key that belongs to a deprecated project should be revoked, not left running. A monthly review of active keys against the registry catches the orphaned keys that quietly keep spending after their workload is gone.
API key architecture is unglamorous and it is the foundation everything else stands on. Get the keys right, and team, feature, and project tracking all become far easier. Leave them shared, and every later attribution effort fights the same losing battle.