Gateway, which adds four things on top of a plain client:
- SessionPool: N sessions with round-robin, least-loaded checkout and automatic cooldown when a slot is rate-limited or blocked.
- CacheStore: repeat reads are served from cache instead of being re-fetched.
- GlobalRateLimiter: caps per-host throughput across every slot.
- Request coalescing: N parallel identical reads trigger exactly one upstream fetch.
Create a gateway
Seed the session pool
Seed the pool with your own accounts.Share state across processes
The in-memory cache and limiter are per-process. To share state across processes or regions, implement theCacheStore interface with Redis and inject it with createGateway({ cache }).