A credential broker is one answer to a pattern that keeps repeating: infrastructure providers get breached, and attackers walk off with their customers’ AI keys. A developer has now released an open-source broker that keeps real keys on infrastructure you control and gives sandboxes only temporary tokens.
Why AI keys are the target
OpenCode, Railway and Northflank were all compromised within a couple of months, and in each case the attackers went after secrets such as AI provider keys. OpenAI, Anthropic and OpenRouter keys can be resold or burned for credits, or used for distillation attacks.
The details differ. Railway described AI provider keys as the main goal of the intrusion and estimates roughly $740,000 in unauthorized spending. Northflank’s attacker scripted searches for strings starting with sk- and sk-ant-. OpenCode warned users that OpenAI and Anthropic keys could have leaked from an old system already being retired. In a different case, API keys turned up in Notion AI chat transcripts held by Fireworks.
Providers revoke and rotate afterward, but that happens after the key is already gone.

Why a secrets proxy isn’t enough
A few sandbox providers now sell a secrets proxy, which hides the key from the agent itself. The developer’s objection is that the provider still stores the key, and the provider is where recent incidents began. Established clouds such as AWS, GCP and Cloudflare get more trust for long-lived credentials than budget sandbox services with short track records.

How the broker works
The broker holds the real keys, encrypted, and runs somewhere you control, such as a Cloudflare Worker in your own account. The app in the sandbox receives a short-lived grant: a temporary token and a base URL pointing at the broker. You use it like a normal API key. Access ends when the grant runs out or you cancel it.
Supported services include OpenRouter, Anthropic, OpenAI and GitHub, plus any HTTPS API that authenticates with a key. Grants last from one second to seven days.
Roles are split. Whatever creates your sandboxes, whether a laptop, server or CI job, can only issue grants. Adding or rotating real keys needs a separate admin login that shouldn’t go to an agent. A leaked issuing credential lets someone use your connected services until you rotate it, though the real keys stay out of reach.
The trade-off
No broker is a perfect answer, and this credential broker doesn’t claim to be one.
The grant does sit in the sandbox’s environment. If the provider is breached, an attacker gets a placeholder that works only through your broker, limited to the services you enabled, and good only until it lapses or you cancel it. That’s far better than rotating every model key you own. Network controls such as Cloudflare Tunnel, Tailscale, ngrok or IP filtering can lock the broker down further.
A credential broker also keeps rotation simple, because only one place ever holds the real keys. Fuller open-source options exist, including Varlock, along with some open-core products. The developer wanted something simple and focused, and advises against trusting the broker blindly either. It’s open source, so you can read the code first.
Setting it up
The prerequisites are Bun, Node.js 22 or newer, an OpenRouter key and a Cloudflare account permitted to deploy Workers and Durable Objects. Clone the repository, run the deploy setup, and it prints the admin and issuer keys once. Store both in a password manager and point the deploy file at references to them, not the keys themselves. The encryption key never leaves the Worker.
Then add OpenRouter through the integration setup command and issue a grant with a command such as one that sets a 15-minute time to live. The output includes a grant ID, a base URL and a token that begins with bsg_.
What comes next for key security
The broker is a stopgap. The longer-term fix is probably workload identity and short-lived tokens across the board, but most model providers aren’t there yet. Until they are, a credential broker keeps one more incident report from forcing a full key rotation.
Source: neonronin