OpenAI or Anthropic API key exposed in the browser A developer at Axonscape has flagged a common security flaw in AI-built apps: OpenAI or Anthropic API keys exposed in browser code when clients are created with dangerouslyAllowBrowser or keys are read from VITE_ or NEXT_PUBLIC_ prefixed environment variables, making them readable by any visitor and spendable on the owner's account. The writeup recommends moving all AI calls to a server-side API route that reads the key from a server-only variable, adding a per-user rate limit, and revoking the exposed key. Axonscape's Launchpad offers a free launch check that scans a public GitHub repo or code zip for this and other pre-launch issues without retaining data. An AI client created with dangerouslyAllowBrowser, or a key behind a VITE or NEXT PUBLIC prefix, puts your API key in the page, where anyone can copy it and spend on your account. The OpenAI or Anthropic client is created in a component, with dangerouslyAllowBrowser: true , or the key is read from VITE OPENAI API KEY or NEXT PUBLIC … . Anything the browser runs, every visitor can read. A public prefix means the value is bundled into the JavaScript everyone downloads. Paste this into Lovable, Bolt, v0, Replit or Cursor: The AI API key is exposed in the browser. Move every AI call to a server-side API route that reads the key from a server-only environment variable no VITE or NEXT PUBLIC prefix , have the browser call that route, and add a per-user rate limit. Then tell me to revoke the old key. The full page, with the request ready to copy, is at launchpad.axonscape.com/fix/ai-api-key-exposed-in-browser https://launchpad.axonscape.com/fix/ai-api-key-exposed-in-browser . I work on Launchpad by Axonscape, which runs a free launch check https://launchpad.axonscape.com/check for apps built with AI tools: it finds this and the other things that break at launch, from a public GitHub repo or a .zip of the code, and keeps nothing.