Setup & Installation
Or with the ClawHub CLI, for registry-managed skill folders outside a full OpenClaw workspace:
Version History
Added Atomic Write (file corruption protection), In-Memory Caching (IO boost), and RPM Rate Limiting.
What This Skill Does
Intercepts LLM API requests before they're sent to prevent 429 rate limit errors. Tracks per-model token usage with a sliding window and automatically waits, falls back to another model, or blocks runaway duplicate requests. Works with Gemini, Claude, GPT-4o, and DeepSeek with pre-configured quotas.
Unlike post-hoc retry wrappers, it estimates token count before the call so failed requests never consume quota.
When to use it
- Processing large PDFs without hitting Gemini's 1M TPM limit
- Detecting and stopping retry loops that spiral into quota exhaustion
- Switching to a cheaper model automatically when primary quota runs low
- Caching repeated prompts to avoid redundant API calls
- Monitoring token spend across multiple models in a single agent run
Example Workflow
Here's how your AI assistant might use this skill in practice.
User asks: process this 200-page PDF using Gemini Flash
- 1Call guard.check(prompt_text, model='gemini-3-flash') to estimate token count
- 2Receive decision.action == 'wait' because usage is above 80% of 1M TPM limit
- 3Sleep for decision.wait_seconds, then re-check
- 4Receive decision.action == 'proceed', call the LLM API
- 5Call guard.record_usage() and guard.cache_response() to update quota tracking
PDF processed without a 429 error; quota state updated for subsequent calls