Keys and per-user limits
For engineers
Keeping provider keys on the server, rotating and scoping them, enforcing per-user quotas and spotting abuse of your AI endpoint
110 questions across four stages: Understand, Apply, Solve and Judge.
Try 5 questions
Practice items, not counted towards your mastery. No account needed.
Check yourself · 1 of 5
A web app calls the model provider straight from the browser using a key stored in a build-time variable. What is the core problem?
Check yourself · 2 of 5
You are rotating a production key with no downtime. What is the right order?
Check yourself · 3 of 5
Why count tokens per user instead of only counting requests?
Check yourself · 4 of 5
A usage log shows one new account making 3,000 calls at an even two-second interval with large inputs. Which pattern is this?
Check yourself · 5 of 5
You move the provider call into a server route and keep the key in the server environment. Which step is still missing?
Topics
- Keeping provider keys on the server4 min read · Why keys never ship in browser or mobile bundles, server proxy routes and short-lived tokens for realtime clients
- Rotating, scoping and revoking API keys4 min read · Separate keys per environment and service, secret managers, zero-downtime rotation and what to do when a key leaks
- Enforcing per-user quotas and spend caps5 min read · Token and request budgets per user and plan, workspace spend limits and clear messages when a quota is reached
- Detecting abuse of an LLM endpoint5 min read · Free-tier farming, use as a free model proxy, wallet-draining loops and injection probes in usage logs
Start here
- Best practices for API key safety (OpenAI) (opens in a new tab)ArticleFree
Plain rules from a provider: never in client code, one key per person or service, load from the environment, rotate on exposure.
- Secrets Management Cheat Sheet (OWASP) (opens in a new tab)ArticleFree
Storage, rotation, least privilege and incident handling for secrets, in checklist form.
- LLM10:2025 Unbounded Consumption (OWASP GenAI) (opens in a new tab)ArticleFree
Names wallet-draining and model-extraction abuse of LLM endpoints and lists the mitigations: quotas, rate limits, monitoring.
Scenarios
Helps to know first
110 questions · last verified 2026-12