API Key Leaked? How to Rotate OpenAI, Claude, Gemini and Stripe Keys

Leaked API key? Revoke it, rotate and redeploy, then check usage and billing. Step-by-step for OpenAI, Anthropic, Gemini, Supabase and Stripe keys.

The RoamerHost Team 14 min read
Ready to start? Vibe Coding Hosting, set up in 60 seconds Put your vibe-coded web app online. From avg. NT$299/mo (billed yearly). Subscribe to Vibe Coding Hosting
On this page

When an API key leaks, the first thing to do is revoke or disable the old key in the provider's dashboard, then create a new one, put it in your app and redeploy. After that, check usage and billing, and finally work out how the key got out. Creating a new key without revoking the old one usually leaves the old key working, and that is the most common mistake. Move fast: once someone starts making calls with an AI provider's key, charges keep adding up until you shut it off.

This guide starts with this year's Zeabur security incidents, then covers how to tell whether a key has been abused, where to revoke and rotate keys for OpenAI, Anthropic, Google Gemini, Supabase and Stripe, how to set billing alerts, and how to store keys from now on. If you are moving your app somewhere new, we also explain how RoamerHost Vibe Coding Hosting stores environment variables.

The Zeabur timeline is based on Zeabur's official incident reports and iThome's coverage; key rotation steps come from each provider's official docs and help center, checked on November 23, 2026. Dashboards change often, so the official pages take precedence.

The Zeabur incidents: keys in environment variables, read in bulk

According to Zeabur's report on its August incident, on August 27 an attacker got into a shared cluster through a vulnerability in a public service a user had deployed, escalated to platform-level access, and read the names and values of environment variables in some projects, including AI and other third-party API keys and database passwords. Zeabur confirmed the incident the next day, after receiving a report that API keys had been abused.

A second incident followed in mid-October. According to iThome's summary of the preliminary findings, the attacker read more than 3.21 million environment variables and 320,000 account records from the platform database in 37 minutes; Zeabur's own report lists 3,218,965 environment variables. Its advice to all users: replace every credential stored in environment variables, including API keys, cloud keys, database passwords, signing keys and encryption keys, by revoking the old ones with each provider before creating new ones and redeploying, even if you already rotated them after August, and check usage and billing for every service from October 14 onward.

It is a reminder for anyone running code in the cloud: environment variables only keep secrets out of your source code. They do not make secrets leak-proof. A platform, your laptop, GitHub or an AI chat history can each be where a key escapes. So beyond storing keys carefully, you need to know how to clean up when one leaks.

How to tell if a leaked API key has been used

The best clues are on the provider's usage pages. Most AI providers let you break usage down by key, and you are looking for patterns that do not match your app: a model you never use suddenly showing usage, bursts of requests at night or on weekends, or a usage curve that jumps on a particular day. Anthropic's help center recommends regularly reviewing the Logs and Usage pages in the Console; OpenAI's key safety guide suggests confirming on the Usage page that activity matches your team's work; Google's Gemini API docs point to billing logs and API usage in the Cloud console. In Stripe, open the menu next to a key on the API keys page to view that key's request logs.

The other clue is a notice from the provider. According to Anthropic's help center, when GitHub finds a Claude API key in a public repository it notifies Anthropic, which automatically deactivates the key and emails you. Google's Gemini docs also describe leaked-key enforcement that quickly stops keys its systems detect. Treat these emails as urgent: a deactivated key means your app will fail too, so rotate and redeploy right away.

No unusual usage does not mean no leak. If a key has ever appeared somewhere it should not, such as a public GitHub repository, frontend code, a screenshot or a platform that had a breach, treat it as leaked. Rotating a key costs far less than chasing a bill afterwards.

How to revoke and rotate keys, provider by provider

The principle is the same everywhere: create a new key, put it in your app, confirm it works, then revoke the old one. If the old key is being actively abused, revoke it first and accept a short outage. Here is where each provider's docs say to go, and what to watch for.

ProviderWhere to revoke and rotateWatch out for
OpenAIAPI keys page on platform.openai.comSet project budgets with hard enforcement; spend alerts alone do not stop requests
AnthropicAPI keys page in the Claude Console, "⋯" next to the key, Delete API keyCheck the Logs and Usage pages; keys found by GitHub scanning are deactivated automatically with an email notice
Google GeminiAPI keys page in Google AI Studio, or the Credentials page in Cloud consoleDisable the old key once the new one is live; you can restrict a key to the Gemini API only
SupabaseProject Settings, API KeysDeleting a secret key cannot be undone; for a leaked legacy service_role key, deactivate the legacy keys
StripeAPI keys page in the Dashboard, "⋯" next to the key, Rotate keyChoose Now as the expiration to delete the old key immediately; other choices keep it working for up to 7 days

How to rotate an OpenAI API key

OpenAI's key safety guide says to rotate a compromised key immediately from the API keys page and update every production app that uses it. It also recommends a separate key for each team member, never deploying keys in browsers or mobile apps, and routing calls through your own backend. Set monthly spend limits for your organization or projects and turn on hard enforcement, because spend alerts alone do not stop API traffic. If you see suspicious usage, you can contact OpenAI through its help center.

Anthropic (Claude API)

Anthropic's help center says to revoke a suspected key immediately: sign in to the Claude Console, open the API keys page, click the three dots next to the key and choose Delete API key. Then click Create key and store the new one somewhere secure, such as a secrets manager, not in version control. The help center also recommends rotating keys on a regular schedule, for example every 90 days, and reviewing the Logs and Usage pages. Organizations with custom rate limits can set spend limits on the Billing page; standard organizations should set their auto-reload threshold carefully, since auto-reload keeps charging your card if a leaked key drives up usage.

Google Gemini

According to the Gemini API docs, the order is: generate a new key in Google AI Studio or Cloud console, redeploy your app with it, disable the leaked key once the new one is confirmed working, then check billing logs and API usage in Cloud console. The docs specifically say not to delete the old key until the new one is fully active. While you are at it, restrict the key to the Gemini API only in AI Studio, limit which sites or IP addresses can use it in Cloud console, and set billing alerts in Cloud console so you hear about usage or cost spikes.

Supabase

Supabase's publishable key (formerly the anon key) is meant to be public in your frontend. The one that matters is the secret key (formerly service_role), which bypasses every Row Level Security policy. Supabase's guide to rotating leaked keys says to fix the cause first, create a new secret key under Settings, API Keys, replace it everywhere, then delete the old one, which cannot be undone. If the leaked key is a legacy service_role key, deactivate the legacy keys on the same page, move your frontend to a publishable key, and revoke the legacy JWT secret as the docs describe. The docs also warn against re-enabling legacy keys to rescue a client you missed, since that restores the compromised key.

Stripe

According to Stripe's docs, choosing Rotate key from the menu next to a key on the API keys page revokes it and generates a replacement that works immediately. Mind the expiration setting: Now deletes the old key straight away, while any other choice keeps both keys working for up to 7 days, a buffer meant for routine rotation rather than a leak. Stripe also recommends restricted keys for most uses and access policies on live keys so they only work from your servers. Webhook signing secrets are separate from API keys; if one was exposed too, handle it separately on the Webhooks page.

Database passwords and other secrets

Change database passwords inside the database itself. Zeabur's report points out that changing an environment variable on the platform does not change the password inside the database. Rotating JWT signing secrets or session encryption keys may log out signed-in users, which is expected: it means the old sessions no longer work. GitHub personal access tokens and cloud access keys follow the same principle: revoke and recreate them in each dashboard.

Set billing alerts and spend limits now

However carefully you store keys, assume one will leak someday; a spend limit is your last line of defense. Per each provider's docs: OpenAI lets you set enforced monthly limits for organizations or projects; Anthropic organizations with custom rate limits can set spend limits and workspace rate limits on the Billing page; Google lets you set billing alerts in Cloud console, which notify rather than stop usage. Set limits at two or three times normal usage: too low and normal peaks get blocked, too high and the limit stops protecting you.

If a stolen key has already run up charges, revoke it first, then gather timestamps and usage records and contact the provider. Zeabur's follow-up on the October incident notes that most cloud and API providers have a dispute or waiver process when leaked credentials are abused, and that Zeabur's public incident report can be attached as supporting evidence. Whether and how much is waived is up to each provider.

How to store keys from now on

Keep keys out of your code and in environment variables or your platform's secret settings. Add .env to .gitignore and never push it to GitHub. If it was ever pushed, deleting the file is not enough, because it stays in Git history; rotate the key. Variables that reach the browser usually start with VITE_, NEXT_PUBLIC_ or REACT_APP_. They are bundled into the page where anyone can read them, so paid API keys must never use those prefixes; if your web page needs to call an AI service, route the call through your backend.

A few more habits help: use different keys for production and testing so a leak only means replacing one; restrict permissions where you can, such as Stripe restricted keys or Gemini's API restriction; never paste keys into group chats, email, support tickets or AI conversations (Zeabur also asks users to share only masked details when contacting support); and rotate on a fixed schedule.

How Vibe Coding Hosting stores environment variables

On Vibe Coding Hosting, keys are set as project environment variables, either on the project page or by your AI with set_env. They are stored encrypted and never shown again once saved. When your AI manages the project over MCP, the environment variable tools return names only, never values, so the AI can confirm a variable is set without being able to read the key. A .env file you upload or pull in from GitHub is not deployed; only public variables such as VITE_ and NEXT_PUBLIC_ are passed into the build, which means a paid key given one of those names will still end up in your page. After rotating a key, redeploy so your app picks up the new value.

On the platform side, each project runs in its own isolated environment, projects cannot reach each other or the platform core, MCP has no remote command execution tool, and tokens expire after 90 days and can be revoked at any time. What the platform protects is storage: if your own code prints a key to the logs or sends it to the frontend, the platform cannot stop that, so have your AI review the code before launch. For the full move from Zeabur, see moving Next.js, Node.js and Python apps off Zeabur; for deploying with Claude Code or Codex over MCP, see where to host a Claude Code app.

Which option fits

If your app was on Zeabur or another platform and, with your keys rotated, you are looking for a new home with encrypted environment variables, .env files that never get deployed, yearly billing in Taiwan dollars and support in Chinese, choose Vibe Coding Hosting Basic, from NT$299/mo (NT$3,588 billed yearly), deploying with your own AI over MCP and turning on a database when you need one. If you are not comfortable changing code and want an AI on the platform to edit the app and add features, choose Vibe Coding Hosting Pro, averaging NT$999/mo billed yearly, which adds Roamer AI; Roamer AI does its best with imported code but cannot guarantee results. Compare both on Vibe Coding Hosting plans and pricing; every new purchase can be refunded in full within 30 days of payment. Each plan hosts one site, so if you need Dockerfiles, multiple services or always-on background workers, look for a service that supports them.

FAQ

Q: My API key leaked. Is creating a new one enough?

No. Creating a new key usually does not invalidate the old one; you have to revoke or delete it separately. Supabase's docs state that creating new publishable and secret keys does not revoke the legacy keys, and both work until you disable them. In Stripe, if you pick a later expiration when rotating, the old key keeps working for up to 7 days.

Q: How do I rotate an OpenAI API key?

Create a new key on the API keys page at platform.openai.com, put it in your app and redeploy, then revoke the old one; if you suspect active abuse, revoke first. Afterwards, check the Usage page for activity you do not recognize, and set an enforced spend limit on the project.

Q: Can I get charges from a stolen key refunded?

It depends on the provider. Revoke the key first, then contact the provider with timestamps and records of the unusual usage. Zeabur's follow-up notes that most cloud and API providers have a dispute or waiver process, and Zeabur users can attach its official incident report, but each provider decides.

Q: Are keys safe once they are in environment variables?

Safer than in your code, but not bulletproof: environment variables are exactly what leaked in the Zeabur incidents. Also remember that public prefixes like VITE_ and NEXT_PUBLIC_ are bundled into the page, keep .env out of GitHub, and set spend limits on every service so a leak has a ceiling.

Q: My Supabase anon key appears in my web page. Do I need to rotate it?

No. The anon key, now called the publishable key, is designed for the frontend, and Supabase's docs say it is safe to expose; your data is protected by RLS policies on each table. Rotate the secret or service_role key if it has appeared in the frontend, on GitHub or on a platform that was breached, following the official steps.

Sources

Further reading

Ready to get started with Vibe Coding Hosting?

60 seconds after you subscribe, Vibe Coding Hosting is installed for you — an isolated container with hard resource limits you never share, and HTTPS out of the box.

Billed yearly · 30-day money-back guarantee · cancel renewal anytime

Hi, I'm Roamer! Tap me anytime with a question and I'll help you out.

Roamer

Roamer - AI assistant

Online
Roamer

Ask me anything, anytime — I'll do my best to help!

Powered by RoamerHost AI