Skip to navigation

LLM API Key Leaked? What to Do in the First Hour

In short: LLM API key leak response: a 60-minute checklist with console steps, a worst-case bill calculator and git history search commands. Sources read 28 Nov 2026.

Published 27 min read
On this page

An LLM API key is a password that spends money, and when it leaks the first hour decides how much of it gets spent. This post is a minute-by-minute plan for that hour, written by the team that sells one such key, so the console steps are for One AI API Key and the rest applies to any provider. What you get that the usual “rotate and move on” advice leaves out: a timeline with a check at every step, a worst-case bill calculator you can fill with your own rates, a console map that names only buttons that exist, the exact commands to search your git history, and a two-line test that proves the old key is dead.

How common are leaked LLM keys, and why does the hour matter?

Common enough that you should assume yours will leak once. GitGuardian’s State of Secrets Sprawl 2026 counted 28,649,024 new secrets in public GitHub commits in 2025, up 34 percent on the year before, and 1,275,105 exposed credentials for AI services, up 81 percent. The same report says about 28 percent of secret-sprawl incidents happen only outside code repositories, in collaboration and productivity tools. Your key may not be in git at all.

Speed matters because of how slowly the world fixes these. GitGuardian’s 2025 report states that 70 percent of the secrets leaked in 2022 were still valid. A leaked key that nobody revokes keeps working for years. GitHub’s own page on secret leakage risks adds that public repositories with exposed secrets are indexed by search engines and specialized scanning services. You are not racing a person who might notice, you are racing software that already looks.

A key can also grow more powerful after you deploy it. Truffle Security reported on 25 February 2026 that it found nearly 3,000 Google API keys on public websites, deployed years earlier for maps and similar public services, that also authenticate to Gemini. That is a Google story, not ours, but the lesson travels: a key’s blast radius is whatever the provider lets it do today, so you want a per-key model list and a spend limit that do not depend on the provider’s defaults.

What does the first hour look like?

Five blocks of about 12 minutes. The first one is the only one that cannot wait; the rest can slip, but the order should not.

The first hour, in order

0 to 5 min: stop the keyDisable it, test for a 4015 to 15 min: size the damageUsage page, one key, export CSV15 to 30 min: replace itIP list, budget, expiry, model list30 to 45 min: find the leakHistory, CI logs, chats, bundles45 to 60 min: clean and hardenRevoke, scan, add push protection
The order follows OWASP's containment sequence: revoke, rotate, delete the secret from where it was exposed, then keep the logs that show who used it. Both GitHub and OWASP put the revoke step before any history cleanup.
Minutes Do this Where You are done when
0 to 5 Disable the leaked key API keys, the Disable button on its row curl with the old key returns 401
5 to 15 Read what it spent Usage, key filter, last 7 days You can say “N requests, $X, between T1 and T2”
15 to 30 Create and deploy a smaller key Keys, Create key; your secrets store The app answers 200 with the new key
30 to 45 Find where it leaked Git history, CI logs, chats, bundles You know the one place that held it
45 to 60 Revoke the old key, close the hole Keys, Revoke; repo settings A scanner run comes back clean

The rest of this post takes the blocks one at a time.

Minutes 0 to 5: how do you stop the key?

Open the API keys page of the console, find the key by name and press Disable. It stops working at once and returns 401 until someone presses Enable. Disable beats revoke in minute one for a practical reason: the row survives, so its name, status and usage history stay on screen while you investigate. Revoke deletes the key for good, and you will do that in minute 45.

Two exceptions. If you are at your account’s key limit and cannot create a replacement, revoke the leaked key now, because the Keys page tells you plainly that a revoke is how you free a slot. And if you are not sure which key leaked, disable every key that could have been in the exposed place; the console makes enabling one back a single press, and a minute of downtime is cheaper than a guess.

Then test, because a button press is not proof. Keep the old key in an environment variable called OLD_KEY for the length of this check and run:

Prove the old key is dead
# 1. The OLD key must now answer 401. Listing models is free, so nothing is billed.
curl -s -o /dev/null -w "old key: HTTP %{http_code}\n" https://api.oneaiapikey.com/v1/models \
  -H "Authorization: Bearer $OLD_KEY"

# 2. The NEW key must answer 200.
curl -s -o /dev/null -w "new key: HTTP %{http_code}\n" https://api.oneaiapikey.com/v1/models \
  -H "Authorization: Bearer $ONEAIAPIKEY_API_KEY"

You want old key: HTTP 401 and new key: HTTP 200. A disabled key returns 401 with the body Invalid token, as the authentication guide shows, and the gateway gives the same answer for a mistyped, expired or used-up key, so a 401 alone does not say which. That is why you check the key’s status in the console too, in the same minute. This is the same kind of test the post on how to test an LLM gateway for free builds into an 8-test protocol: ask the system a question it can only answer one way.

If the leaked key was for another provider too (many people reuse one key across tools, or paste the same key into several agents), rotate that one at its source in the same five minutes. OpenAI’s key safety guidance says the same: create the replacement, update the apps, revoke the old key once the new one works.

Minutes 5 to 15: how do you size the damage?

Go to the usage page. It has a key filter (“All keys” by default), a model filter and a date range, and it can export the filtered rows as CSV. Pick the leaked key and a range that starts before you think the leak happened. The table shows time, key, model, tokens in and out, cost, latency and request id. It tells you what ran, when and what it cost. It does not show who called, because the table has no address column, so you cannot tell a stranger from your own forgotten cron job by looking at the row. Look at the pattern instead:

  • A new model. If your app only calls one model and the key suddenly shows three, someone else is using it.
  • A new rhythm. Your app runs when your users are awake. A flat line of requests at 03:00 is a script.
  • A new shape. Your traffic has a typical token size. A thousand identical requests at the maximum output length is a harvest job.
  • A start time. The first odd row is the earliest the key could have been exposed. It narrows the search in the next block to commits and messages from that time or before.

The Errors view groups failed requests. After you disable the key, a burst of 401s from the attacker’s script shows up there and tells you the script is still running, which also confirms that the disable worked. Download the CSV and keep it: it is your evidence if you write to support, and it fixes the time of the first odd row in a file you control.

Now put a number on it. The calculator below uses assumptions you can overwrite: a request rate, token sizes, a price per million tokens (take yours from the models page) and how long the key was live before you noticed. It then applies the three ceilings that exist on a prepaid account: your balance, a per-key spend limit and nothing else. It sends nothing anywhere.

Worst-case bill from a leaked key

Cost of one request
$0.0080
Cost per hour
$9.60
Arithmetic exposure, no ceiling
$115.20
What you can actually lose
$50.00
Hours until the balance is gone
5.21

An illustration with rates you choose, not a measurement of any real attack. The request that crosses a limit can finish, so a real total can end slightly above it, as the key form says.

The default numbers give round arithmetic. One request with 4,000 input and 1,000 output tokens at $1.00 and $4.00 per million costs (4,000 x 1 + 1,000 x 4) / 1,000,000 = $0.008. At 20 requests a minute that is $9.60 an hour, and a key leaked at bedtime and noticed 12 hours later has an arithmetic exposure of $115.20. With a $50 balance the account is the ceiling and the most you lose is $50.00. Add a $5 key limit and it is $5.00. The next block is about getting those ceilings in place before the next leak, not after it.

Same 12-hour overnight leak, different ceilings

  • Arithmetic only, no ceiling$115.2020 requests a minute at $0.008 each
  • Balance is the ceiling ($50)$50.00
  • Key spend budget $5 a day$5.00
  • Account spend cap $2 a day$2.00
  • IP allowlist, attacker elsewhere$0.00every request refused with a 403
Figures come from the calculator defaults above. The IP allowlist row holds only when the attacker's address is not on your list: a thief on your own server, or behind the same NAT address, is inside it.

Minutes 15 to 30: what should the replacement key look like?

Create it on the Keys page with Create key, and treat the form as the answer to “what went wrong last time”. Every control below exists in the console today; the account security guide and the cost-control guide describe each in full.

Control What it does What it does to a leaked copy
Allowed IP addresses Only requests from the listed addresses or CIDR ranges are accepted Anyone else gets a 403 “Your IP address is not on this key’s allowed list”
Spend limit (USD) The key stops after it has spent this much Once used up, the key returns 401 Invalid token
Spend budget, with a period A budget per day (00:00 UTC), week (Monday) or month; over it, requests get 429 Caps the loss per period instead of in total
Warn at (% of budget) Marks the key and sends spend alerts when it passes the share Tells you at 50 percent instead of at 100
Block the key at its budget Keeps the key blocked after the reset until you save its limits again A thief does not get a fresh budget every midnight
Requests per minute Over the limit, requests with this key get 429 Slows a harvest script to a crawl
Expiry date The key stops at the end of that day A forgotten copy dies on a date you chose
Models The key can call only the models you pick A leaked key cannot reach the expensive model your app never uses

Two of these deserve a sentence of opinion. The IP allowlist is the one setting that makes a leak almost harmless, and it is the one people skip because their home or laptop address changes. Use it for server keys, where the outgoing address is fixed, and use a short expiry plus a small budget for keys that live on a laptop. Second, tick Block the key at its budget: without it, a daily budget is a speed bump that refills at midnight UTC (05:30 IST).

The key limit has a catch the authentication guide documents: the gateway estimates a request’s cost from its prompt before it runs and refuses it when the key’s remaining limit is lower, with a 403 pre_consume_token_quota_failed. A key that runs long agent sessions needs headroom, or the cap will look like an outage. That is the tradeoff: a tight cap is safer and breaks first. The post on a runaway agent token bill works through six caps and the cost of a loop, and its numbers apply to a thief just as well as to your own bug.

One layer sits above all the keys. Under Settings the account has a Spend cap per day, week or month (UTC) that counts every metered request from any key, the Playground and the browser chat. When it is reached, paid models are refused with 429 and the code account_spend_cap, and free models still answer; a cap of $0 switches paid models off without touching a key. During an active incident that is a useful emergency brake while you work: set it to $0, deal with the leak, then raise it again. Pair it with a low-balance alert by email or webhook, so a quiet drain does not wait for you to open the page.

Deploy the new key the way you should have deployed the old one, through the environment and not through a file in the repository. The OpenAI-compatible base URL and the variable name stay the same for every client, which is also why a swap is a one-line change in tools like OpenCode and the other agents in the coding-agent key guide.

Deploy and smoke-test the new key
# Put the new key in the environment, never in the file.
export ONEAIAPIKEY_API_KEY="paste-the-new-key-here"

# Prove the app can use it with one cheap call on a free id (counts against the daily free allowance, costs $0).
curl https://api.oneaiapikey.com/v1/chat/completions \
  -H "Authorization: Bearer $ONEAIAPIKEY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "[object Object]", "max_tokens": 5, "messages": [{"role": "user", "content": "ping"}]}'

Keep the smoke test on a free id. A free-lane call costs $0 and tells you the key, the limit settings and the base URL all work. If it returns 401, the key was pasted wrongly; if it returns 403, read the message, because it names the limit or the missing model.

Minutes 30 to 45: how do you find where the key leaked?

You are looking for one place that held the key in plain text. It is usually one of the rows below. The right-hand column is what to check first.

Where it leaked How it happens Check first
Public git repo A .env file or a code constant committed once History search, then the host’s secret alerts
Private repo or fork Cloned to a laptop, forked, mirrored The same search, plus every fork and CI cache
CI logs A build step prints the environment, or a debug flag The last 30 days of build logs for the variable name
Chat, ticket, paste A teammate pasted the key to ask for help Search your chat tool for the sk- prefix
Screenshot or screen share The key visible in a terminal or settings page Recordings and shared images from that week
Browser or mobile bundle The key in client-side code View source and the built JavaScript for the prefix
Installer or agent script Setup code that reads the environment The review in the installer checks post
A signed-in console session Anyone with your console session can open the Keys page Settings, signed-in devices

That last row is specific to us and worth a minute. The Keys page has a Show button that displays a key’s full secret again, so the key is only as safe as the Google account that signs in to the console. Sign-in here is Google only, so your Google account’s own security is the control that matters, and the Settings page lists the browsers signed in to your account, so you can end any session you do not recognise. The Security page keeps an account activity log of key changes, limit changes and sign-ins, newest first, with a CSV download of up to 365 days. If the log shows a key you did not create, or a sign-in at an hour you were asleep, you have an account problem, not a repository problem, and you should stop reading this section and go through the signed-in devices first.

How do you search git history for a key?

Start with git itself, which has two pickaxe options. -S finds commits where the number of occurrences of a string changed, and -G finds commits whose added or removed lines match a regular expression, as the git log documentation describes. Both walk history, so they find the key in a commit that a later commit deleted.

Search git history without printing the key
# Run from the repository root (Git Bash, macOS or Linux). Adjust the {20,} length if you know your key's exact size.
# Do not paste the output anywhere: a match line can contain the key itself.

# 1. Every commit on every branch whose diff added or removed a string shaped like a key (commit list only)
git log --all -G 'sk-[A-Za-z0-9_-]{20,}' --format='%h %an %ad %s' --date=short

# 2. Every commit that touched the environment variable name (finds .env files and CI configs)
git log --all -S'ONEAIAPIKEY_API_KEY' --format='%h %an %ad %s' --date=short

# 3. Files on disk right now, including ones your .gitignore hides
grep -rIl --exclude-dir=.git -E 'sk-[A-Za-z0-9_-]{20,}|ONEAIAPIKEY_API_KEY=' .

# Then inspect ONE commit, in a private terminal: git show <hash> -- <path>

The commands list commits, not patches, on purpose. A terminal that prints the key is a place the key can leak again, in a screen share or a copied scrollback. Look at one commit in a private window, note the commit hash and file path, and move on.

Then run a scanner, because a regular expression only finds shapes you thought of. Gitleaks scans git repositories and directories for secrets; its git command scans a repository and -v prints each finding. TruffleHog classifies over 800 secret types and can log in to confirm whether a finding is live for the types it has a detector for. Two cautions from their own documentation: TruffleHog clones a local repository to a temporary directory before scanning, to guard against malicious git configs, and a verification step only exists for types with a detector, so “unverified” does not mean “dead”. A generic sk- key may not have one, which is why the second block below adds a custom Gitleaks rule on top of the defaults.

Run both scanners
# Gitleaks: scans the whole history of the repo you are standing in
gitleaks git -v -c .gitleaks.toml

# TruffleHog: same idea, and it can try to confirm a finding is live for the secret types it has a detector for
trufflehog git file://. --results=verified,unknown
.gitleaks.toml (keeps the defaults, adds one rule)
# .gitleaks.toml: keep the built-in rules and add one for a key shaped like ours
[extend]
useDefault = true

[[rules]]
id = "sk-style-api-key"
description = "sk- prefixed API key"
regex = '''sk-[A-Za-z0-9_-]{20,}'''

If a scanner finds the key in a commit, you have the answer to “where”: a file and a date. Compare that date with the first odd row on the usage page. If the key was committed on the 3rd and the first stranger request is on the 9th, your search found the likely route. If the key was committed after the first stranger request, it did not come from there, and you should keep looking.

What if it is not in git?

About a quarter of leaks are not. GitGuardian’s 2026 figure above, 28 percent outside repositories, is the reason to look in the other rows of the table. Search your team chat for the key prefix and the variable name, check what CI printed, open the built JavaScript of any web page that calls the API from the browser, and ask the one person who “just needed to get it working” last week. A search that finds nothing is not proof of safety; it is a reason to rotate on a schedule rather than only after an incident.

If you cannot find it at all, say so in the incident note and rely on the limits: the new key has an IP list and a budget, the old key is dead, and the log shows the first and last stranger request. That is a complete, defensible outcome.

Minutes 45 to 60: how do you clean up and harden?

Now revoke the old key: press Revoke on its row and confirm. It is deleted for good, and a revoked key will not come back by someone pressing Enable. Run the two-line test from minute zero again, with the old key, to prove it. Then work through the three jobs below.

1. Decide whether a history rewrite is worth it. GitHub’s guidance is direct about this: if the sensitive data is a credential, revoke or rotate it first, and once it is revoked it can no longer be used, “and that may be sufficient to solve your problem.” GitHub’s secret scanning page repeats that removing a secret from history is time-intensive and often unnecessary once the credential is revoked. Rewriting history has real side effects, which the GitHub guide lists: changed commit hashes, lost signatures, broken diffs on closed pull requests, and a high risk that a collaborator’s old clone pushes the data straight back. Rewriting also does nothing about existing clones and forks, or about cached views and pull request references on GitHub, which only GitHub Support can remove, and only for sensitive data they judge cannot be handled by rotating credentials.

If you still choose to rewrite, git-filter-repo is the tool the guide names, and its --replace-text option takes a file of expressions, literal by default with regex: and glob: prefixes, and a ==> suffix for the replacement text.

Replace the key in history (optional, after revoking)
# replacements.txt: one expression per line, "==>" picks the replacement text
regex:sk-[A-Za-z0-9_-]{20,}==>***REMOVED***

# Only AFTER the key is revoked, and only if you decide a rewrite is worth it:
git filter-repo --replace-text replacements.txt

2. Stop the next leak at the door. GitHub’s push protection blocks a push that contains a detected secret before it reaches the repository, so you remove the secret and push again. It covers provider-specific patterns, generic patterns such as private keys, and custom patterns you define, and the generic ones need to be switched on in repository or organization settings. GitHub’s data-removal guide also suggests a pre-commit hook using git-secrets or Gitleaks, a .gitignore entry for files that should not be tracked, secrets injected from the environment or a secrets service, and committing file by file instead of with git add .. Pick two and do them today. A control you add during an incident is a control you will actually add.

3. Write the incident note. Four lines: the key name, the first and last odd request, the amount spent, and the place it leaked or “not found”. OWASP’s secrets management cheat sheet asks incident responders to know who had access, when it was used and when it was last rotated. You will not remember those three facts in a month. The usage CSV and the account activity CSV are the raw material; paste the summary next to them.

Which step is yours?

The right first action depends on where the key went. Pick the row that sounds like your situation.

Where did the key leak?

A public repository

Treat it as used already. Disable the key now, then check the usage page for the first odd request. GitHub warns that public repositories with exposed secrets are indexed by search engines and specialized scanning services, so the clock started at the push, not at your discovery. Search history with the commands above, and turn on push protection. A rewrite is optional once the key is revoked.

A private repo or a CI log

Disable the key, then find every copy: forks, laptops, mirrors, and the last 30 days of build logs. OpenAI's guidance says a private repository is more secure, but a data breach can still leak the keys. Replace the key with one that has an IP allowlist pointed at your build runner's fixed address, if it has one, and a small budget if it does not.

A chat, ticket or screenshot

Disable the key and search the tool for the prefix and the variable name. Deleting the message does not remove it from exports, notifications or the screenshots people took. The replacement key should carry a short expiry. Use the swap drill so changing a key is a five-minute job and nobody is tempted to keep the old one.

A browser or mobile app

Disable it and move the call to your own server. A key shipped to every visitor cannot be made safe by an allowlist, and OpenAI says never to deploy a key client-side. The gateway versus direct API post explains where the call should live, and the cost-control guide covers per-end-user spend limits if your app serves many users through one key.

I do not know

Disable every key that was in the exposed place, then use the usage page to find the first odd request and the account activity log to rule out the console session. If a setup script touched the machine, read the 7 checks before running a setup script. If you cannot find the source, say so in the note and rely on the new key's limits.

What changes when one key reaches many models?

A gateway key is a bigger blast radius than a single provider’s key, and an honest post says so. One key reaches every model your account can call, so a leak exposes all of them, not one. The post on unified LLM APIs and what you trade lays out that trade in full, and the answer is the model list: restrict each key to the models its app calls, and a stolen copy cannot reach the rest.

Two properties of our service shape the worst case, and you can check both yourself. Credit is prepaid, so a key can never spend more than the balance, and a request stops when the balance reaches $0, as the cost-control guide states. That is a different ceiling from a provider that bills a card in arrears; the post on prepaid LLM API credits covers what you give up for it. And the free lane is a separate allowance: 48 free ids share 100 requests and 3,000,000 tokens a day, with no money attached.

Three things we cannot do, so you are not surprised. We cannot tell a thief from you; the usage table has no address column, so the IP allowlist has to be set before the leak. We cannot show you the prompts a thief sent, because prompts and answers are not stored; we keep counts. And we cannot promise that a bill will be reversed. If you see usage you did not make, write to support@oneaiapikey.com with the key name and the time range; cases are looked at one by one, and the terms hold the policy. The reason to set caps early is that they are the part you control.

If you are choosing a provider and key hygiene is a deciding factor, ask the same questions of every vendor on your list: can a key carry its own spend limit, an IP allowlist, an expiry and a model list; is there an account-wide cap; can you export a usage log; and what does the status page show? The 12-point provider checklist, the status page grading guide and the ten data-processing questions turn those questions into something you can score. Our own transparency page and status page say what we monitor. If you bought a key from a reseller you cannot verify, read the risks of cheap LLM API resellers before you spend anything on it, and the free key scam patterns for the cases where a “free” key is somebody else’s leaked one.

Are you ready for the next leak?

Most of this post is cheaper to do in advance. Tick what is already true for your main key and see where you land. Nothing you tick leaves your browser.

Leak readiness for one production key

0 of 9 in place

Exposed

A leak today would run until you noticed. Start with the spend limit and the model list: two minutes each.

What should you do in the week after?

Keep it small and put dates on it.

  1. Rotate on a schedule. Pick an interval you will keep and put the date in the calendar. The console can enforce it for you: under Settings, the key policy requires every new or edited key to expire within a number of days you choose.
  2. Read your own bill. Open the usage page weekly for a month and compare tokens in and out with what your app should send. The post on auditing LLM API billing shows how to compare reported usage with your own token counts, and 10 ways to cut LLM API costs covers the rest of the spend.
  3. Plan for a second route. A key you must disable at 3 a.m. should not take your product down. The uptime and fallback guide and the 429 error guide show how to keep a second model ready, and a quick check against the OpenAI-compatible provider matrix tells you whether a second provider speaks the same API.
  4. Know how the gateway treats your data. The privacy post and the account-security guide say what is stored and what the console can show, so the next incident starts with facts. How we do paid access by email explains why adding credit is a hand-set step today, which has the side effect that a stranger cannot top up your account.
  5. Practise once. Create a throwaway key, leak it to yourself, and run the first hour in 20 minutes. The second time is faster than the first.

If you want the longer view, what an LLM gateway is explains why a single key reaches so many models, and our review of the service says plainly what it does and does not do. Sign-up uses a Google login and there is no card field, so the only secret you create is the key, and the free lane is a way to practise this whole hour at $0. The pricing page lists the paid models and rates, and the chat uses the same allowance as the API if you want to try a model without a key at all.

Set the caps before you need them

Create a key with an IP allowlist, a budget and a model list in a few clicks, test the old-key drill on the free lane, and you have rehearsed the whole hour at $0.

Frequently asked questions

Should I disable the key or revoke it first?
Disable first. Disabling stops the key at once and keeps its row, so the usage history and the key's name stay visible while you work out what happened. Once you have the replacement deployed and the leak closed, revoke the old key: revoking deletes it for good. The authentication guide states the difference in one line. If the Keys page says you are at your account's key limit and you need the slot for the replacement, revoke an unused key or the leaked one straight away; a leaked key is not worth a slot.
My repository was private. Do I still need to rotate?
Yes. GitHub says a committed secret stays in Git history after you remove it from the latest commit, and OpenAI's own safety guidance says a private repository is more secure but a data breach can still leak the keys. A private repo also gets forked, cloned to laptops, backed up and pasted into tickets. Rotation takes 5 minutes; arguing about who could have seen the file does not. The review of installer scripts shows one more way a key leaves a machine that nobody pushed anywhere.
Is deleting the commit or rewriting history enough?
No, and it is rarely the first thing to do. GitHub's guide says that when the data is a secret, the first step is to revoke or rotate it, and that this may be enough on its own. A history rewrite does not touch clones, forks or cached views that already exist. Treat the rewrite as housekeeping after the key is dead, not as the fix.
Will I be billed for what someone else ran on my key?
Plan as if you will be. Credit here is prepaid, so the most a leaked key can spend is what the account holds, and a per-key spend limit or an account spend cap lowers that further, as the cost-control guide sets out. If the usage page shows requests you did not make, write to support@oneaiapikey.com with the key name and the time range; cases are looked at one by one, and the terms hold the policy. Do not count on money coming back: the caps are the protection you control.
Can I see what the attacker sent?
Not the content. Prompts and answers pass through and are not stored by default; only counts are kept (model, tokens, cost, timing, key name, request id), as the routing and privacy page and the post on what a gateway sees and stores explain. The usage page tells you what model, when, how much and through which key. It does not show the caller's IP address. That is why the IP allowlist, set before a leak, matters more than any log afterwards.
Does a leaked key matter if I only use the free models?
Less, but yes. The free ids work at a $0 balance, so a stranger cannot run up money through them, but they can burn the shared daily allowance of 100 requests and 3,000,000 tokens, and your own calls then get a 429 with the code daily_limit_free until 00:00 UTC. The key also sits in the same account as your sign-up credit for priced models. The scam-pattern guide covers why strangers collect free keys.
How often should I rotate keys?
OpenAI recommends creating keys with an expiration date and running a regular rotation process, and we agree with the direction. The interval is your call. We suggest picking one you will actually keep, such as every 90 days for server keys and a few days for a demo or contractor key. The console can enforce it: under Settings you can require every new or edited key to expire within a number of days. The exit-plan post has a drill that makes a swap routine.
Do I need a secrets manager?
For a hobby script, an environment variable outside the repository is enough. For a production service, OpenAI recommends a key management service and OWASP's secrets cheat sheet lists revocation, rotation and logging as the parts of a response plan. A manager does not stop a leak, but it gives you one place to replace the key instead of six. The coding-agent key guide shows the environment-variable setup for the common tools.
The key was in a browser or mobile app. What now?
Rotate it, then move the call to your own server. OpenAI's guidance says never to deploy a key in client-side environments, because anyone can lift it and make requests on your behalf. No setting makes a key that ships to every visitor safe; an IP allowlist is useless when the callers are all your users. The gateway versus direct API post covers where the call should live.
More in Blog

Try it

One API key for GPT, Grok, DeepSeek, Kimi, GLM, MiniMax, Qwen, Step, Beam, Nemotron, ERNIE, Hunyuan, Gemma, Laguna, LFM, LongCat, Llama, Solar, Jais, Mistral, K2 and Roleplay.

One AI API Key speaks the OpenAI and Anthropic formats, so you change the base URL and the key, not your code. Credit packs start at $10, and every model has a published per-token rate.

New accounts$10 credit on sign-up
Claim $10 credit →