Tracking Token Costs Across Multiple AI Providers Behind One API Key
Using a single API key across OpenAI, Claude, and Gemini does not automatically produce comparable cost and usage data. The article argues that teams should instrument the full request lifecycle and record dimensions that explain the work performed, rather than relying on one aggregate cost figure. It proposes a three-level identity scheme (request, attempt, and span) so that retries, streaming output, and tool calls can be distinguished and correctly counted. Each telemetry event should carry explicit, consistently defined fields such as model, operation, status, timing, and input and output units, with estimated and provider-confirmed values labeled separately. The author also notes that retries can make dashboards misleading, recommending that delivered work and total performed work be tracked as separate totals.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in