Exposure Medium

Call AI providers from your server, not the browser

Some sites call an AI provider (OpenAI, Anthropic, Gemini, Groq and others) straight from the visitor's browser. That only works if the browser holds a key the provider accepts, so the key ships to every visitor, or the call goes through a proxy that forwards anything it is sent. Either way anyone can use the account. The scan sees this from the requests the page made and the URLs in its own JavaScript, without calling any provider.

Find out whether your site has this problem, and every other check, in one free scan.

Check your site free

Why it matters

A browser can only call an AI provider with a key the provider accepts, so either the key ships to every visitor, who can copy it and spend on your account, or the call runs through an open proxy anyone can use for the same.

How to fix

  1. 1 Add an endpoint on your own server (or a serverless function) that calls the provider with the key from a server-side environment variable.
  2. 2 Have that endpoint check who is asking (a signed-in user, or at least your own site) and limit how often, so it cannot be used as a free proxy.
  3. 3 Point the page at your endpoint and remove the provider SDK and key from the browser build; if a key ever shipped, revoke it at the provider.

Common mistakes

  • Hiding the key by splitting or encoding it in the bundle: the browser has to put it back together to use it, so anyone can too.
  • Adding a proxy endpoint that forwards any request to the provider without checking who is asking or how often, which moves the open door rather than closing it.
  • Leaving the provider SDK in the browser build after moving the calls, so a later change can quietly start using it again.

How to verify

  1. 1 Re-run the scan and confirm the page no longer calls an AI provider API and its scripts no longer name one.
  2. 2 Open the browser's network panel on the feature and confirm requests go to your own domain, not the provider.
  3. 3 Call your endpoint signed out, or many times quickly, and confirm it refuses or limits you.

Related checks

Ready to see where you stand?

Scan your site and get your Engineering Score with a prioritized roadmap in under a minute, no signup required.

Scan your site

Session expired

Your session has expired for security. Please log in again to continue.