A Stability AI API key lets whoever holds it generate images and other media on your account, billed to your credits. A leaked key can run up charges, and the generated content is produced under your account. Revoke the key first, then check usage, because a sudden drop in credits is often the first visible sign of misuse.
Check your GitHub account for leaked secrets — free
- Provider
- Stability AI
- Severity
- High
- Impact
- SaaS account access and billing
- Checked live by LeakWatch
- No
What a Stability AI API key looks like
Stability AI keys start with sk-, followed by 48 letters or digits. The prefix is shared with keys from several other AI and cloud providers, so the prefix alone does not tell you which account a key belongs to. What identifies a Stability key is the word stability placed near it in a file, script or log:
sk-…XXXX Stability AI API key (masked)
The key is sent with API calls, usually from a server. Many people store it in a STABILITY_API_KEY variable, and that name is a good thing to search for when you clean up.
How Stability AI API keys get leaked
- Environment files committed by accident. A
.envfile with the key, pushed to a repository that later became public. - Front-end code. A key placed in a web or mobile app so that the app can generate images directly. Anyone who loads the app can read it.
- Notebooks and scripts. A key set inside a notebook or script that is shared with a class, a team or the public.
- Tutorials and snippets. Sample code copied with the real key left in place of the placeholder.
- Logs. A debug print of the environment or of the request headers, saved to a file or a CI log.
What to do in the first hour
- Revoke the key. Open the account settings, find the API keys section and delete the key that leaked. Create the replacement first if the application is running.
- Deploy the new key through your secret store and test one generation to confirm the application still works.
- Check usage. Look at the credit balance and the generation history for the period since the exposure. Note any spike in use, unfamiliar models or activity at unusual hours.
- Check the other keys in the same file or pipeline, since leaked environment files usually hold more than one credential.
- Limit future damage. Keep a separate key for each application and watch your credit balance so that a sudden drop triggers a review.
- Clean the repository. Remove the value from code and history, and check the logs. See I accidentally pushed an API key to GitHub.
Not sure what else leaked from the same project? Run a free scan.
Revoke it at Stability AI
Open the account settings on the Stability AI platform, go to the API keys section and delete the key that leaked. Public descriptions of this page are partly third-party and disagree on a few details, such as whether a key is created at sign-up, so this guide has not confirmed the exact labels. Check the wording on the live page before you act, and make sure you are in the right account if you have several.
How LeakWatch detects it
The rule is called “Stability AI API Key”. It looks for the word stability near an assignment, then a value that starts with sk- and continues with 48 letters or digits, with word boundaries around the value. Without the word, the same value is not reported under this rule, because the prefix is shared with other providers. The severity is high. This type is not checked live: LeakWatch does not call Stability AI with the value it finds.
LeakWatch detects this format but does not check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.
FAQ
Is an sk- key from another provider the same thing?
Not necessarily. The prefix is common, so the account it belongs to is what matters. Check the provider name near the value before you act.
Can someone use my credits to generate content I would not publish?
Yes, if they have the key. Generated output is produced under your account, so review your usage history to see what was created.
Should I use one key for everything?
No. A separate key per application means a single revocation affects only one service.