# Someone stole or scraped my AI API key and ran up thousands of dollars of model usage. Do I have to pay, will the provider refund it, and how do I stop it happening again?

**Short answer:** Under the provider's terms, usually you, at least to start with. Refunds are at the provider's discretion. Google Cloud's terms make the customer responsible for the security of its account credentials, "including any keys for Google APIs", and for any use of its account. OpenAI's Services Agreement makes the customer responsible for all activity under its account and requires it to promptly report unauthorized access. In practice outcomes vary. The Register reported in March 2026 that a three-person company normally spending about $180 a month was billed $82,314 in 48 hours after its Gemini key was stolen, and that a Google representative cited the shared responsibility model. In May 2026 Google reversed bills of about $10,000 and AUD 17,000 for two developers after The Register reported on them. If it happens to you, delete or restrict the key, disable the API it was used on, write down a timeline, and report it to the provider in writing straight away. Use the provider's billing dispute process and keep to its deadlines. To stop a repeat, restrict every key to the APIs and apps that need it, keep public keys and AI keys in separate projects, and set your own spending caps: the provider's defaults can rise on their own.

## Checklist
1. Revoke first: delete or rotate the stolen key, and if the abuse is on one API (for example Gemini, listed in Google Cloud as the Generative Language API), disable that API on the project until you've found how the key leaked.
2. Write down a timeline while it's fresh: when you got the first alert, when you noticed, when you revoked the key, the usage spike by model and hour, and what your normal monthly spend is. Screenshots of the usage dashboard help.
3. Report it to the provider in writing quickly, through a billing support case as well as any security contact. Both Google Cloud's and OpenAI's terms require prompt notice of unauthorized use.
4. Dispute the charges through the provider's billing process and note its deadlines. Google Cloud's terms say payment disputes must be submitted in good faith before the payment due date; OpenAI's agreement asks invoiced customers to dispute within 30 days of the invoice date.
5. Think before filing a card chargeback. Developers quoted by The Register worried it would get their whole project suspended, including services their app depends on. Ask the provider about that risk first.
6. Restrict every key: limit it to the specific APIs it needs and to your app (HTTP referrer, IP address, or Android/iOS app). On Google Cloud, check every project for keys marked Unrestricted.
7. Keep keys that must be public (for example a Maps key in a web page) in a separate project from anything with AI APIs enabled. Truffle Security found that turning on the Gemini API in a project made existing unrestricted keys in that project work for Gemini too.
8. Set your own spending caps instead of relying on the defaults: a project spend cap in Google AI Studio, and organization or project spend limits on OpenAI and Anthropic. Consider prepaid credit where it's offered, so your exposure is roughly your balance.
9. Keep AI keys server-side only. Never put them in front-end code, mobile apps or public repositories, and scan your code and CI logs for keys (for example with TruffleHog or GitHub secret scanning).

## Do Google Cloud and OpenAI terms make you pay for usage from a stolen API key?
- Google Cloud's Terms of Service (section 1.3(a)) say the customer is responsible for the security of its passwords for the account, including any keys for Google APIs, and for any use of its account. Section 3.1 requires commercially reasonable efforts to prevent unauthorized use and prompt notice to Google of any unauthorized use the customer becomes aware of.
- OpenAI's Services Agreement for API and business customers (section 3.2) says the customer is responsible for all activities that occur under its account, and section 3.1 says it will promptly notify OpenAI of unauthorized access. Usage-based fees are charged on usage as OpenAI calculates it, and fees are non-refundable except as required by law or permitted by the agreement.
- None of that stops a provider from writing off fraudulent charges, and Google told The Register it would work with affected users to resolve charges resulting from fraudulent activity. But the starting position in both contracts is that usage under your key is your bill. Whether you have stronger rights depends on the contract, the country, and how you paid. This page isn't legal advice.

## What happened when stolen Gemini API keys ran up bills in 2026?
- In February 2026 Truffle Security reported that Google API keys (the AIza... format) that Google had long said were safe to embed in web pages, for Maps or Firebase, could also call Gemini once the Generative Language API was enabled in the same project, with no warning to the owner. Scanning the November 2025 Common Crawl, it found 2,863 live keys exposed this way, and new keys defaulted to Unrestricted. Google reclassified the report as a bug and began blocking leaked keys from Gemini.
- The Register reported the $82,314 case on March 3, 2026, and on May 13 described developers billed thousands of dollars in minutes, mostly for Veo 3 video and Gemini image generation they'd never used. One had a $250 cap that he believed was his own. It was the Tier 1 billing-account cap, which Google raises automatically as an account qualifies for higher tiers. Google told The Register it now requires API restrictions when keys are created, and that a key can no longer access both Gemini and Maps.
- On May 15, 2026 The Register reported that Google had reimbursed both developers it had quoted. A separate developer posted on Google's AI developer forum that billing support declined to adjust about $27,000 of charges from a compromised key, saying the calls were valid because they had been processed.

## Do Gemini API spend caps stop a stolen key from running up charges?
- Google's Gemini API documentation separates the two. Billing-account tier spend caps ($250 at Tier 1, $2,000 at Tier 2, $20,000 to $100,000 at Tier 3) are system-defined and rise as you move up tiers: Tier 2 needs $100 paid and 3 days since the first payment, Tier 3 needs $1,000 and 30 days, and upgrades are automatic. Project spend caps are the ones you set yourself in AI Studio, and they stay until you change them.
- Neither is instant. Google calls project spend caps experimental, says billing data can lag about 10 minutes and you're subject to overages during that time, and notes that batch jobs and agent sessions can run past the cap. It also applies spend-based rate limits over a rolling 10-minute window ($10 at Tier 1, $200 at Tiers 2 and 3) where your billing history makes them apply.
- Set your own cap low enough that losing it all wouldn't hurt, keep alerts on, and treat any provider cap as a backstop. The same applies to OpenAI and Anthropic spend limits, which work per organization, project or workspace; OpenAI says its enforcement isn't instantaneous.

## Ask Rightshold (free, no key)
Add the MCP server https://www.rightshold.com/mcp to Claude, Cursor, ChatGPT, Grok or VS Code (one-click setup: https://www.rightshold.com/start?ref=seo), then ask: "Put a spending policy on my research agent's credential: at most $0.50 per paid API call and $20 a day, only at api.example-data.com, so its paid calls get checked before they run."

```json
{
  "tool": "set_spend_policy",
  "arguments": {
    "credential_id": "YOUR_AGENT_CREDENTIAL_ID",
    "currency": "USD",
    "per_tx_max_minor": 50,
    "daily_max_minor": 2000,
    "allowed_domains": [
      "api.example-data.com"
    ]
  }
}
```
- Needs your owner account key. authorize_spend then checks each proposed paid call against the policy and the day's running total and returns a signed allow or deny that's recorded on Rightshold's ledger.
- This limits what your own agent decides to spend when it asks first. It can't stop anyone using a stolen provider API key directly, because that traffic never touches Rightshold. For that you need key restrictions, revocation and the provider's own spend caps.

_Rightshold checks the paid actions an agent proposes against the policy you set and records signed decisions. It doesn't hold or scan your provider API keys, see your provider bills, detect stolen keys, or dispute charges for you, and it never holds or moves money. Provider terms and caps are as published in November 2026 and may change. Not legal or financial advice._

## Sources
- [Google Cloud Terms of Service (sections 1.3 Accounts, 2.3 Payment Disputes, 3.1 Compliance)](https://cloud.google.com/terms)
- [OpenAI Services Agreement (sections 1.5, 3.1, 3.2, 6.1, 6.4)](https://openai.com/policies/services-agreement/)
- [Truffle Security: Google API Keys Weren't Secrets. But then Gemini Changed the Rules. (February 25, 2026)](https://trufflesecurity.com/blog/google-api-keys-werent-secrets-but-then-gemini-changed-the-rules)
- [The Register: Dev stunned by $82K Gemini API key bill after theft (March 3, 2026)](https://www.theregister.com/security/2026/03/03/dev-stunned-by-82k-gemini-api-key-bill-after-theft/4925029)
- [The Register: Google users fight for refunds as unauthorized API usage bills soar (May 13, 2026)](https://www.theregister.com/ai-ml/2026/05/13/google-users-fight-for-refunds-as-unauthorized-api-usage-bills-soar/5239160)
- [The Register: Google reimburses Register sources who were victims of API fraud (May 15, 2026)](https://www.theregister.com/devops/2026/05/15/google-reimburses-register-sources-who-were-victims-of-api-fraud/5241429)
- [Google AI Developers Forum: $27K charged after a compromised Gemini API key](https://discuss.ai.google.dev/t/google-cloud-charged-us-27k-after-a-compromised-gemini-api-key-billing-support-denied-any-adjustment-how-can-we-escalate-this/184142)
- [Google blog: Giving you more transparency and control over your Gemini API costs (March 16, 2026)](https://blog.google/innovation-and-ai/technology/developers-tools/more-control-over-gemini-api-costs/)
- [Gemini API docs: Billing (project spend caps, billing account tier spend caps, Prepay)](https://ai.google.dev/gemini-api/docs/billing)
- [Gemini API docs: Rate limits (usage tiers, spend-based rate limits)](https://ai.google.dev/gemini-api/docs/rate-limits)

## Related
- [Stopping one user of your AI app from running up your LLM bill](https://www.rightshold.com/answers/how-to-stop-one-user-of-your-ai-app-from-running-up-your-llm-bill)
- [Seeing how much each AI agent spends on LLM API calls](https://www.rightshold.com/answers/how-to-see-how-much-each-ai-agent-spends-on-llm-api-calls)
- [Giving each AI agent its own budget for paid APIs](https://www.rightshold.com/answers/how-to-set-a-separate-budget-for-each-ai-agent-calling-paid-apis)
- [Can you dispute a purchase your AI agent made with your card?](https://www.rightshold.com/answers/can-you-dispute-a-purchase-your-ai-agent-made-with-your-card)

_Not legal advice. Updated 2026-11-10. JSON: https://www.rightshold.com/answers/who-is-responsible-for-the-bill-when-a-stolen-ai-api-key-runs-up-charges.json_