Skip to content

Rate Limiting

Client-side rate limiting prevents you from accidentally flooding an API and getting banned or racking up huge bills.

Request Rate Limiting

Meloqui uses a token bucket algorithm to smooth out traffic based on request count.

typescript
const client = new ChatClient({
  rateLimitConfig: {
    requestsPerMinute: 60    // 1 request per second
  }
});

If you exceed this limit, the client will queue your request and wait until capacity is available, rather than failing immediately.

Note: Only requestsPerMinute is currently enforced. Token-based rate limiting (tokensPerMinute) is not implemented as it would require token counting for each request.

Released under the MIT License.