AppInspected

Fix guides

Your OpenRouter key is in your frontend, or your prompts were read. What to do now.

Last reviewed November 22, 2026 against the providers' current documentation.

The short version

If the key is in your site's JavaScript, delete it on OpenRouter's Keys page, create a new one with a credit limit, keep it in a server-only secret, and have your app call your own server instead of OpenRouter. If you got OpenRouter's email about MiniMax models, look up which of your requests went to those providers, search what those requests contained for keys, internal links and customer data, and rotate anything you find, even if you're told it wasn't used. Then keep secrets out of prompts for good: anything in a request can be read by whoever runs the model.

Why it matters

An OpenRouter key spends your OpenRouter credits on any model it offers, and every file your site sends to the browser can be read in seconds with the developer tools. OpenRouter keys look like sk-or-v1- followed by 64 hexadecimal characters, which makes them easy to find for anyone who scans public sites. The second leak is newer. On November 19, 2026, Dragos published a study in which about two million prompts carrying unique links and fake credentials were sent to AI providers between July and November; it reported that intruders were copying traffic at at least three providers, and that bait AWS keys planted in prompts were later used for tens of thousands of AWS API calls (as reported by Unite.AI). OpenRouter then emailed customers that requests they sent to MiniMax models may have been read: test links in those prompts were opened 40 to 130 hours later, while the AWS test keys in them were not used, and the zero-data-retention label was removed from the affected endpoints (as quoted by PrivacyAffairs and Startup Fortune). A router passes your request to someone else's servers. Whatever is in the prompt, including a key an AI agent pasted in from a config file, goes with it.

Fix it, in this order

  1. Check whether the key is in your frontend

    Run the free check on your live address: it flags an sk-or-v1- key in your pages or JavaScript as critical and shows only its first characters. Then search your project and its build output for sk-or-v1- and for variables like VITE_OPENROUTER_API_KEY or NEXT_PUBLIC_OPENROUTER_API_KEY: values in VITE_, NEXT_PUBLIC_ and EXPO_PUBLIC_ variables are copied into the JavaScript every visitor downloads.
  2. Delete the exposed key and make a capped one

    On OpenRouter's Keys page (openrouter.ai/settings/keys), delete the key that was public, or that appeared in any prompt, and create a new one. OpenRouter's docs say: "We recommend setting a credit limit on every key"; once a key reaches its limit, its requests are rejected until you raise the limit or a daily, weekly or monthly limit resets. Give each app and environment its own key, so one leak can be shut off without taking everything down.
  3. Move the calls to a server

    Put the new key in a server-only secret (for example OPENROUTER_API_KEY) and add one server route that receives the user's input, calls OpenRouter's OpenAI-compatible API at https://openrouter.ai/api/v1 with Authorization: Bearer and the key, and returns only the answer: a Next.js Route Handler, a Supabase Edge Function or a Cloudflare Worker. Keep the model list and system prompt on the server. Require a signed-in user and rate-limit each one, or the route becomes a free AI proxy that costs you the same as a leaked key.
  4. If you got the MiniMax email, find what you sent

    OpenRouter's email tells each customer how many requests went to MiniMax models, through which hosts and in what window. Pull those requests from your own request logs (or OpenRouter's activity view) for that window, and search them for anything that looks like a credential (sk-, AKIA, ghp_, postgres://), internal or private links, and customer names, emails or other personal data. Agents are the usual source: tool output, stack traces and pasted files end up in the prompt without anyone deciding to send them. Reports disagree on the exact window (some providers' own notices cover May to November), so search the wider one.
  5. Rotate everything you find

    Replace every credential that appeared in a prompt, starting with database, cloud and payment keys, even if the notice says the test keys weren't used: links in those prompts were opened days later, and "not used yet" isn't safe. Also rotate the OpenRouter key the requests were made with. If prompts contained your users' personal data, check with whoever handles privacy for you whether this is something you must report or tell users about where you operate.
  6. Decide which providers may see your prompts

    A zero-data-retention label is a provider's promise about storage, not protection against someone who has already broken into its servers: Dragos reported intruders copying requests as they arrived, and some providers appearing to ignore privacy settings. Use OpenRouter's provider routing and zero-data-retention settings to limit which providers can serve your requests, send sensitive data (health, legal, customer records) to a provider you've vetted under a contract, and put a redaction step in front of anything an agent sends, so a pasted key never leaves your server.

Or ask your AI tool to do it

Paste this into Lovable, Bolt, Cursor, Claude Code or whichever tool built your app. Review what it changes before you deploy.

My app uses OpenRouter. 1) Find every place the OpenRouter API key (it starts with sk-or-v1-) is used in frontend code or in a VITE_, NEXT_PUBLIC_, EXPO_PUBLIC_ or REACT_APP_ variable. Move every OpenRouter call into one server-side route (or Supabase Edge Function / Cloudflare Worker) that reads the key from a server-only environment variable OPENROUTER_API_KEY, calls https://openrouter.ai/api/v1/chat/completions, keeps the model and system prompt on the server, requires a signed-in user, rate-limits each user, accepts only the inputs the feature needs and returns only the text the UI shows. Remove the key and any dangerouslyAllowBrowser option from client code. 2) Before any request is sent to OpenRouter, add a redaction step that replaces anything that looks like a secret (API keys such as sk-, sk-or-v1-, AKIA, ghp_, sb_secret_, JWTs, private keys, database URLs with passwords) with [REDACTED], including in tool output and file contents an agent adds to the prompt. List every file you changed and remind me to delete the old key on OpenRouter's Keys page and set a credit limit on the new one.

How this happens

OpenRouter is popular with vibe-coded apps because one key reaches hundreds of models, and the quickest way to wire it up is to call it from the page with the key in a VITE_ or NEXT_PUBLIC_ variable. The prompt leak happens one step later: an AI agent with access to your project reads a .env file or an error message containing a connection string, puts it into the conversation, and the request goes through a router to whichever provider is cheapest or fastest that minute. Nobody decided to send the secret, and nobody knows which company's servers it went to.

Check that it's really fixed

After you deploy, run the free check. It reads your live site the way an attacker would and tells you if any secret key is still visible.

Topic check: Exposed API key checker

Find the other leaks before someone else does

The free check reads your home page and its scripts. The website security report goes through up to 30 pages and 40 JavaScript files, plus .env and .git files, security headers, cookies and CORS, domain and email records, and libraries with known vulnerabilities. Every finding comes with the fix for your host and a prompt for your AI tool.

$19 once, including 20 runs over 30 days so you can fix things and check again.

Get the report, $19 See an example report

Example report header: a score out of 100, findings by severity, Download PDF and Email me this report.

Questions

How do I know it's an OpenRouter key?

OpenRouter's docs describe API keys as sk-or-v1- followed by 64 lowercase hexadecimal characters; management keys use the same format. Our free check and the API key checker flag them as secret. The free check shows only the start of the key and never tries to use it.

Will OpenRouter turn off a leaked key for me?

Only in some cases. OpenRouter's docs say it is a GitHub secret scanning partner and emails you when a key is found exposed, and tell you to delete the compromised key and create a new one. A key in your live website's JavaScript isn't something GitHub sees, so delete it yourself.

The email says the test keys weren't used. Do I still need to rotate?

Yes. The same notice says links in those prompts were opened 40 to 130 hours after they were sent, so someone read them. Dragos reported that bait keys sent to other providers were used. Treat any real credential that was in a prompt as known to a stranger.

Is zero data retention enough?

No. It says the provider won't store your prompts, which is worth having, but it can't stop someone who is already inside the provider's systems, and Dragos found requests marked no-data-collection or zero-retention among those that were read. Keep secrets out of prompts and choose providers on purpose for sensitive data.

Did this happen because I used OpenRouter?

Not only. OpenRouter said its own systems were not breached; the problem was at providers downstream, and Dragos sent requests through several routes. Any app that sends prompts to someone else's model has the same exposure, so the steps above apply to OpenAI, Anthropic and others too: see OpenAI API key in your frontend and Anthropic API key exposed.

Can your free check see whether my prompts leaked?

No. It looks at your live site from the outside, the way a visitor or a scraper would: it finds keys shipped in your JavaScript, exposed .env and config files, and similar mistakes. What a provider did with your requests is only visible in your own logs and the provider's notices.

Sources

Related guides