Rightshold™ Sign up

Answers · agent payments

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?

Last updated

TL;DR: 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.

What should I check, step by step?

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.

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.

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.

How do I ask Rightshold about this (free, no key)?

Add the MCP server https://www.rightshold.com/mcp to Claude, Cursor, ChatGPT, Grok or VS Code, 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.”

One-click setup

{
  "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"
    ]
  }
}

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.

What are the sources?

Related

Not legal advice. JSON · Markdown · All answers

Get a free API key in one call

No card and no email needed. 100 free credits; the license and policy checks stay free without a key.

curl -s -X POST https://www.rightshold.com/v1/accounts/signup -H "Content-Type: application/json" -d '{"accept_terms":true}'
export RIGHTSHOLD_API_KEY=rs_...   # the api_key from the reply (shown once)
curl -s https://www.rightshold.com/v1/licenses/check -H "Authorization: Bearer $RIGHTSHOLD_API_KEY" \
  -H "Content-Type: application/json" -d '{"license":"MIT","intended_use":{"commercial_use":true}}'