← Blog
2026-10-25 · 6 min read · Yuki Hamada · 日本語

AI API Keys Are Leaking:
Three Checks to Do Today

The short version

A leaked AI API key turns directly into charges on your account. Unlike a password, you won't get a login alert. Three things you can do today:

  1. List every place your keys live
  2. Delete keys you don't use. If you suspect a leak, rotate first, then review usage
  3. Set a spending cap per key, per purpose

Each takes about 30 minutes. Here's how.

Why now

On October 17, 2026, the cloud dashboard of a developer tool was attacked, and it was reported that stored third-party AI API keys of about 1.4% of its users may have been exposed[1]. Some individuals have reported unauthorized charges (in the hundreds of dollars; these are individual reports, not confirmed figures).

Around the same time, announcements of always-on personal AI agents, and of tools to watch over what agents do, keep coming. AI is shifting from a tool you call to a colleague that is always running. Always-on agents need always-valid keys, and the number of keys, and the places they sit, quietly grows.

We can't stop attackers. We can keep the damage small when a key leaks. That is what these three checks are for.

Check 1: List every place your keys live

Start by knowing which provider's keys sit where. Common places:

A key in your shell config is handed to every program you start from the terminal as an environment variable, including programs that never needed it.

One command with Mamori Guard

Today we added this check to Mamori Guard, our free security checker. It only reads the files above, and if it finds Anthropic, OpenAI, Google, OpenRouter, xAI, Groq or Hugging Face keys, it shows only the file location and the provider name.

macOS / Linux (scan only)

curl -fsSL https://mamori.teai.io/kit.tar.gz | tar xz
python3 mamori/agent/mamori_guard.py scan

Windows (PowerShell, scan only)

iwr https://mamori.teai.io/kit.tar.gz -OutFile $env:TEMP\mamori.tgz; tar xzf $env:TEMP\mamori.tgz -C $env:TEMP; & $env:TEMP\mamori\tools\guard.ps1 -ScanOnly

Look for the line about plaintext AI API keys (the output is in Japanese: 「AI の API キーの平文置き場」). If keys are found, it reads like “2 files contain Anthropic/OpenAI keys: /Users/you/.env, /Users/you/.zshrc”.

What we promise
· Key values are never shown and never recorded.
· Files are never changed automatically. You fix things by hand.
· Works on Windows, macOS and Linux.
· All code is open (GitHub).
What it does not look at
It only checks a fixed set of files directly in your home folder. Per-project .env files, and keys saved in tool settings or cloud dashboards, are out of scope. “Nothing found” does not mean “nowhere”. List keys you pasted into dashboards separately.

Check 2: Delete unused keys. If in doubt, rotate first

Open each provider's key list and delete keys you no longer use. “Just in case” keys are the ones whose locations get forgotten.

If you suspect a leak, order matters:

  1. Issue a new key and swap it in where it's used
  2. Then revoke the old key
  3. Finally, review usage for anything you don't recognize

While you read the logs, a leaked key keeps working, so revoke before you investigate. But revoke before swapping, and your own services and agents stop too.

We learned this ourselves in September: an AI agent correctly revoked a key that had been printed on screen, but it was the very key it was running on, and all work stopped. Since then, teai works like this:

The same idea applies to any provider: swap, then revoke, then review.

Check 3: Cap each key, per purpose

You can't make the time-to-notice zero. So cap how much can be spent before you notice.

On teai, the API keys section of the dashboard lets you name keys by purpose and set caps per minute, hour, day and month for each. A key that hits its cap stops there. Most providers also offer spending limits or alerts — check them, one key at a time.

Recap

  1. List where keys live — Mamori Guard scan covers the common home-folder spots in one command; list dashboard-stored keys by hand.
  2. Delete unused keys — if in doubt: swap → revoke → review.
  3. Cap each key — split by purpose, add short-window caps.

Always-on AI is convenient and fun. To hand work over with peace of mind, start today by counting your keys.

See Mamori Guard (free, open source)

teai key caps live in the dashboard.

[1] eSecurity Planet news report https://www.esecurityplanet.com/artificial-intelligence/news-opencode-breach-ai-api-keys/ (accessed 2026-10-25). Charge amounts are individual reports, not confirmed figures.