Agent leaked his API key and burned ~$100: he built a dual-user gateway to isolate credentials

Imaginary_Dinner2710 · reddit · 2026-09-07

A Reddit user recounts losing $100 after handing his agent an API key: four days into using OpenClaw via OpenRouter, he found logs full of unrelated Chinese-language requests — someone else was using his key, and he had even raised his own spending limit for them. His takeaway: any real key an agent can read is a key it can copy.

He also distrusts browser access: he asked Grok Bot if it could read his passwords, got a "no", then a confession it can access session data but "promises" not to leak — security by promise, not by architecture.

Over months he built (and is now open-sourcing) a setup where the agent runs as one Linux user while a separate user holds keys and runs a gateway; API calls use placeholder credentials the gateway swaps for real ones; CLI wrappers and brokers handle Git, psql, Stripe webhooks, Apify and Cloudflare; OS permissions and network rules block the agent from reading credential files or bypassing the gateway. When the agent tries to read the real key, the OS refuses.

Related event: Developer Loses $100 After Handing API Key to Agent, Rebuilds Security Setup(2 posts)→

Original post →

More from coding & agent

coding & agent channel →