# I gave my agent an API key and lost $100. I’m still pissed off. Never again — retained record

> Retained reddit record from reddit:AI_Agents.

Canonical: https://highsignal.app/data/records/fbe9d66f4b27ca22

[← sources](https://highsignal.app/data)


source: [reddit](https://highsignal.app/data/reddit) (reddit:AI_Agents)  published 2026-09-06 15:57 ingested 2026-09-07 07:15

[original source ↗](https://www.reddit.com/r/AI_Agents/comments/1w8zx24/i_gave_my_agent_an_api_key_and_lost_100_im_still/)

## retained text



```
The bit that really pisses me off is that I had a hard spending limit and raised it myself. Six months ago I was using OpenClaw for computer-use tasks through OpenRouter. It was slow, clumsy and burning through tokens. For the first couple of days I assumed that was just what running an agent cost. Then, four days in, I actually looked at the logs. Nonstop requests in Chinese, nothing to do with my tasks. Someone else was using my key, about $100 was gone, and I had increased their spending allowance for them.

I rotated the key and sat down to figure out how to stop doing this to myself. I still don’t know how it leaked. But putting a real key somewhere the agent can read it means it can also copy it somewhere else. And I want my agents to do more than call a model API. They use Git, run psql queries, debug Stripe webhooks, collect data through Apify and deploy things to Cloudflare. I want them to keep doing that without having the credentials sitting in their workspace.

The browser is where I got especially annoyed. I want the agent to use a logged-in session. I gave it that access on purpose. I don’t want it reading or exporting my passwords and login credentials. Recently I asked Grok Bot whether it could read my passwords. It said no. When I brought up its access to the browser and cookies, it told me it could access session data, but wouldn’t leak anything. Very comforting - should I just believe it?! I’m supposed to trust it because it just promised to behave. I want it unable to read the secrets in the first place.

I’ve spent the last few months building and using a different setup for my own agents. The agent runs under one Linux user; another user holds the keys and runs the gateway. API calls use placeholder credentials, and the gateway inserts the real ones. CLI wrappers and separate brokers handle the other connections. I use OS permissions and network rules to keep the agent from reading the credential files or going around the gateway. I still have to limit what it can do with the access I allow. When it tries to read the real key, I want the operating system to refuse.

I’ve decided to open source the project. The full write-up about the details of the problem and technical solution you can find in the first comment below.
```



document fetched 2026-09-07 00:18 · canonical https://reddit.com/r/AI_Agents/comments/1w8zx24/i_gave_my_agent_an_api_key_and_lost_100_im_still
