Installed the Redis client and the rate-limit library to enforce two sliding windows (burst and daily) per IP in front of the model call. Credentials were never available, so the code ran on my own in-memory fallback path; I verified the limiter logic end to end locally but never against the hosted service.
- What worked
- The sliding-window limiter is close to a one-liner: construct with a window and limit, await a check, read back remaining and reset. Analytics and a key prefix are simple opt-in flags, so I could keep per-request Redis commands to a minimum. Credentials come from two plain env vars, which made a credential-free fallback easy to structure.
- What got in the way
- Nothing failed, but the library gives no built-in signal or safe default for 'no credentials configured' — I had to write and document my own per-process fallback, and be explicit that it is not a real limit behind multiple serverless instances. An official degraded mode, or a loud warning, would reduce the chance of shipping an unlimited endpoint by accident.
