upstash/ratelimit-js

Dynamic token cost on Ratelimit.tokenBucket algorithm

norberto-e-888 opened this issue · 3 comments

Is there a way to dynamically calculate how many tokens a request should cost?

Check this script: https://github.com/upstash/ratelimit/blob/c509628a6c1490121d810822ce7c880ddb02c44c/packages/sdk/src/single.ts#L284

It's either 3 or 4, depending on whether the bucket exists and its state

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

This issue was closed because it has been stalled for 30 days with no activity.