The first hint is usually a spike in your bill. You open your model provider’s dashboard and see usage that dwarfs your normal traffic: tens of thousands of requests, odd prompt patterns, or calls from locations you don’t recognise. This is LLMjacking—the theft and abuse of language model API keys, where someone else’s code runs on your quota and you pay for the results.
Unlike most breaches, you often find out through billing, not logs or error reports. By the time alerts catch up, the attacker has already spent your money running their own workloads.
How LLM API keys get stolen
The attack starts with credential harvesting. Model API keys are often embedded in codebases, environment variables, CI/CD logs, or browser local storage. Common mistakes include pushing keys to public repositories, leaking them via client-side JavaScript, or exposing them in error messages. Attackers run automated scans across public code hosting sites and scrape package registries, looking for anything that matches the shape of a known API key.
Once an attacker has a key, they can use it from anywhere. LLM providers rarely tie API keys to IP addresses, so the attacker can run code from their own infrastructure, spinning up jobs that consume tokens, generate outputs, or even resell access to others. There’s no handshake—if the key is valid, the calls succeed.
Why billing is the canary
LLM API keys don’t always trigger the same fraud and anomaly detection as cloud compute or storage. The workloads can look like legitimate bursts of traffic: a sudden increase in code generation, summarisation, or chat completions. Unless you have tight usage alerts, the first sign is often the bill.
Attackers rarely bother to hide their tracks. They want throughput, not stealth. You’ll see usage patterns that don’t match your application: calls at odd hours, requests from outside your user base, or prompt shapes that don’t fit your product. The API provider’s dashboard is usually the fastest way to spot this.
What to check and how to lock down
- Audit every codebase and config for hardcoded or exposed keys. Search for anything that starts with your provider’s prefix.
- Rotate API keys regularly, and remove any that are unused or too permissive.
- Use provider-level controls: restrict keys by IP, set quotas, and enable usage alerts. Some providers let you scope keys to specific endpoints or models.
- Monitor usage in detail. Watch for unusual spikes, request patterns, or calls from unknown sources.
- Never expose API keys to the client side in web or mobile apps. Proxy requests through your backend where you can enforce controls.
If you do get hit, revoke the exposed key immediately, rotate all others, and review your logs for any sign of what was run. Check whether the attacker left prompts or output data behind—sometimes you can see exactly what they were doing.
The bottom line
LLMjacking is a credential hygiene problem, not a model vulnerability. The attack is simple, the damage is expensive, and the best defence is prevention: keep keys secret, restrict them tightly, and monitor usage like it’s your cloud bill—because it is.




