More screenshots
Works with the AI Agents you already use
AI API Key Proxy with Spend Limits
by Dem Engies
Builds or reviews a Cloudflare Worker that keeps your Claude API key off users' devices, limits spending, and tests it locally with a fake AI service. For the Anthropic Messages API only.
$8
AI API Key Proxy with Spend Limits
Example session with this skill installed
Review this AI proxy: can users get around the spending limits or get at my API key? Test it. Don't change the proxy's code.
- Read your context and instructions
- Compiled the ai api key
Shortened from a test run on a sound practice proxy, after the user approved the test plan:
Your API key didn't leak and the dollar limits held, but one person can get many user limits.
| Severity | Problem found |
|---|---|
| High | The per-user limit only limits each sign-up token, and anyone can get more without signing in |
| Medium | Someone with many addresses can block new sign-ups for the day |
| Low | Refused calls cost the user nothing and have no rate limit |
| Low | Retrying a failed call can use more allowance |
One user, 200 requests at once: 31 reached the fake AI service, costing $0.019685 of a $0.02 limit. A deliberately unsafe test copy let all 200 through, so the test can fail.
Fake key: not found in 3,155 responses or 19 server logs.
Local tests reduce risk, but they don't prove the proxy is secure or guarantee a maximum bill. Set a spending limit with your AI provider and use a separate key.
Connects securely to your tools. The creator never sees your data.
About this skill
Putting an AI API key in a mobile or web app exposes it. A proxy hides it, but a limit that is checked before a request and charged afterwards can be beaten by sending many requests at once.
This skill has your agent build or review a Cloudflare Worker that sets money aside before each AI request, then try to break it on your computer.
What it covers
- Per-user and whole-service spending limits using Durable Objects
- A worst-case amount reserved per request, then settled to the actual cost
- What to charge after timeouts, errors, unreadable replies and early disconnects
- Allowed models and request options, so users can't choose unpriced extras
- Key handling, signed user tokens and registration limits
- Local tests against a fake AI service: parallel requests, forged tokens, cost loopholes and key leaks, plus a check that the parallel test can fail
You stay in control. It shows a plan and waits before installing packages, adding files or changing code. Deploying, setting secrets, calling the real AI service and touching your Cloudflare account each need separate approval.
How it was tested (November 2026, Linux, local only, fake key and fake AI service)
- Review of a practice proxy with 10 planted problems: found all 10 and left the proxy code unchanged.
- Building a new proxy (text only, one model): its 35 tests passed, including parallel-request tests.
- Fresh review of that new proxy: found no way past the dollar limits and no key leak. It reported that anonymous users can collect extra allowances by signing up again.
- A separate attack script on a copy of the new proxy did not break the 8 things it tried.
These are small practice projects. The skill did not deploy anything or call the real AI service. It ships instructions only: your agent writes the code for your project.
Scope: Cloudflare Workers and the Anthropic Messages API only. Not OpenAI or other providers.
- Cloudflare Workers and the Anthropic Messages API only. Other hosts and AI providers are not covered.
- It cannot guarantee security or a maximum bill. Prices and provider or Cloudflare behaviour can differ from local tests. Set a spending limit with your AI provider and use a separate API key for each app.
- Testing used a fake AI service. Real token counts, billing and the requests a built proxy sends were never checked against the real API.
- Behaviour when a user disconnects, and other live Cloudflare behaviour, may differ from local tests.
- With anonymous sign-up, one person can get extra allowances. Limits on sign-ups slow this but don't stop it; a real sign-in is much stronger.
- The amount reserved per request relies on assumptions about token counts. Check them for your features. Images, documents, tools and streaming need extra design and were not part of the practice builds.
- Tested on Linux with small practice projects. Deployment was not tested.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 5 days ago
- Software
Node.jsnpm access to install Wrangler
- Optional
Cloudflare account (to deploy)
Anthropic API key (to deploy)
Local tests use a fake key and a fake AI service. Looking up current prices needs web access.
Permissions
Allowed Hosts
Runs local servers on 127.0.0.1. Asks before installing or changing anything. The instructions tell the agent not to open existing secret files.
What's inside
Frequently Asked Questions
New in Security
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.