Usage limits for APIs and agents
Stop the runaway integration.
Enforce your plans on each customer's integration or agent, with its own allowance and its own log.
A deny stops that key only.
Paste into your coding agent. It adds one usage check in shadow mode, using a test key.
Setup prompt · 2,170 chars
Ordainer is free during the beta: sign up for test keys with 1,000 decisions a month, no credit card needed.
nightly-sync is over its plan. chat-assistant and report-builder are still within theirs.
nightly-sync is over its plan. The other keys keep working.
- SDKsNode, Python, Ruby, Java
- Roll-outShadow mode before you enforceShadow, then enforce
- AuditEvery decision logged
- Your trafficStays on your servers
The problem
Their integration or agent blows past the plan. You find out on the invoice.
Your pricing page says 500 calls a month on the pilot plan. Scripts and AI agents don't read pricing pages. They retry, loop and run overnight, and one customer may run several of them.
When usage runs past the plan, the usual options are all bad:
The integration or agent that's over gets a clear no before your tool runs. The same customer's other integrations and agents keep working.
Free APIs
Your API is free. Your customers' integrations and agents still need limits.
When one customer's AI agent or sync job loops, an account-wide limit or a suspended key stops their billing, scheduling or accounting integrations too. Give each integration or agent its own agent key and allowance. Ordainer Cap says no to the one that's over, before your API does the work, and that deny doesn't cut off the customer's other integrations. Start in shadow mode to see which ones would go over, then switch to enforce when the numbers look right.
How it works
Three steps. One call in your code.
One call before your tool runs checks that caller's plan and counts the use. Over the limit, only that integration or agent is stopped, and your code sends it a plain message saying why. Every decision leaves a row you can export, so you can show a customer exactly what happened.
-
We issue an agent key to each integration or agent.
Each of your customers' integrations and agents gets its own agent key, tied to one customer and one plan. A plan is a limit on allowed calls each month, day or minute, for one tool or for every tool. Each key counts on its own, even when several keys share a plan.
-
Your handler asks first.
Before any work, send the caller's agent key and the tool name to
decide(). We answer allow or deny and count it in the same step. On a deny, the work doesn't run. -
Roll out safely.
New plans you create start in shadow mode: we log what we would have blocked and block nothing. Switch to enforce in the console when the numbers look right, with no deploy unless your code pins the mode. With our Node, Python, Ruby and Java SDKs, you choose per tool what happens if we're slow to answer: the call runs (the default) or it's blocked.
Where Ordainer sits.
In front of your product. Not inside it. Not instead of the bill.
-
YOUR CUSTOMER’S INTEGRATION OR AI AGENT
Asks your product to do work.
-
ORDAINER
Yes or no, before the work.
This key · this plan · this customer.
The check, not a gatewayYour traffic never routes through us.
-
YOUR PRODUCT
Does the work after a yes.
A deny stops that one integration or agent, not the whole customer.
-
THE BILL
Invoice goes out as it does today.
Not us. Still your billing.
DecisionOne allow-or-deny answer from decide(). Your free sandbox includes 1,000 allowed test decisions a month. Denies don't count.
Live demo · No sign-up
Produce a deny.
Say you sell a research tool, research.run. Your customer Example Co has two AI agents: pilot, capped at 5 calls a day, and production, with plenty of room. Each press below is a real decide() call, and each one writes a real audit row. Three different numbers, so they don't get mixed up: this demo's pilot plan allows 5 calls a day and resets each day. In your own sandbox, the pilot test key starts at 5 allowed calls a month (UTC). Your sandbox as a whole has 1,000 allowed test decisions a month. Presses here don't count toward either.
Press it six times. Calls 1 to 5 are allowed. Call 6 isn't.
Show me the request
# The same call this demo makes.
curl -s -X POST https://api.ordainer.dev/demo/decide \
-H "Content-Type: application/json" -d '{"key":"pilot"}'
Run it six times. Demo keys only work on this toy tool. Your sandbox gives you your own test keys for POST /v1/decide.
- No decisions yet.
Each line is one decision: the answer, the integration or agent, calls left today, the reason, and the request ID of its audit row.
Your sandbox comes with two test keys (one capped, one with no plan cap). Both share 1,000 test decisions a month.
Get test keysDemo presses are logged like real decisions. To give each visitor their own counters and to stop abuse, we keep a hashed version of your network address.
Pricing
Free while we're in beta.
Ordainer is free during the beta: sign up for test keys with 1,000 decisions a month, no credit card needed.
FAQ
Common Questions
What does early access mean?
The free sandbox is open now: sign up, get test keys and produce your first deny. Prefer our Node SDK? Install it with npm install ordainer, or call the HTTP API from any language.
What happens if you're down?
By default, our Node, Python, Ruby and Java SDKs let your tool run if we can't answer in time, and log a warning. Where an unchecked call is worse, you can set that tool to block instead. With plain HTTP, your handler decides what to do. See Fail open vs fail closed.
How much latency does it add?
One HTTPS call before your handler runs. We'll publish numbers once we've measured them, and we won't quote one before then.
Do denies count toward the sandbox limit?
No. In the free sandbox, only allowed decisions count toward the 1,000 a month, and denies don't count. When those are used up, test keys in enforce mode answer deny until the 1st (UTC). In shadow mode, calls still run and are logged as would-deny.
Will Ordainer Cap stay free?
The beta is free. When it ends, you'll still have a free plan with normal limits. We'll check with beta teams before we set prices for paid plans, and we'll email you at least 30 days before the beta ends or our prices or terms change.
Can one limit cover all of a customer's integrations and agents?
Not today. Plan caps count per agent key. If two keys share a plan, each gets the full cap, so that customer can use twice the cap. That holds for monthly, daily and per-minute plans. Give each integration or agent its own key, so a deny stops only that caller. Separate from plan caps: during the beta, all test keys in your organization share one allowance of allowed test decisions a month, 1,000 on a standard sign-up.
Do we have to change our billing system?
No. Keep your existing billing system. Ordainer doesn't send usage to your billing system today. You can export your decisions as CSV or JSON from the console. An export covers your whole account. Before you share one with a customer, keep only that customer's rows.
What do you see of our traffic?
The tool name, the agent key, and, if you send them, an idempotency key, a mode or a session lease. Never your request payloads. Like any web service, we also receive connection details such as IP addresses.
How do I set per-key usage caps?
Give each integration or agent its own agent key, on a plan. Ordainer counts usage per key, for one tool or for every tool, each month, day or minute. Several keys can share a plan, but each key's count is its own. In enforce mode, a deny stops that key only.
How do I stop an agent burning a customer's API allowance?
Give that agent its own key and cap. In enforce mode, when the key reaches its plan cap, decide() answers deny and only that key is stopped; the customer's other integrations keep running. In shadow mode, plan and test-limit denies are logged as would-deny and the call still runs. Ordainer counts allowed calls per key, not dollars, and it isn't a rate limiter.
How do I cap usage for an MCP server per client or per agent?
Give each MCP client or agent its own agent key. In your tool handler, call decide() with that key before the tool runs. That is a per-key usage cap, not a rate limiter, so keep your own rate limits for traffic spikes.
Does it work with MCP?
Yes. At the top of each MCP tool handler, call decide() with the agent key of the client or agent that's calling, and the tool name. On a deny in enforce mode, return the reason to the caller and skip the work. That call is a plain HTTPS request, and it works from any language. There's also an Ordainer MCP server for your AI coding agent: it sets up customers, plans and test keys, and reads usage and decisions. Run it with npx -y ordainer-mcp@0.1.1, and see the MCP docs at https://docs.ordainer.dev/mcp/.
Which languages?
Anything that can make an HTTPS request. The docs have curl, Python, Node, Ruby and Java examples. Our Node SDK (npm install ordainer) includes Express middleware, our Python package (pip install ordainer) has a Python quickstart, our Ruby gem (gem install ordainer) has a Rails quickstart, and our Java SDK (ai.ordainer:ordainer on Maven Central) has a Java quickstart. Need another language? Email support@ordainer.ai.
Our billing system or gateway already has limits. Do we need you?
If yours already enforces plan limits per integration or agent, you may not. If yours doesn't limit per integration or agent yet, Ordainer Cap is one decide() call in the handler you already have: no products to set up, and your traffic never routes through us.
Why not use a full API management suite?
A full suite can be a good fit if you want one platform for your whole API program. It also means adopting that platform and learning how to set it up. Ordainer Cap does one job. It checks whether one integration or AI agent may do one piece of work, based on the plan you gave it. It is one decide() call in the handler you already have, with no gateway to adopt and no traffic routed through us. If your suite already limits each integration or AI agent the way you need, you may not need us.
We already have a gateway and rate limits. Why add this?
Keep them. They limit how much traffic gets through. Ordainer Cap decides whether one integration or agent may do one piece of work, so you can say no to the one that's over its allowance without cutting off that customer's other integrations. Each new decision writes an audit row you can show the customer.
Our API is free. Is Ordainer Cap for us?
Yes, if one customer's integration or agent can run away. You set an allowance per agent key, and nothing is billed to your customers. A deny stops only that key. Ordainer Cap counts allowed calls per key, each month, day or minute. It isn't a rate limiter, so keep your own rate limits for traffic spikes.
Is this rate limiting?
No. A rate limit protects your servers from traffic spikes. Ordainer Cap enforces the plan you sold: a count of allowed calls per agent key, each month, day or minute. Before the work runs, your handler calls decide() with the caller's agent key and tool name. We answer allow or deny, and each new decision writes one audit row. Keep your own rate limits for spikes.
Can it control the cost of AI-agent traffic? Can it cap spend in dollars?
It caps calls, not dollars. If each call costs you money, give each integration or AI agent its own agent key and a cap on allowed calls. In enforce mode, a call over the cap is denied before the work runs, so that key's cost stops there. Only allowed calls count. Denies don't. To see which keys would go over before you block anyone, start in shadow mode.
Does our traffic go through you?
No. The SDK sends only the agent key, the tool name and, if you set them, an idempotency key, a mode or a session lease, never your payload. If we're slow or unreachable, the SDK stops waiting after a short timeout. By default it lets the call run, and you can set it to block instead.