rateLimitInformationFromHeaders static method
Parses the rate limit information from the headers
Implementation
static GroqRateLimitInformation rateLimitInformationFromHeaders(
Map<String, String> headers) {
return GroqRateLimitInformation(
totalRequestsPerDay:
int.tryParse(headers['x-ratelimit-limit-requests'] ?? '0') ?? 0,
remainingRequestsToday:
int.tryParse(headers['x-ratelimit-remaining-requests'] ?? '0') ?? 0,
totalTokensPerMinute:
int.tryParse(headers['x-ratelimit-limit-tokens'] ?? '0') ?? 0,
remainingTokensThisMinute:
int.tryParse(headers['x-ratelimit-remaining-tokens'] ?? '0') ?? 0,
);
}