Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sebamar88/bytekit/llms.txt
Use this file to discover all available pages before exploring further.
Powered by Mintlify
Auto-generate your docs
Rate limiting for API requests
Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sebamar88/bytekit/llms.txt
Use this file to discover all available pages before exploring further.
import { RateLimiter } from "bytekit";
// or
import { RateLimiter } from "bytekit/rate-limiter";
const limiter = new RateLimiter({
maxTokens: 10,
refillRate: 1,
refillIntervalMs: 1000
});
await limiter.acquire(); // Wait for token
// Make request
import { ApiClient, RateLimiter } from "bytekit";
const limiter = new RateLimiter({ maxTokens: 10, refillRate: 1 });
const api = new ApiClient({
baseUrl: "https://api.example.com",
interceptors: {
request: async (url, init) => {
await limiter.acquire();
return [url, init];
}
}
});