Resources / Guides
How to hide API keys from your frontend with a proxy endpoint
Never ship secret keys in browser code. Learn the proxy-endpoint pattern, with rate limits and caching, to call paid APIs safely.
Anything in your frontend bundle is public. If your React, Vue or no-code app calls OpenAI, Google Maps or a payment API with a secret key, that key can be copied in seconds — and billed to you.
The proxy-endpoint pattern
- Your frontend calls your endpoint, e.g.
POST /chat. - The endpoint reads the secret from server-side configuration.
- It validates the request, applies limits, and calls the real API.
- It returns only what the frontend needs.
Don't skip the limits
A proxy without limits just moves the problem: anyone can call your proxy instead of the API. Add:
- A rate limit per visitor (IP or session), e.g. 20 requests per day
- Input validation (max prompt length, allowed models)
- An allowlist of origins (CORS)
Cache what you can
Responses that don't depend on the user — geocoding, product data, exchange rates — can be cached at the edge for minutes. That cuts latency and cost at the same time.
In Wisp
Describe it: "a proxy to the Google Maps geocoding API that hides our key, caches responses for an hour and limits each visitor to 100 calls a day". The key goes to an encrypted vault, the limits are enforced before your code runs, and the cache lives at the edge.
Try it: Template: OpenAI API key proxy · curl to fetch / Python converter
Build it with Wisp — describe an API, get it live.