Here is an example how octokit does: https://www.npmjs.com/package/@octokit/plugin-throttling?activeTab=readme