This release is a pre-release and may not be stable for production use.
limitry
The Limitry Python SDK puts a limit around costly work in a with block: guard checks before the block runs, and hold reserves an estimate, then charges what the work actually cost. Every API operation is a typed method too, sync or async.
Limitry is the limits, credits and budgets layer for your software: give each of your users, teams, tenants, API keys or agents an allowance, and before any costly action one call tells your code whether it may happen.
Install
pip install limitry
Needs Python 3.10 or later. Set LIMITRY_API_KEY to a key from API
keys in the app. Use a test key (lim_test_…) while you build.
Guard costly work
guard checks the limit, then runs the block only if it's allowed.
Here it counts one AI call against a limit such as 100 a day:
from limitry import LimitExceeded, Limitry
limitry = Limitry() # reads LIMITRY_API_KEY
try:
with limitry.guard(subject={"kind": "user", "id": "usr_123"}, action="ai-call"):
reply = call_model(prompt)
except LimitExceeded as error:
print(f"Try again in {error.retry_after_seconds} seconds")
Charge what it actually cost
When you only know the cost afterwards, such as an AI reply priced by
the token, hold reserves an estimate (5 cents here), runs the block
and charges what it used. If the block raises, the hold is released:
from limitry import Limitry
limitry = Limitry()
with limitry.hold(
subject={"kind": "user", "id": "usr_123"}, action="ai-call", estimate=5
) as held:
response = call_model(prompt)
held.cost(price_cents(response.usage)) # your prices, in cents
If Limitry can't be reached, each limit's fail mode decides: open lets
the work run, closed refuses it.
Everything else
Every API operation is a typed method, named like its CLI command:
limitry limits create is limitry.limits.create(). For asyncio, use
AsyncLimitry.
from limitry import Limitry
limitry = Limitry()
limitry.limits.create(
name="AI replies per day",
subject_kind="user",
action="ai-call",
amount=100,
window="day",
)
A failure raises ApiError with the error's code, message, status
and request_id.
Links
About this package
This repository is generated from Limitry's source on each release, so pull requests are ported there and credited (see CONTRIBUTING.md). Licensed under the Apache License 2.0.
Metadata
Release files for limitry 1.0.0rc3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| limitry-1.0.0rc3.tar.gz | 25.8 kB | With provenance | Details for limitry-1.0.0rc3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| limitry-1.0.0rc3-py3-none-any.whl | Python 3 | none | any | Details for limitry-1.0.0rc3-py3-none-any.whl |
Total release size: 56.1 kB
Release files / limitry-1.0.0rc3.tar.gz
| Download URL | limitry-1.0.0rc3.tar.gz |
|---|---|
| Size | 25.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ef99117e8cb77b72cab4a4fa161bdff9e3ca0b27a09a86a021584fc984e6602
|
|
BLAKE2b-256 checksum How to use checksums |
5eac910a350c44f159e7b55e93aedad242b4af2041753018a267ef08cde56baa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / limitry-1.0.0rc3-py3-none-any.whl
| Download URL | limitry-1.0.0rc3-py3-none-any.whl |
|---|---|
| Size | 30.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
462273b6e03a5ce4ab078431e5f11415c2a6028918a2f5e1c81eccb7a5cb9644
|
|
BLAKE2b-256 checksum How to use checksums |
12f78ff140ae63ed6ae5fc58db1551dca8ba1b2c711045bf44e3ee064b2a1942
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logSecurity for limitry 1.0.0rc3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for limitry-1.0.0rc3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.