Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Implement Lokalise rate limiting, backoff, and request queuing patterns. Use when handling rate limit errors, implementing retry logic, or optimizing API request throughput for Lokalise. Trigger with phrases like "lokalise rate limit", "lokalise throttling", "lokalise 429", "lokalise retry", "lokalise backoff".
.claude/skills/jeremylongshore-lokalise-rate-limits/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 14% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 59% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 29% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 58% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 101% | 0% |
Lokalise enforces a strict 6 requests per second rate limit across all API endpoints (https://api.lokalise.com/api2). Exceeding this triggers a 429 Too Many Requests response. This skill covers request queuing with 170ms minimum spacing, exponential backoff for 429 recovery, bulk operation throttling, and proactive quota monitoring via response headers.
@lokalise/node-api SDK installed (npm install @lokalise/node-api)AbortController support in timeout handlingEvery Lokalise API response includes rate limit headers:
X-RateLimit-Limit: 6 # Max requests per second
X-RateLimit-Remaining: 4 # Requests remaining in current window
X-RateLimit-Reset: 1700000000 # Unix timestamp when the window resets
Retry-After: 1 # Seconds to wait (only on 429 responses)Always read these headers. Never hardcode assumptions about the window — Lokalise may adjust limits per plan tier.
Space requests at minimum 170ms apart (1000ms / 6 = ~167ms, rounded up). Use p-queue for concurrency control:
typescriptimport PQueue from "p-queue"; const lokaliseQueue = new PQueue({ concurrency: 1, interval: 170, intervalCap: 1, }); async function queuedRequest<T>(fn: () => Promise<T>): Promise<T> { return lokaliseQueue.add(fn, { throwOnTimeout: true }); } // Usage with the SDK import { LokaliseApi } from "@lokalise/node-api"; const lokalise = new LokaliseApi({ apiKey: process.env.LOKALISE_API_TOKEN }); const keys = await queuedRequest(() => lokalise.keys().list({ project_id: "123456789.abcdefgh", limit: 500, page: 1, }) );
When a 429 occurs, honor the Retry-After header first. If absent, use exponential backoff with jitter:
typescriptasync function withBackoff<T>( fn: () => Promise<T>, maxRetries = 5 ): Promise<T> { for (let attempt = 0; attempt <= maxRetries; attempt++) { try { return await fn(); } catch (error: any) { if (error.code === 429 && attempt < maxRetries) { const retryAfter = error.headers?.["retry-after"]; const baseDelay = retryAfter ? parseInt(retryAfter, 10) * 1000 : Math.pow(2, attempt) * 1000; const jitter = Math.random() * 500; const delay = baseDelay + jitter; console.warn( `Rate limited. Attempt ${attempt + 1}/${maxRetries}. ` + `Waiting ${Math.round(delay)}ms...` ); await new Promise((resolve) => setTimeout(resolve, delay)); continue; } throw error; } } throw new Error("Max retries exceeded for Lokalise API request"); }
For operations that process many items (listing all keys, bulk translations), paginate with built-in throttling:
typescriptasync function paginateAll<T>( fetchPage: (page: number) => Promise<{ items: T[]; totalPages: number }> ): Promise<T[]> { const allItems: T[] = []; let page = 1; let totalPages = 1; do { const result = await queuedRequest(() => fetchPage(page)); allItems.push(...result.items); totalPages = result.totalPages; page++; } while (page <= totalPages); return allItems; } // Fetch all keys across pages const allKeys = await paginateAll(async (page) => { const response = await lokalise.keys().list({ project_id: projectId, limit: 500, // max per page page, }); return { items: response.items, totalPages: response.totalCount ? Math.ceil(response.totalCount / 500) : 1, }; });
For bulk key creation, batch into groups of 500 (API limit per request) and queue each batch:
typescriptasync function bulkCreateKeys( projectId: string, keys: Array<{ key_name: string; platforms: string[] }> ): Promise<void> { const batchSize = 500; for (let i = 0; i < keys.length; i += batchSize) { const batch = keys.slice(i, i + batchSize); await queuedRequest(() => lokalise.keys().create({ project_id: projectId, keys: batch, }) ); console.log( `Created keys ${i + 1}-${Math.min(i + batchSize, keys.length)} ` + `of ${keys.length}` ); } }
Track remaining quota and preemptively slow down before hitting the limit:
typescriptlet remainingRequests = 6; let resetTimestamp = 0; function updateQuota(headers: Record<string, string>): void { remainingRequests = parseInt(headers["x-ratelimit-remaining"] ?? "6", 10); resetTimestamp = parseInt(headers["x-ratelimit-reset"] ?? "0", 10); } async function throttleIfNeeded(): Promise<void> { if (remainingRequests <= 1) { const now = Math.floor(Date.now() / 1000); const waitSeconds = Math.max(0, resetTimestamp - now) + 0.5; console.warn( `Quota nearly exhausted (${remainingRequests} remaining). ` + `Pausing ${waitSeconds}s until reset.` ); await new Promise((resolve) => setTimeout(resolve, waitSeconds * 1000) ); } }
X-RateLimit-Remaining drops to 1| Header | Description | Action | |--------|-------------|--------| | X-RateLimit-Limit | Max requests per window (always 6) | Use as concurrency ceiling | | X-RateLimit-Remaining | Requests left in current window | Pause proactively when <= 1 | | X-RateLimit-Reset | Unix timestamp of window reset | Sleep until this time on exhaustion | | Retry-After | Seconds to wait (only on 429) | Always honor this value exactly |
If you receive a 429 without Retry-After, default to 1 second then exponential backoff. Never retry more than 5 times — if consistently rate-limited, your architecture needs request consolidation, not more retries.
typescriptimport { LokaliseApi } from "@lokalise/node-api"; import PQueue from "p-queue"; class RateLimitedLokalise { private api: LokaliseApi; private queue: PQueue; constructor(apiKey: string) { this.api = new LokaliseApi({ apiKey }); this.queue = new PQueue({ concurrency: 1, interval: 170, intervalCap: 1 }); } async request<T>(fn: (api: LokaliseApi) => Promise<T>): Promise<T> { return this.queue.add( () => withBackoff(() => fn(this.api)), { throwOnTimeout: true } ); } } // Usage const client = new RateLimitedLokalise(process.env.LOKALISE_API_TOKEN!); const keys = await client.request((api) => api.keys().list({ project_id: "123456789.abcdefgh", limit: 500 }) );
bash# The lokalise2 CLI respects rate limits internally, but for scripted # loops you need manual spacing: for project_id in $(lokalise2 project list --token $TOKEN --format json \ | jq -r '.[].project_id'); do lokalise2 file download \ --token "$LOKALISE_API_TOKEN" \ --project-id "$project_id" \ --format json \ --dest ./locales/"$project_id"/ sleep 0.2 # 200ms spacing done
For handling specific API errors beyond rate limits, see lokalise-common-errors.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 52,685 | 23,865 | -55% | 1 | 1 | 0% | 5,740 | 6,518 | +14% | 0 | 0 | — |
case-02 | fail→pass | 23,219 | 20,433 | -12% | 1 | 1 | 0% | 3,630 | 5,773 | +59% | 0 | 0 | — |
case-03 | fail→fail | 22,166 | 16,162 | -27% | 1 | 1 | 0% | 4,598 | 5,599 | +22% | 0 | 0 | — |
case-04 | fail→pass | 23,608 | 15,029 | -36% | 1 | 1 | 0% | 3,182 | 4,104 | +29% | 0 | 0 | — |
case-05 | fail→pass | 21,304 | 10,405 | -51% | 1 | 1 | 0% | 2,723 | 4,307 | +58% | 0 | 0 | — |
case-06 | pass→pass | 18,516 | 11,190 | -40% | 1 | 1 | 0% | 2,561 | 3,446 | +35% | 0 | 0 | — |
case-07 | fail→pass | 16,528 | 14,823 | -10% | 1 | 1 | 0% | 2,129 | 4,277 | +101% | 0 | 0 | — |
case-08 | pass→pass | 18,625 | 12,380 | -34% | 1 | 1 | 0% | 2,242 | 3,612 | +61% | 0 | 0 | — |
case-09 | fail→pass | 23,218 | 9,527 | -59% | 1 | 1 | 0% | 773 | 3,141 | +306% | 0 | 0 | — |
case-10 | pass→pass | 13,274 | 12,304 | -7% | 1 | 1 | 0% | 2,071 | 3,626 | +75% | 0 | 0 | — |
case-11 | pass→pass | 15,362 | 5,817 | -62% | 1 | 1 | 0% | 2,139 | 3,443 | +61% | 0 | 0 | — |
case-12 | fail→pass | 16,955 | 14,795 | -13% | 1 | 1 | 0% | 2,792 | 4,153 | +49% | 0 | 0 | — |
case-13 | fail→fail | 13,628 | 12,169 | -11% | 1 | 1 | 0% | 1,406 | 3,543 | +152% | 0 | 0 | — |
case-14 | pass→pass | 20,719 | 16,057 | -23% | 1 | 1 | 0% | 2,448 | 4,219 | +72% | 0 | 0 | — |
case-15 | pass→pass | 14,919 | 9,528 | -36% | 1 | 1 | 0% | 1,533 | 3,113 | +103% | 0 | 0 | — |
case-16 | fail→pass | 13,452 | 10,620 | -21% | 1 | 1 | 0% | 1,793 | 3,268 | +82% | 0 | 0 | — |
case-17 | pass→pass | 9,049 | 8,012 | -11% | 1 | 1 | 0% | 774 | 2,815 | +264% | 0 | 0 | — |
case-18 | pass→pass | 13,128 | 12,085 | -8% | 1 | 1 | 0% | 2,413 | 3,634 | +51% | 0 | 0 | — |
case-19 | pass→pass | 7,893 | 2,695 | -66% | 1 | 1 | 0% | 420 | 2,751 | +555% | 0 | 0 | — |
case-20 | pass→pass | 19,899 | 14,392 | -28% | 1 | 1 | 0% | 3,378 | 4,847 | +43% | 0 | 0 | — |
case-21 | pass→pass | 15,106 | 15,782 | +4% | 1 | 1 | 0% | 1,952 | 4,033 | +107% | 0 | 0 | — |
case-22 | pass→pass | 17,118 | 11,364 | -34% | 1 | 1 | 0% | 2,294 | 4,348 | +90% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +36 percentage points is the difference between those two pass rates over the 21 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.