Keeping track of AI API costs
Last updated: 8 September 2026 · Deutsch
Why a subscription quota and an API bill are two different things, which services AI-Cockpit can read, why some of them insist on an admin key — and the figures no interface hands out at all.
Quota and cost are not the same thing
A Claude or ChatGPT subscription gives you a quota: a percentage of a window, refilling on a schedule, with a flat monthly price attached. An API key gives you a bill: every request costs money, and nothing refills. These are separate mechanics and the app keeps them on separate cards — Claude and ChatGPT on one side, the Anthropic and OpenAI platform cards on the other.
The monthly total keeps them apart too. It shows what you entered as subscription fees and what the providers reported as API cost, side by side, without converting one into the other. There is no honest exchange rate between “80 per cent of a five-hour window” and “a month of completions”, so none is invented.
What is read, service by service
- Anthropic API — the organisation cost report: today, this month, and the total over the retrievable period.
- OpenAI API — organisation costs, plus token figures from the completions usage endpoint, broken down by project and model.
- Kimi (Moonshot) — the account balance. That is all there is.
- OpenRouter — usage and remaining credit.
- Grok (xAI) — credit and, where one applies, the spending cap.
- GitHub Copilot — premium requests and the amount they come to.
Why an admin key, and what it is
Three of these providers do not expose billing figures to an ordinary key at all. An admin key is an account-level key: it can read across the organisation rather than within a single project, which is precisely why cost data sits behind it.
- Anthropic needs an admin key from the console, prefixed
sk-ant-admin. An ordinary API key is refused with a 403, because it is not permitted to read cost data. - OpenAI needs an organisation admin key, prefixed
sk-admin-. An ordinary project key is refused with a 401. - xAI needs a management key from the console, not the usual
xai-key you send requests with. That one is refused too. It is not an enterprise hurdle: an individual account can create one. - GitHub Copilot needs a fine-grained personal access token with the account permission “Plan: read-only”, created by you in the GitHub settings. No OAuth flow, no cookie.
What matters more than the prefix is what the app does with it: it only ever reads. Every cost client sends a plain GET — no method is set anywhere in the request builder, and the Windows version spells the same GET out explicitly. The only POST in the entire app is the OAuth token exchange, which has nothing to do with these keys. Nothing is created, changed or deleted in your account, and there is no code path that could.
How far back the figures go
Anthropic returns three years at daily resolution. OpenAI returns three years for the plain total, but only one year for the breakdown by project and by model. That is not an arbitrary choice: those two endpoints group server-side across a thousand daily buckets, and over three years they answered with server errors and timeouts while the ungrouped total went through. A year of grouped data that arrives beats three years that do not, and the card says which it is showing.
Where the interfaces stop
- OpenAI does not hand out your balance. All three billing routes answer that the request must be made with a session key. What the app can do is arithmetic: the amount you last topped up, minus what has been spent since that date. Without a top-up date entered, there is no figure.
- There is no budget endpoint at OpenAI. Budgets and limits set in the web console are not retrievable, so the app cannot show progress against them.
- Kimi has no usage endpoint. The documentation knows the balance and nothing else — daily, monthly and total consumption exist only in Moonshot's own web interface.
- Copilot only for personally paid plans. If your seat is billed through an organisation or enterprise, GitHub excludes it from the user-level endpoint. The response is then simply empty — indistinguishable from “nothing used this month”, which is why the card carries that as a standing note rather than an error.
- A zero cap at xAI means “does not apply”. Pure credit accounts report their spending limit as zero. Reading that as “nothing may be spent” would produce a permanent bar at 0 of 0, so no bar is drawn.
Where the keys live
Every key you enter goes into the macOS Keychain, tied to that device, and into Windows Credential Manager on the Windows version. Nothing is copied to a server of mine. A key leaves the device only as authentication toward the provider it belongs to.
The short version of the admin-key question, and what happens when a card stays empty, are on the FAQ page. What was examined in the code, what was found and what was deliberately left alone, is on the Security page.