luxvigil 🕯️
Abuse forensics for AI APIs. Your free tier is part of your attack surface.
Nihil occultum quod non manifestetur. Nothing stays hidden forever (Luke 8:17).
luxvigil reads the request logs of your AI API (or any app that gives away tokens or credits) and shows you the abuse hiding in them: account farms, throwaway emails, shared or leaked keys, bots sending the same prompts over and over… and what the requests behind them cost.
Early days (v0.3). Everything below works, and I'd love to hear what it finds in your logs, or what it gets wrong: open an issue.
Try it
pipx run luxvigil demo # no install: makes fake logs with abuse in them and scans them
pip install luxvigil # then: luxvigil scan your-logs.csv
Python 3.11+, no dependencies, nothing leaves your machine. Using LiteLLM? luxvigil scan spend_logs.json --format litellm reads its spend logs as they come.
Tested on real logs
There's no public dataset of AI API abuse with labels, so we tested it on the closest things there are:
- ~5M real messages to a free GPT chatbot (WildChat). It found people using the free chat as an API for their business: a print-on-demand shop generating product titles, autonomous agents stuck in loops, scripts generating training data. It also showed us a mistake: the bot check was flagging normal people who type "more" or "continue" a lot. We fixed it, and the first fix held up on 3.4M newer chats. The second fix was worked out on those same chats, so it hasn't had an independent test yet. No labels here, so no precision or recall: we read what got flagged.
- Amazon's fraud benchmark (~150k signups labeled fraud or not). During a wave of fake accounts in January 2015, 9 out of 10 accounts luxvigil flags are real fraud. Outside that wave, a shared device is no better than chance. On Amazon's test rows, scoring each account only with what came before it, one simple signal is about level with their best model (AUC 0.642 vs 0.636). It's e-commerce, not AI logs.
What works, what doesn't and how to run it yourself: benchmarks/.
Why
If you run an AI product with a free tier, you're probably feeding someone who signed up 300 times with fake emails. Each account looks normal on its own, so per-user rate limits don't catch it. All you see is the inference bill going up and conversion going down.
And it's not just a billing problem. Free credits and leaked keys are how a lot of people get anonymous, untraceable access to LLMs: to resell it, to run spam or scam campaigns, or to hammer models with jailbreak attempts without risking their own account. On the attacker side, "free inference" is a resource like any other, and your free tier is part of the attack surface.
luxvigil looks across accounts to find the patterns that only show up when you put them side by side.
What it does
You give it a CSV export of your request logs, it gives you a report. Want to see it before digging out your logs? luxvigil demo makes a month of fake logs with two farms, a leaked key and a spend spike planted in them, and scans them:
$ luxvigil demo
🕯️ luxvigil · 2026-10-01 to 2026-10-30 (UTC)
11,405 requests · 285 accounts · $324.60 spent
💰 ~$162.86 is likely abuse (50% of your spend), 61 accounts
🔎 ~$55.15 more is worth a look, 26 accounts (signals that can have an innocent explanation)
🚨 1 account farm, 60 accounts
- 60 accounts first seen on 3 shared devices + 1 shared network (185.220.101.0/24) within 21 days, all with throwaway emails or bot prompts · 3,368 requests on them · ~$144.89
🔗 1 group of accounts sharing devices or networks, 25 accounts (worth a look)
- 25 accounts first seen on 1 shared device within 20 days, nothing else off about them (a class or a kiosk looks the same) · 968 requests · ~$32.39
📧 60 of 285 accounts (21%) use throwaway emails: mailinator.com (16), sharklasers.com (12), 10minutemail.com (12)
3,368 requests · ~$144.89
🔑 1 key used from many countries at once (shared or leaked?)
- key key_eb500b7a7780b4c2: 13 countries in a single day, 401 IPs, home is GB · 400 requests from abroad · ~$17.97
🤖 1 copy-paste bot, 60 accounts
- 60 accounts sending the same 5 prompts over and over (3,368 times) · 3,368 repeated requests · ~$144.89
✅ no shared Gmail inboxes
💸 2 spend spikes (could be a launch or a batch job, check first)
- acc_0100 went from ~$0.02/day to $7.99/day (368x) on 2026-10-28 to 2026-10-30 · 302 requests · ~$22.76 extra
- acc_0007 went from ~$0.02/day to $6.26/day (266x) on 2026-10-23 to 2026-10-25 · 402 requests · ~$17.93 extra
"First seen" is first seen in these logs, which start on 2026-10-01: accounts may have been there before.
The same account can show up in more than one check. The totals at the top count it once.
The $ is what the flagged requests cost, not a confirmed loss: check before you act.
The checks:
- Account farms: 5+ accounts first seen on the same device within a few weeks (or on the same network, when they also use throwaway emails or template prompts: a shared network alone proves nothing, think mobile carriers and universities). It's only likely abuse when at least half of them also have a throwaway email or send a bot's prompts, since a class on the same lab computers looks the same. A device shared over months (a library computer, a second-hand phone) or a chain of small shares (a family computer here, a support agent's login there) shows up as worth a look
- Disposable emails: signups from mailinator & friends
- Shared / leaked keys: one key used from many countries in a short window (often a sign it's been stolen and resold)
- Copy-paste bots: different accounts sending the same prompts or templates
- Gmail aliases: three or more accounts on the same Gmail inbox (
you+1@gmail.com,y.o.u@gmail.com…), the classic way to get lots of free trials with one inbox. It shows the accounts are related, so it's "worth a look", not likely abuse - Spend spikes: a user suddenly burning 10x their usual
Every flag tells you why it fired. No black box.
The report keeps two totals apart. Likely abuse is what comes from strong signals: what a farm's accounts did on the devices and networks they share, the requests a copy-paste bot sent with its repeated prompts, and the requests from abroad on a key used from all over the world. Worth a look is for signals that often have an innocent explanation: a throwaway email (someone testing), accounts on one Gmail inbox (someone with a test account), whatever else a bot's or a farm's accounts did, accounts sharing a device that don't add up to a farm, and spend spikes (a launch, a batch job). Each request is counted once, in the stronger of the two, so one account can have some of each.
Neither total is money you've lost. They're what the requests behind the signals cost, and someone still has to look at them to say if it was abuse.
Reading the report
The report doesn't ban anyone, you do. What to check before acting on each finding:
- 🚨 Account farms and 🔗 accounts sharing devices: look at when the accounts signed up and how they pay. "First seen" means first seen in your logs, not when the account was created, so if your export starts in the middle of things, check further back. The devices and networks listed are what links them, start there: one shared office laptop can pull two unrelated groups together.
- 🔑 Keys used from many countries: ask the owner. A customer with servers in several regions looks exactly the same. If it's not them, rotate the key.
- 🤖 Copy-paste bots: look at the prompt behind the hash. Someone using your free tier as an API, or a legit integration sending a fixed template?
- 📧 Throwaway emails and 📮 shared Gmail inboxes: on their own, mostly people testing. They matter when the same accounts also show up in a stronger finding.
- 💸 Spend spikes: a launch, a batch job or a new big customer look the same as abuse here. Check what the requests were.
--json has this for every finding: the evidence, the most likely innocent explanation and what to check next. When something turns out to be fine, add it to luxvigil.toml and it stops showing up.
What it won't do
- It doesn't block anything. It only looks at what already happened.
- It doesn't run in real time or sit in your request path.
- It doesn't prove anything on its own. It shows you accounts that are related, behave alike or changed suddenly, with the evidence, so you can decide.
- It never sends your logs anywhere. Everything runs on your machine, which matters since prompt logs are usually some of the most sensitive data you have.
- It doesn't anonymise anything. It reads what's in your logs (with
--format litellmthat includes the prompts, if they're there, to hash them) and prints the ids it finds, so if your account ids are emails, so are the ones in the report. A prompt hash isn't anonymous either: a short or common prompt can be guessed from it.
Log format
One row per API request, as a CSV. Only when, who and how many tokens are a
must, everything else is optional. Give it what you have: if a column is
missing, the checks that need it are skipped and the report says so
(⏭️ disposable emails: skipped, no emails in the logs) instead of telling you
everything's fine.
| column | what it is | needed for |
|---|---|---|
timestamp |
when it happened, ISO 8601 (2026-10-01T14:03:22Z) or a unix timestamp. Turned into UTC, no timezone means UTC |
required |
account_id |
your id for the account | required |
input_tokens / output_tokens |
tokens in and out | required |
cost_usd |
what the request cost you (or pass prices, see below). Empty means unknown, 0 means free |
dollar amounts, spikes |
email |
email the account signed up with | throwaway emails, Gmail aliases |
api_key_id |
id or hash of the key used, never the key itself | shared / leaked keys |
ip / country |
client IP and its 2-letter country | farms (IP), shared keys (country) |
device_id |
device / browser fingerprint | farms |
prompt_hash |
hash of the prompt, so repeated prompts show up without storing them | copy-paste bots |
prompt_chars |
length of the prompt in characters | lets the bot check ignore "more", "continue"... |
Your columns are called something else?
luxvigil already understands the usual suspects (user_id, user_email, created_at, prompt_tokens, completion_tokens, client_ip…) and tells you when it uses one. For anything else, point it at your column with --map:
$ luxvigil scan logs.csv --map account_id=customer --map email=signup_email
No cost column? Give it your prices per 1M tokens and it works it out:
$ luxvigil scan logs.csv --price-in 3 --price-out 15
No cost and no prices still works: every check that doesn't need dollars runs, the report shows requests instead of money, and the spike check is skipped. Some rows with an empty cost? Those count as unknown, not free, and the report says how many there are.
It will never pick up a column called api_key, since in some exports that's the raw key. Hash it first and map the hash with --map api_key_id=.... If something in api_key_id still looks like a raw key (sk-..., AKIA... and the like), luxvigil uses a hash of it instead and never prints it. That's a guess based on how common keys look, not a guarantee, so don't rely on it.
Using LiteLLM?
Point luxvigil at your LiteLLM spend logs as they are, no CSV to prepare:
$ luxvigil scan spend_logs.json --format litellm
Get them from your proxy's /spend/logs/v2 endpoint (save the JSON, all pages), or export the
LiteLLM_SpendLogs table from its database to CSV. Each account is the end_user you pass in your
requests. When there isn't one it falls back to the key owner (user:...) and then the key itself
(key:...), and tells you how many requests used each, since a key owner or a key can stand for many
people. LiteLLM only stores a hash of each API key. Anything in that field that isn't a hash like
that gets hashed before it's used, so a raw key never shows up. A request with no spend is an
unknown cost, not a free one.
LiteLLM doesn't log emails or countries, so those checks are skipped, and prompts are only there if you turned on storing them in spend logs. When they are, luxvigil hashes them on your machine and drops the text.
JSON
Want to feed it into something else? --json prints the same report as data. Every finding has a stable id (same logs, same ids), how strong it is, what its cost covers, the evidence behind it, what could explain it innocently and what to check next:
{
"id": "shared_key-c09f5a151c",
"check": "shared_key",
"severity": "likely",
"summary": "key key_eb500b7a7780b4c2: 13 countries in a single day, 401 IPs, home is GB",
"accounts": ["acc_0007"],
"requests": 400,
"cost_usd": 17.9693,
"cost_basis": "requests_from_outside_home_country",
"evidence": {"key": "key_eb500b7a7780b4c2", "home_country": "GB", "peak_countries_in_a_day": 13, "...": "..."},
"innocent_explanation": "a customer running the same key from servers in several regions",
"next_step": "ask the key owner if they use it from these countries, if not rotate it"
}
No raw emails or prompts end up in it, only the ids and hashes already in your logs. It also has the settings used, how many requests each check had data for, and the period (in UTC), so two runs can be compared. Dollar amounts are null when the logs have no costs. An id is built from the accounts in the finding, so if a farm gains or loses an account, it gets a new id: it's not a campaign tracker. The format is versioned ("format": 3 since 0.3.0), see the changelog for what changed.
Bad rows
luxvigil stops at the first row it can't trust (a cost of nan or -5, negative tokens, an empty account id…) and tells you which line, rather than quietly getting the totals wrong. If your export has a few broken rows and you just want the rest, add --skip-bad-rows and it'll tell you how many it skipped. Rows that are an exact copy of an earlier one (every column, request id included) are counted once and you're told how many, since a doubled export would otherwise double the cost; --keep-duplicates keeps them. It also warns you about rows without a valid IP.
Telling it what's normal for you
Your office, your VPN or a big customer behind one network will look like a farm, since lots of accounts share an IP range. Drop a luxvigil.toml next to your logs (or pass --config):
[trusted]
networks = ["203.0.113.0/24"] # office, VPN exit, a customer's office...
devices = ["kiosk-01"]
[ignore]
accounts = ["qa_*"]
emails = ["*@yourcompany.com"]
keys = ["key_ci_*"]
[farms]
window_days = 30 # how close together accounts have to show up on a device (0 = no limit)
Trusted networks and devices are still checked, they just never link accounts into a farm. Ignored accounts are skipped completely, but still count towards your total spend. window_days is 30 by default: a reasonable guess for how fast farms sign up, not a measured number (see benchmarks/ for what changing it does on the one labeled dataset we have).
No logs handy? luxvigil demo scans fake ones for you, or make your own to play with:
$ luxvigil generate --out sample-logs.csv
How fast is it?
On fake logs, on a small 2-core cloud box with Python 3.13 (python scripts/bench.py 10000 100000 1000000):
| requests | time | peak memory |
|---|---|---|
| 10k | 0.1s | ~30 MB |
| 100k | 1.2s | ~90 MB |
| 1M | 18s | ~740 MB |
About half of that is just reading the CSV. On real logs (WildChat, 2M requests) it took 25s and ~1.2 GB, see benchmarks/. Everything is loaded into memory, so tens of millions of rows need a big machine. Splitting a file doesn't give the same answer (a farm or a key's 24h window can end up cut in two), so if you have to, scan one whole period at a time. Run the script on your own machine to get your numbers.
What's next
- six checks, terminal report, JSON, config
- tested on real data (WildChat, Amazon's fraud benchmark)
- reads LiteLLM spend logs
- LLMjacking: stolen cloud keys running models on your AWS bill (reading CloudTrail / Bedrock logs)
- spotting traffic that's too fast to be human
- more formats: Helicone, OpenAI usage exports
- a Markdown / HTML report to share with your team
Want one of these sooner, or something else? Open an issue. Pull requests welcome too, see CONTRIBUTING.
Why "luxvigil"?
Lux = light, vigil = keeping watch through the night. It keeps an eye on what happened while you weren't looking.
License
Apache-2.0. Use it, change it, ship it, just keep the notice.
The list of throwaway email domains bundled with luxvigil comes from disposable-email-domains, which is public domain (CC0).
Built by @polfananas
Metadata
Release files for luxvigil 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| luxvigil-0.3.0.tar.gz | 151.1 kB | With provenance | Details for luxvigil-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| luxvigil-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for luxvigil-0.3.0-py3-none-any.whl |
Total release size: 267.7 kB
Release files / luxvigil-0.3.0.tar.gz
| Download URL | luxvigil-0.3.0.tar.gz |
|---|---|
| Size | 151.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c96cc12b563a3cce45368ed29c7e6b56267602db639c60f5d43ac0b75fa8f9f7
|
|
BLAKE2b-256 checksum How to use checksums |
e0f5deec18a6dd391e9ca324a0e34d7304ce523f479bae5786dca04a537e4c78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / luxvigil-0.3.0-py3-none-any.whl
| Download URL | luxvigil-0.3.0-py3-none-any.whl |
|---|---|
| Size | 116.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
53ce335f65ae5e95c84d2f2e9532ff5c9e57a3c1e984fe1c46d65a78d88e61ea
|
|
BLAKE2b-256 checksum How to use checksums |
703c704e348804f7dd7b207b0bf794597e69ee2de15d0549e0af3b8c17bf2538
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logSecurity for luxvigil 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for luxvigil-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.