Lion Cipher Lab
Spot LLM abuse in your usage logs: bursts, giant prompts and runaway spend per API key
- AI Security
- Beginner
- ~40 min
- Free · no account required
Why it matters
LLM apps charge for every token and can be flooded in ways ordinary APIs are not: one giant prompt costs as much as hundreds of small ones. OWASP lists denial of wallet, model extraction and resource exhaustion under unbounded consumption, and its mitigations include rate limits, quotas, logging and monitoring for unusual consumption. Limits stop the worst of it, but you still want to notice who is pushing against them. This lab builds the noticing: a log with five fields, a summary per key, and three different alerts.
What you'll learn
- recording the few fields per request that abuse monitoring needs
- summarising a usage log per API key with jq
- computing the busiest ten-minute window for each key
- comparing each key with the typical key using the median
- seeing why one alert is not enough, because each catches something the others miss
Steps in this lab
- What you are watching for
- Generate a usage log
- Summarise per key with jq
- Write the watcher
- Read what each alert caught and missed
- From alerts to action, and what this does not catch
- Clean up
Open the full interactive lab →