How to get your Google Gemini API usage, balance and spend programmatically
What the Google Gemini API exposes
| Signal | Google Gemini |
|---|---|
| Balance | No |
| Spend history | No |
| Cost breakdown | No |
| Plan and quota | No |
| Cost on each response | Token counts only |
| Rate-limit headers | None |
| Credential | API key |
Call it yourself
Credential. A Gemini API key. Argus only validates it, with GET /v1beta/models.
What each response carries
{
"responseId": "c2b1…",
"modelVersion": "gemini-2.5-flash",
"usageMetadata": {
"promptTokenCount": 1204,
"candidatesTokenCount": 311,
"cachedContentTokenCount": 0,
"thoughtsTokenCount": 128
}
}Trimmed to the fields Argus reads. Values are examples.
No billing API, so measure from your side
Argus measures Gemini from your side: the SDK records usageMetadata token counts on every call, and Argus prices them against its per-model rates. For billed totals, use the Cloud Billing export to BigQuery.
Gotchas
- 429 RESOURCE_EXHAUSTED covers rate limits, spend guardrails and exhausted credits alike.
- Prompts over 200K tokens reprice higher on long-context models.
- Thinking tokens (thoughtsTokenCount) bill as output. Count them or your estimate runs low.
How Google Gemini charges
Free tier plus paid per-token (prepaid credits, or invoiced at Tier 3). Long-context prompts (>200K) reprice higher. No usage/billing API and no rate-limit headers.
- Tier 1: ~$250/mo cap; $10 per 10-min guardrail
- Tier 3: $20k–100k+ cap; postpay unlocked
Free allowance. 1 a day. Flash-class models at low RPM/RPD; Pro-class removed from free tier.
At zero. 429 RESOURCE_EXHAUSTED on any limit/guardrail or exhausted credits.
- requests per minute, per model. Per-model × per-tier RPM/TPM/RPD; live dashboard is source of truth. No rate-limit headers.
Or let Argus track it
Paste the key once. Argus keeps the ledger, and your coding agent reads it through the MCP server.
- With the SDK, records token counts on each response and prices them per model, so you see what a call cost before the provider's daily bucket lands.
- Emails you on low balance, days to zero, a spend spike, or projected overage.
- Hands all of it to your coding agent over MCP, so it can ask what a run cost or how much runway is left without leaving the editor.
> what has google_gemini cost today, and how long until it runs out?
get_overview → google_gemini: mtd spend, burn per day, days to zero
get_request_costs { "provider": "google_gemini", "limit": 25 }
get_advisories → credits_low, spend_spike, rate_limit_low …Questions
- Does Google Gemini have an API for its balance?
- The Gemini API has no balance or usage endpoint. Spend lives in Google Cloud Billing, not the Gemini API, and responses carry no rate-limit headers. Per-call token counts are in each response's usageMetadata.
- Can I get Google Gemini spend per day from the API?
- No. Count calls and price them yourself, or let the Argus SDK do it.
- What happens when Google Gemini credits run out?
- 429 RESOURCE_EXHAUSTED on any limit/guardrail or exhausted credits. Auto-recharge is available.
- What key does Argus need for Google Gemini?
- A Gemini API key. Argus only validates it, with GET /v1beta/models.
Related
Pricing and limits verified 2026-07-20 against ai.google.dev/gemini-api/docs/pricing, ai.google.dev/gemini-api/docs/rate-limits. Endpoints are the ones the Argus Google Gemini connector calls.
Connect a provider key, point Claude Code or Cursor at the Argus MCP server, and ask what the last run cost.