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:
- List every place your keys live
- Delete keys you don't use. If you suspect a leak, rotate first, then review usage
- 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:
.envin your home folder- Shell config files (
.zshrc,.bashrc,.profile…) withexport ...=sk-... - Your PowerShell profile on Windows
.netrc,.npmrc- Tool settings screens and cloud dashboards (where this incident happened)
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”.
· 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).
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:
- Issue a new key and swap it in where it's used
- Then revoke the old key
- 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:
te key rotateissues a new key, swaps it in, then revokes the old one, in that order, in one command. Key values are never displayed.- The server refuses to revoke the key making the request; the old key is revoked using the new one.
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.
- Split keys by purpose. Production, your own work, experiments. You'll know where a leak came from, and you only stop one key.
- Cap each key. A rule of thumb: 1.5–2× normal usage. If you don't know normal usage, look at one week of history first.
- Add short-window caps. A monthly cap alone can be drained overnight. Hourly and daily caps stop unusual usage sooner.
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
- List where keys live — Mamori Guard
scancovers the common home-folder spots in one command; list dashboard-stored keys by hand. - Delete unused keys — if in doubt: swap → revoke → review.
- 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.
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.