Skip to content
Billfuse

Leaked AI API key: what to do first

Last updated

If an API key for an AI provider has leaked, or your bill shows charges you didn't make, turn the key off first. Then save the usage records and report it to the provider. This page has the steps for Gemini, OpenAI, Anthropic and OpenRouter, and what each provider's own pages say about the charges.

Each provider's part of this page was checked against that provider's own pages on November 13, 2026, and the GitHub parts against GitHub's docs. One third-party report and our own suggestions are marked as such. The sources are linked under the sections they back up. None of those pages promises a refund, and nothing here is legal advice.

The short version

Do these three things in the first ten minutes, in this order.

  1. Turn the key off at the provider. The steps for each provider are below: Gemini, OpenAI, Anthropic, OpenRouter. They delete the key at Google, OpenAI and Anthropic, and disable it at OpenRouter. Each section also says what that provider's pages say about disabling versus deleting. The pages: Google Cloud Credentials, OpenAI API keys, Claude Console API keys, OpenRouter Security settings.
  2. Save what the key did. Export the usage for the days in question. Write down the key's name and the times.
  3. Report it to the provider, with those details. Then create a new key, set a spending limit, and put the new key in your app.

Source: GitHub, Removing sensitive data from a repository. The providers' pages are linked under each section below.

Gemini (Google)

Turn the key off

Google's Gemini checklist is: create a new key (in AI Studio or the Cloud console), update your app, then disable or delete the leaked key in the Cloud console. The checklist doesn't give the clicks. Google's Gemini docs give click-by-click steps for deleting a key on another page, written for a key you no longer need. Steps 3 to 5 below are those steps:

  1. Create a new key on the AI Studio API keys page.
  2. Update your app to use the new key.
  3. In the Cloud console, open the Credentials page.
  4. Find the leaked key and click the Actions icon.
  5. Select Delete API key. In the Delete credential dialog, select Delete.

See what it spent

What Google's pages say about the charges

Sources: Google AI Studio, Using Gemini API keys, Troubleshooting guide, Gemini Developer API vs. Gemini platform, Troubleshoot Google AI Studio, Logs and datasets, Billing; Google Cloud, Respond to compromised Google Cloud credentials, Manage API keys, Creating and managing API keys, Resolve Cloud Billing issues, Get Cloud Billing support

OpenAI

Turn the key off

  1. Open the API keys page.
  2. Click the trash can icon next to the leaked key.

See what it spent

What OpenAI's pages say about the charges

Sources: OpenAI, Keeping your OpenAI account secure, Where do I find my OpenAI API Key?, Reviewing API usage and costs, Production best practices, Setting up and managing prepaid API billing, How can I report fraud or suspicious activity?

Anthropic (Claude)

Turn the key off

  1. In the Claude Console, open the API keys page.
  2. Click the menu (the three dots) next to the leaked key.
  3. Select Delete API key.

See what it spent

What Anthropic's pages say about the charges

Sources: Anthropic, What should I do if I suspect my API key has been compromised?, API key best practices, Authentication, Cost and usage reporting in the Claude Console, How to get support, How do I pay for my Claude API usage?, Commercial Terms of Service

OpenRouter

Turn the key off

OpenRouter's Authentication page says to delete the compromised key and create a new one. We put Disable first, for two reasons. Another OpenRouter page says: “Disabling is reversible; deleting is not.” And Railway, a hosting company, wrote in a guide dated October 22, 2026 that when you delete a key, “the key's usage fields disappear with it”. It told its users to disable the key and to export the usage “before you delete anything”. That is Railway's report, not OpenRouter's documentation.

  1. Open Settings → Security and select the Key safety tab.
  2. On the leaked key's row, click Disable.
  3. Open Settings → API Keys and create a new key.

See what it spent

What OpenRouter's pages say about the charges

Sources: OpenRouter, Authentication, Security settings, API Key Audit, Management API Keys, Activity, FAQ, Terms of Service; Railway, Check for Unexpected OpenRouter Usage (October 22, 2026)

Limit the damage before it happens

These are measures the providers document themselves. None of them keeps a key from leaking. They limit what a leaked key can do.

Sources: GitHub, Supported secret scanning patterns, Secret scanning partner program; OpenAI, Best practices for API key safety, IP allowlisting for OpenAI API; Anthropic, IP allowlisting; Google Cloud, Best practices for managing API keys. The other pages are linked under the provider sections above.

Where Billfuse fits

If a key of yours is being used right now, do the steps above first: turning the key off at the provider is what stops it. Billfuse is the tool we built to notice unusual spend sooner next time. It doesn't replace the providers' limits. Keep them on.

More guides

It's free while Billfuse is in early access. You can try it with sample data first, no sign-up needed.