Every time I needed rate limiting in a Python service, the answer was the same: add Redis. Just to count requests.
So I built Flint. Embedded, persistent, zero infrastructure.
pythonimport flint
limiter = flint.Limiter(data_dir=".flint")
limiter.limit("api:user-42", rate=100, per="1m")
if limiter.allow("api:user-42"):
process_request()
Counters persist in .flint/ and survive restarts. Something no in-memory solution does.
What makes it different
SlowAPI resets on restart. Redis requires infrastructure. nginx only works at HTTP layer.
Flint is persistent, embedded, and works anywhere — including AI APIs with cost-based limiting:
pythonresult = limiter.check("ai:user-42", cost=250)
FastAPI middleware, Prometheus export, millisecond precision, and atomic multi-limit checks included.
Core is Rust via PyO3. Token bucket check: ~560µs.
bashpip install flint-limiter
Top comments (0)