AI · Secret guide

Leaked Moonshot AI (Kimi) API Key: what to do in the first hour

Medium severityChecked liveLast verified · 5 min read

A Moonshot AI key, the credential behind the Kimi API, lets whoever holds it call Kimi models and have the usage charged to your account balance. It does not open your chat history in the Kimi app and it does not reach your servers. The risk is spending and abuse: someone else’s requests, billed to you. The key is quick to replace, so do that first, then look at what was consumed.

Check your GitHub account for leaked secrets — free

Provider
Kimi
Severity
Medium
Impact
SaaS account access and billing
Checked live by LeakWatch
Yes

What a Moonshot AI (Kimi) API key looks like

A Kimi key is sk- followed by roughly 50 letters and digits, with no dashes and no readable provider name in it:

sk-…XXXX   Moonshot AI / Kimi API key (masked, about 50 characters after the prefix)

That shape is shared with other providers, which is why the variable name around it matters. In code the key usually sits in MOONSHOT_API_KEY or KIMI_API_KEY, next to a base URL on api.moonshot.ai (or api.moonshot.cn for the China platform). Keys from the two platforms are separate: a key created on the global console does not work on the China endpoint, and the other way round. A key with a different second part, such as sk-or-, sk-proj- or sk-cp-, belongs to another provider: see the OpenRouter API key, OpenAI API key or MiniMax API key case.

How Moonshot AI keys get leaked

  • Hardcoded in a script. A quick OpenAI(api_key="sk-…", base_url="https://api.moonshot.ai/v1") call, because the Kimi API is compatible with the OpenAI client libraries, committed with the key inline.
  • Environment files. .env files, Docker compose files and notebook configs copied into a repository.
  • Coding agents and tool configs. Agent frameworks, editor plugins and MCP configuration files that store the key in plain text, then land in a public dotfiles repository.
  • Browser code. A key placed in front-end JavaScript to call the API straight from a web page, where every visitor can read it.
  • Tutorials and shared notebooks. A key pasted in a Colab notebook, a gist or a screenshot while demonstrating an integration.

What to do in the first hour

  1. Create a new key. Sign in to the Kimi API platform with the account that owns the key, open API Keys in the console and create a new one. Name it after where it will be used.
  2. Deploy the new key to the application or secret store that used the old one, and check that the application still works.
  3. Delete the exposed key. On the same API Keys page, delete the leaked one. Match it by its name or by the last characters shown in the list, not by guessing. Requests made with a deleted key are rejected.
  4. Check usage and balance. Look at the balance and usage pages for the period since the exposure. Compare the balance with your last known level, and look for hours of volume you cannot explain. The platform is prepaid, so the balance is the ceiling of the damage; if you have auto top-up, switch it off until you have finished.
  5. Check which platform it was on. If your team has both a global and a China account, search both consoles: a key you cannot find on one is probably on the other.
  6. Look for other keys in the same place. A repository that held a Kimi key often holds other provider keys in the same .env or config file. Rotate each of them at its own provider.
  7. Move the key out of the code. Read it from an environment variable or a secret manager, call the API from a backend rather than from the browser, and remove the old value from the repository. See I accidentally pushed an API key to GitHub.

Not sure what else leaked from the same repository? Run a free scan.

Not sure what else leaked? Run a free scan.

Revoke it at Moonshot AI

Moonshot AI keys are managed from the API Keys page of the Kimi API console, after you sign in with the account that created the key. The global console lives at platform.moonshot.ai (the Kimi documentation also uses platform.kimi.ai), and the China platform at platform.moonshot.cn. Find the exposed key in the list and delete it. If you cannot find it, you are probably signed in to the wrong account or the wrong platform, or it is not a Kimi key at all. Check the prefix and length above before searching further. The console can change over time, so if the wording differs from this guide, look for the section where keys are created and listed, and ask Moonshot support if no delete option is offered.

How LeakWatch detects it

The rule is called Kimi API Key. It matches sk- followed by 48 to 52 letters and digits, and it leaves out the older OpenAI key shape that carries OpenAI’s own signature in the middle, so the same key is not reported twice under two providers. Because sk- plus about fifty characters is not unique to Moonshot, the severity is medium. This type is checked live: LeakWatch can check whether a detected key is still active with a read-only request that lists the available models, on the global endpoint and then the China one. It never sends a prompt, reads your data or spends your balance.

LeakWatch can check whether a detected key is still active with a read-only request to Kimi. It never reads your data or spends your credits.

FAQ

Is it really a Moonshot key, or an OpenAI key?

Look at the variable name and the base URL next to it. MOONSHOT_API_KEY, KIMI_API_KEY or a moonshot host point to Kimi. If the key is much longer, or has proj or or after the sk-, it is another provider’s. Check the matching key list before deleting anything.

Can someone read my Kimi conversations with this key?

No. The API key calls the models; it does not open the chat history of the Kimi app. What it exposes is your balance and the ability to run requests as you.

The key was only in a private repository. Should I still replace it?

Yes, if the repository has collaborators, forks or CI logs, or if you are not sure who can read it. Replacing a key is cheap, and a key you doubt is worth less than a new one.

Get alerted next time a secret leaks — create a free account

LeakWatch is not affiliated with Kimi.