Leaked Hugging Face (Inference Providers) API key? What to do now
Revoke it first, then check what it was used for, cap what your keys can spend and clean up where it leaked. Every Hugging Face step below comes from Hugging Face's own docs, checked 17 Nov 2026.
Free. No sign-up.
What to do now, for Hugging Face
Revoke the key now
Delete or refresh the token on the Access Tokens page; refreshing gives it a new value. Until you do, the token can also read, or write, your private repos. Do this first: until it's revoked, anyone who copied it can keep spending. GitHub reports Hugging Face tokens found in public repos, and GitHub says Hugging Face revokes them at once. Hugging Face's docs don't mention GitHub, but say a token reported to its revoke endpoint stops working everywhere and its owner is emailed.
Keep the new key on the server
Put the new key only in a server-side secret: your host's environment settings, your builder's secrets, or Supabase function secrets. Never in a variable starting NEXT_PUBLIC_, VITE_ or EXPO_PUBLIC_, which are sent to every visitor.
Check usage for charges that weren't yours
Inference Providers settings show the past month's usage by model and provider, and the billing page shows spend. Hugging Face's docs don't say either can show one token. Note the time the key leaked and the time you revoked it.
Cap what any key can spend
Admins of Team or Enterprise organisations can set a spending limit in the organisation's settings. Personal accounts spend bought credits, with no other cap in Hugging Face's docs: service is interrupted when they run out, unless automatic recharge is on.
Clean up the repo, after revoking
Remove the key from the code and the git history, but only once it's revoked: anyone who cloned the repo, or a fork, still has it. Then turn on push protection, so GitHub blocks the next key you try to push.
If someone ran up charges, ask for them back
Email billing@huggingface.co. Hugging Face's terms say all fees are non-refundable, and there's no stated policy on usage from leaked tokens. Say when the key leaked, when you revoked it and which usage wasn't yours.
Checked in Hugging Face's own docs. Sources: access tokens, inference pricing, billing, terms of service, GitHub's blog on secret protection. Dashboards move, so if a link is out of date, look for the same setting under account or organisation settings.
Then find every other copy, with your coding agent
Find every place an API key or other secret is exposed in this project, and fix it. Search the code, env files, config and local settings files (such as .claude/settings.local.json), the full git history (with gitleaks or a similar scanner) and the built browser bundle. Flag any secret in a variable with a public prefix such as NEXT_PUBLIC_, VITE_ or EXPO_PUBLIC_, and any AI provider called from browser code. Move every AI call into a server route or function that reads its key from a server-only variable, add .env and local settings files to .gitignore, and list each key that was exposed and where, so I can revoke it. Don't rewrite git history.
Questions
Does Hugging Face disable a leaked key for you?
GitHub reports Hugging Face tokens found in public repos, and GitHub says Hugging Face revokes them at once. Hugging Face's docs don't mention GitHub, but say a token reported to its revoke endpoint stops working everywhere and its owner is emailed. Revoke it yourself either way.
Can I cap what a Hugging Face key spends?
Admins of Team or Enterprise organisations can set a spending limit in the organisation's settings. Personal accounts spend bought credits, with no other cap in Hugging Face's docs: service is interrupted when they run out, unless automatic recharge is on.
How do I see what a leaked Hugging Face key was used for?
Inference Providers settings show the past month's usage by model and provider, and the billing page shows spend. Hugging Face's docs don't say either can show one token.
Will Hugging Face refund charges from a leaked key?
Email billing@huggingface.co. Hugging Face's terms say all fees are non-refundable, and there's no stated policy on usage from leaked tokens.
How do I find where my Hugging Face key leaked?
Search your code, your git history and your live site's JavaScript for “hf_” (how Hugging Face keys start). Common places are browser code, a committed .env or local settings file, and screenshots.
Other providers
- Leaked OpenAI key
- Leaked Anthropic key
- Leaked Google Gemini key
- Leaked xAI key
- Leaked Mistral key
- Leaked DeepSeek key
- Leaked OpenRouter key
- Leaked ElevenLabs key
- Leaked Replicate key
- Leaked fal key
- Leaked Groq key
- Leaked Together AI key
- Leaked Perplexity key
- Leaked Cohere key
- Which providers stop a leaked key for you
- Security checklist for vibe-coded apps