groq-rate-limits
/groq-rate-limits
Wdraża limity zapytań Groq, backoff i idempotencję oraz logikę ponowień przy błędach rate limit i optymalizacji przepustowości.
- Autor
- HelixDevelopment ↗
- Repozytorium
- agent ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 14.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 2
Brak sygnałów. Repozytorium zmienione 14.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Wdraża limity zapytań Groq, backoff i idempotencję oraz logikę ponowień przy błędach rate limit i optymalizacji przepustowości.
Wyzwalacze z opisu
Oryginalny opis (EN)
Implement Groq rate limiting, backoff, and idempotency patterns. Use when handling rate limit errors, implementing retry logic, or optimizing API request throughput for Groq. Trigger with phrases like "groq rate limit", "groq throttling", "groq 429", "groq retry", "groq backoff".
Jak działa
- Overview
- Prerequisites
- Instructions
- Output
- Error Handling
- Examples
- Resources
- Next Steps
Podgląd SKILL.md
---
name: groq-rate-limits
description: |
Implement Groq rate limiting, backoff, and idempotency patterns.
Use when handling rate limit errors, implementing retry logic,
or optimizing API request throughput for Groq.
Trigger with phrases like "groq rate limit", "groq throttling",
"groq 429", "groq retry", "groq backoff".
allowed-tools: Read, Write, Edit
version: 1.0.0
license: MIT
author: Jeremy Longshore <jeremy@intentsolutions.io>
---
# Groq Rate Limits
## Overview
Handle Groq rate limits gracefully with exponential backoff and idempotency.
## Prerequisites
- Groq SDK installed
- Understanding of async/await patterns
- Access to rate limit headers
## Instructions
### Step 1: Understand Rate Limit Tiers
| Tier | Requests/min | Requests/day | Burst |
|------|-------------|--------------|-------|
| Free | 60 | 1,000 | 10 |
| Pro | 300 | 10,000 | 50 |
| Enterprise | 1,000 | 100,000 | 200 |
### Step 2: Implement Exponential Backoff with Jitter
```typescript
async function withExponentialBackoff<T>(
operation: () => Promise<T>,
config = { maxRetries: 5, baseDelayMs: 1000, maxDelayMs: 32000, jitterMs: 500 }
): Promise<T> {
for (let attempt = 0; attempt <= config.maxRetries; attempt++) {
try {
return await operation();
} catch (error: any) {
if (attempt === config.maxRetries) throw error;
const status = error.status || error.response?.status;
if (status !== 429 && (status < 500 || status >= 600)) throw error;
// Exponential delay with jitter to prevent thundering herd
const exponentialDelay = config.baseDelayMs * Math.pow(2, attempt);
const jitter = Math.random() * config.jitterMs;
const delay = Math.min(exponentialDelay + jitter, config.maxDelayMs);
console.log(`Rate limited. Retrying in ${delay.toFixed(0)}ms...`);
await new Promise(r => setTimeout(r, delay));
}
}
throw new Error('Unreachable');
}
```
### Step 3: Add Idempotency Keys
```typescript
import { v4 as uuidv4 } from 'uuid';
import crypto from 'crypto';
// Generate deterministic key from operation params (for safe retries)
function generateIdempotencyKey(operation: string, params: Record<string, any>): string {
const data = JSON.stringify({ operation, params });
return crypto.createHash('sha256').update(data).digest('hex');
}
async function idempotentRequest<T>(
client: GroqClient,
params: Record<string, any>,
idempotencyKey?: string // Pass existing key for retries
): Promise<T> {
// Use provided key (for retries) or generate deterministic key from params
const key = idempotencyKey || generateIdempotencyKey(params.method || 'POST', params);
return client.request({
...params,
headers: { 'Idempotency-Key': key, ...params.headers },
});
}
```
## Output
- Reliable API calls with automatic retry
- Idempotent requests preventing duplicates
- Rate limit headers properly handled
## Error Handling
| Header | Description | Action |
|--------|-------------|--------|
| X-RateLimit-Limit | Max requests | Monitor usage |
| X-RateLimit-Remaining | Remaining requests | Throttle if low |
| X-RateLimit-Reset | Reset timestamp | Wait until reset |
| Retry-After | Seconds to wait | Honor this value |
## Examples
### Queue-Based Rate Limiting
```typescript
import PQueue from 'p-queue';
const queue = new PQueue({
concurrency: 5,
interval: 1000,
intervalCap: 10,
});
async function queuedRequest<T>(operation: () => Promise<T>): Promise<T> {
return queue.add(operation);
}
```
### Monitor Rate Limit Usage
```typescript
class RateLimitMonitor {
private remaining: number = 60;
private resetAt: Date = new Date();
updateFromHeaders(headers: Headers) {
this.remaining = parseInt(headers.get('X-RateLimit-Remaining') || '60');
const resetTimestamp = headers.get('X-RateLimit-Reset');
if (resetTimestamp) {
this.resetAt = new Date(parseInt(resetTimestamp) * 1000);
}
}
shouldThrottle(): boolean {
// Only throttle if low remaining AND reset hasn't happened yet
return this.remaining < 5 && new Date() < this.resetAt;
}
getWaitTime(): number {
return Math.max(0, this.resetAt.getTime() - Date.now());
}
}
```
## Resources
- [Groq Rate Limits](https://docs.groq.com/rate-limits)
- [p-queue Documentation](https://github.com/sindresorhus/p-queue)
## Next Steps
For security configuration, see `groq-security-basics`.
Wersje
W bazie nie ma innych skilli o nazwie groq-rate-limits.
Migawka bazy z 13.11.2026 · wersja paczki e71f729fe537 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 1 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 95framer-rate-limits
Wdraża w integracjach z Framerem limity zapytań, backoff i idempotencję: obsługę błędów 429, logikę ponowień i optymalizację przepustowości zapytań API. - 100firecrawl-rate-limits
Wdraża limity zapytań, backoff i idempotencję w FireCrawl oraz obsługę błędów limitów i logikę ponowień. - 100fireflies-rate-limits
Wdraża limity zapytań, backoff i idempotencję w Fireflies.ai oraz obsługę błędów limitów i logikę ponowień. - 100hex-rate-limits
Wdraża limity zapytań Hex: backoff, ponawianie i idempotentność, przy obsłudze błędów 429 i optymalizacji przepustowości API.