Ratelimiter

Data & APIs

In-memory sliding window rate limiter for AI agents. Create rate limits per API key, check quota before calling, consume requests, reset, and list all limits. Keeps agents from hitting rate limits on external APIs.

Install

openclaw skills install gh-ratelimiter

RateLimiter

Track and enforce rate limits so your agent doesn't get throttled.

Start the server

uvicorn ratelimiter.app:app --port 8012

Create a rate limit

curl -s -X POST http://localhost:8012/v1/limits \
  -H "Content-Type: application/json" \
  -d '{"key": "openai-api", "max_requests": 60, "window_seconds": 60}' | jq

Check before calling

curl -s http://localhost:8012/v1/check/openai-api | jq '.allowed'

Consume after calling

curl -s -X POST http://localhost:8012/v1/consume/openai-api | jq

Returns allowed (true/false), remaining, and retry_after_seconds (how long to wait if exhausted).

List all limits

curl -s http://localhost:8012/v1/limits | jq

Reset quota

curl -s -X POST http://localhost:8012/v1/reset/openai-api | jq

Delete a limit

curl -s -X DELETE http://localhost:8012/v1/limits/openai-api | jq

Endpoints

MethodPathDescription
POST/v1/limitsCreate/update a rate limit
GET/v1/limitsList all rate limits
GET/v1/check/{key}Check if next request is allowed
POST/v1/consume/{key}Use one request from quota
POST/v1/reset/{key}Reset quota to full
DELETE/v1/limits/{key}Delete a rate limit