Keep your AI API key out of the browser.

A ready-to-deploy Cloudflare Worker that proxies Claude, DeepSeek and other Anthropic-compatible LLMs for you. Your key lives in a Worker secret. Your web app talks to your Worker. Nobody else.
Free download, MIT licensed, commercial use allowed.

No signup. No account. No telemetry. The ZIP contains everything you need.

The leak everyone hits

Put your API key in front-end JavaScript and anyone can open DevTools, copy it, and spend your money. A leaked Claude key can burn hundreds of dollars overnight.

The fix in one file

The Worker holds the key server-side, checks a shared secret, restricts origins, and rate-limits by IP. Your browser only ever sees your own endpoint.

You own everything

Your code, your Cloudflare bill, your logs. Swap models, enable streaming, tune limits. Nothing here talks to a third-party vendor.

What's in the ZIP

Seven files. Nothing else.

FileWhat it does
worker.jsThe proxy itself: CORS allow-list, shared-secret auth, per-IP rate limiting, 20 KB request body cap, security headers.
wrangler.tomlDeployment config — one command and you're live on Workers free or paid.
DEPLOY.mdStep-by-step setup, tested on the Workers free plan.
CUSTOMIZE.mdSwitch providers, enable streaming responses, change rate limits.
README.mdQuick start and configuration reference.
CHANGELOG.mdVersion history.
LICENSEMIT — use it commercially, modify it, ship it inside your own product.

Deploy in about ten minutes

Cloudflare Workers free tier is enough to start.

  1. Unzip the kit, then install the Cloudflare CLI and log in:
    npm install -g wrangler && npx wrangler login
  2. Store your provider key as a Worker secret:
    npx wrangler secret put LLM_API_KEY
  3. Generate a random shared secret and store it too:
    node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
    then npx wrangler secret put CLIENT_SECRET
  4. Edit the config block at the top of worker.js: put your domain in ALLOWED_ORIGINS (this is the CORS allow-list), and set LLM_BASE_URL / DEFAULT_MODEL for your provider.
  5. Deploy:
    npx wrangler deploy — the output shows your Worker URL.
  6. Confirm the deploy:
    curl https://<your-worker>.workers.dev/health → {"status":"ok"}
  7. Point your front end at /v1/chat and send the shared secret in the X-Client-Secret header.
POST https://<your-worker>.workers.dev/v1/chat
X-Client-Secret: <your CLIENT_SECRET>

{"messages":[{"role":"user","content":"hello"}]}
Before you ship: never put CLIENT_SECRET in front-end JavaScript either. Put it behind a login, or have the browser call your own backend. The Worker stops the API key leak; it can't stop you leaking the shared secret.

FAQ

Which providers does it support?

DeepSeek works out of the box — it is the default. Claude is a one-line change to LLM_BASE_URL and DEFAULT_MODEL. OpenAI / GPT also works, but it uses the Chat Completions shape, so callLLM() needs the small body-and-response tweak shown in CUSTOMIZE.md. Any other Anthropic-compatible endpoint works the same way.

Does it cost anything?

The Worker runs on Cloudflare's free tier for this kind of traffic. You pay your AI provider directly. There is no middleman and no subscription.

Can I use this in a commercial product?

Yes. MIT license permits commercial use, modification and redistribution. You are not required to credit anything, though a link back is welcome.

Why is it free?

Because it is a small, self-contained piece of engineering and most people need it once. If it saved you an afternoon, grab it and go.

What is the browser extension next to this?

PrivacyGuard is a Chrome extension that stops you pasting API keys and other secrets into AI chatbots. Different problem, same idea: keep the key on your side of the wire.