Rate limits
Set the API-key request limits and choose an in-memory or Redis counter backend.
/admin/rate-limits configures API-key traffic: one default limit and overrides for AI generation,
AI status and asset upload. Authentication and webhook protection have separate runtime
paths. This page does not edit their rules.
Before you begin
- An account with
config.readto see the page andconfig.writeto change the backend. See Roles and permissions. - Memory is the default backend. Configure Redis for shared counters across application instances.
Set it up
Look at the rules you already have
Open /admin/rate-limits. The form shows the default limit and three endpoint overrides. These
values are stored in admin config, not in the separate rate_limit_rules audit table.
Pick a backend
Memory counts inside one process. Separate Workers isolates or Node containers each keep their own counters. Select Redis and provide a connection URL to share counters across instances.
The URL is stored as an admin config secret and is never returned to the browser. The page shows only whether a URL is set.
Tune a rule
Set the default request cap and window, then adjust any endpoint-specific caps and windows.
API-key limits on this page
| Key | Endpoint pattern | Default |
|---|---|---|
| Default API-key limit | Other scoped API-key requests | 100 requests per 1-second window |
ai_generate | /api/{scene}/generate | Inherits the default until changed |
ai_status | /api/status | Inherits the default until changed |
assets_upload | /api/assets/upload | Inherits the default until changed |
The form accepts a cap of 1–10,000 requests and a window of 1–3,600 seconds for each entry.
Backend
Prop
Type
When adding a default rule, update defaultRateLimitRules and run insertMissingRateLimitRules. Existing deployments receive the new rule, and operator changes are not overwritten.
Verify
- Open
/admin/rate-limits. Three endpoint overrides and the default API-key limit are listed. - Switch the backend to Redis without a URL. The page rejects the save. It does not fall back to memory.
- Save a Redis URL, reload the page. It reports that a URL is configured and does not display it.
Reference
- Roles and permissions
- API keys: the scopes the verify limit protects
- Redis: the shared counter store