Quickstart
By the end of this page you’ll have a limit of 100 AI replies a day for each of your users, and a check that counts against it.
1. Create a workspace
Section titled “1. Create a workspace”Sign up, verify your email and create a workspace. Limits, keys and usage all belong to a workspace.
2. Get a test key
Section titled “2. Get a test key”Every workspace has a test side and a live side, and you start in test. Test keys have their own limits and counts, and their checks aren’t billed (see Test and live).
On the dashboard, the Get started card has a Create a test key
button. It creates a key that starts with lim_test_ and can manage
limits and make checks. Copy the secret now, because it’s shown only
once. Keep it in your secret manager or environment, not in code.
export LIMITRY_API_KEY="lim_test_…" # the SDKs read thisexport LIMITRY_TOKEN="$LIMITRY_API_KEY" # the CLI reads thisOnly workspace owners can create keys. You can also create one under
Settings → API Keys, while the app shows test (the Test |
Live toggle at the top right). Choose Custom, then, under Limits
and checks, set Limits to View and change and Checks to Use
(limits:read, limits:write and checks:write).
Then install the client you’ll use (curl needs nothing):
npm install @limitry/sdkpip install limitrynpm install -g @limitry/cli3. Create a limit
Section titled “3. Create a limit”In the app, open Limits (in test) and add one: 100 replies per
day, for subjects of kind user, action ai-call. Or from your
code or a terminal:
import { createClient } from "@limitry/sdk";
const limitry = createClient(); // reads LIMITRY_API_KEY
await limitry.limits.create({ name: "AI replies per day", subject: { kind: "user" }, action: "ai-call", amount: 100, unit: "replies", window: "day",});from limitry import Limitry
limitry = Limitry() # reads LIMITRY_API_KEY
limitry.limits.create( name="AI replies per day", subject={"kind": "user"}, action="ai-call", amount=100, unit="replies", window="day",)limitry limits create --name "AI replies per day" --subject '{"kind":"user"}' \ --action ai-call --amount 100 --unit replies --window daycurl -X POST https://api.limitry.com/v1/limits \ -H "Authorization: Bearer $LIMITRY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"name":"AI replies per day","subject":{"kind":"user"},"action":"ai-call", "amount":100,"unit":"replies","window":"day"}'It applies to every subject of kind user, in test, from the next
check. With the CLI, try it (this counts as one call):
limitry check user:usr_123 ai-call# Allowed. AI replies per day: 99 replies left, resets 2026-10-06T00:00:00.000Z4. Check before the work
Section titled “4. Check before the work”Ask whether user usr_123 may make one AI call:
import { createClient } from "@limitry/sdk";
const limitry = createClient();
const answer = await limitry.checks.create({ subject: { kind: "user", id: "usr_123" }, action: "ai-call",});from limitry import Limitry
limitry = Limitry()
answer = limitry.checks.create( subject={"kind": "user", "id": "usr_123"}, action="ai-call",)limitry check user:usr_123 ai-callcurl -X POST https://api.limitry.com/v1/checks \ -H "Authorization: Bearer $LIMITRY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"subject":{"kind":"user","id":"usr_123"},"action":"ai-call"}'The answer:
{ "id": "chk_…", "allowed": true, "reason": null, "limits": [ { "limitId": "lmt_…", "name": "AI replies per day", "unit": "replies", "window": "day", "rolling": false, "failMode": "open", "remaining": 99, "resetsAt": "2026-10-06T00:00:00.000Z" } ], "retryAfterSeconds": null}After 100 allowed checks in a day, the next answer is "allowed": false,
with retryAfterSeconds telling you when the user can try again. A “no”
is a normal answer, not an error.
5. Use it from your code
Section titled “5. Use it from your code”In your code, guard wraps the check and the work together, so the work
runs only when it’s allowed (the TypeScript and
Python SDKs):
import { createClient } from "@limitry/sdk";
const limitry = createClient(); // reads LIMITRY_API_KEY
const reply = await limitry.guard( { subject: { kind: "user", id: user.id }, action: "ai-call" }, () => callModel(prompt),);from limitry import Limitry
limitry = Limitry() # reads LIMITRY_API_KEY
with limitry.guard(subject={"kind": "user", "id": user.id}, action="ai-call"): reply = call_model(prompt)If the user is over the limit, guard throws (raises in Python)
LimitReached and the reply is never generated, so you don’t pay for it.
Counting replies is the simplest limit. Replies cost different amounts, so you’ll often also cap what each of your users spends, in cents, and charge each reply at what it actually cost. That’s Limit AI spend per user of your product.
6. Go live
Section titled “6. Go live”When your limits work in test, move them to production:
- On the Limits page, still in test, click Copy to live. Check what it will create, then confirm.
- Switch to Live at the top right and create a live key under
Settings → API Keys. It starts with
lim_live_. - Give your production code the live key. Nothing else changes: the same code now uses live limits and counts toward your plan.
Next, read Checks for everything a check can do, or pick a guide close to what you’re building from the introduction. To show your users how much they have left, see Show users where they stand, and to warn them before they run out, see Warn your users before they hit a limit.