Elegant Wolves Labs

AI API key spend caps belong on every key you own

Man in glasses reviewing his laptop late at night in a dark office

Railway published its full incident report on November 10, and the detail we keep coming back to is the target. The attacker's database queries went looking for AI provider keys by name, the credentials for paid model APIs. Stolen keys ran up an estimated $740,000 in usage before they were shut off. If you build with model APIs, AI API key spend caps should sit next to rotation and secret storage on your checklist, because a leaked key now turns into a bill within hours.

The Railway report says the intruder chained several exploits, moved through internal systems and decrypted environment variables for at most 1.85% of workspaces, about 100,000. Railway believes the keys were passed to services that resell model access for distillation, and it says OpenCode, Warp, Fireworks AI and others disclosed similar thefts between October 6 and 23. BleepingComputer reports that Railway is asking providers to refund the charges and will cover what they won't.

So the customer did nothing wrong here. Their key sat where the platform told them to put it. The damage still landed on their account, and the size of it depended mostly on whether anything stopped the spending.

Set AI API key spend caps before you need them

Simon Willison made the case in October that pay-per-use services need default hard budget caps, meaning the service cuts off and returns errors after a set amount, not a warning email. We agree, and we'd go a step further for small teams. Give every app, environment and agent its own key. Put a monthly hard limit on each one, sized to a bad week of normal use rather than a theoretical peak. Keep production keys out of build logs and shared dashboards, and rotate them on a schedule you'd follow anyway, not only after an incident.

A cap won't stop a breach, and a cutoff will break a feature for a while. That trade is fine. A failing chatbot for an afternoon is a support ticket. A five-figure bill on a stolen key is a week of calls with your provider, and maybe a refund you never see.

Worth checking this week: which of your AI keys have no limit at all, and who would notice first if one started spending at 3 a.m.?