Agent skill · data analytics · jeremylongshore
openrouter-common-errors
Diagnose and fix common OpenRouter API errors. Use when encountering
Why this skill is useful
Provides detailed troubleshooting procedures and specific commands for diagnosing and fixing OpenRouter API errors that the AI wouldn't reliably generate on its own.
What it needs
Requires curl, jq, python3 installed locally. Requires openrouter account access. About 6k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.
What this skill does
OpenRouter Common Errors Overview OpenRouter returns standard HTTP error codes plus OpenRouter-specific error codes in the response body. The most common: 401 (auth), 402 (credits), 429 (rate limit), 400 (bad request), and 5xx (upstream provider errors). Each error includes a code field and a human-readable message. This skill covers every common error, its root cause, and the exact fix. Prerequisites An OpenRouter API key (sk-or-v1-...) exported as OPENROUTERAPIKEY — see the openrouter-install-auth skill for setup curl and jq to run the Diagnostic Script Python 3.8+ with the OpenAI SDK for the categorized error handler; Node.js 18+ for the TypeScript typed-error classifier in the references The requests package if you use the Prevention Middleware's pre-flight model check Instructions 1. Identify the failure by HTTP status and code using the Complete Error Reference table (400/401/402/403/408/429/5xx each map to a specific fix). 2. Inspect the body per Error Response Format — error.code, error.message, and error.metadata.providername tell you whether OpenRouter or the upstream provider failed. 3. Run the Diagnostic Script: it checks auth via GET /api/v1/auth/key, computes remaining credits, verifies the model exists in /api/v1/models, and fires a minimal 1-token completion. 4. Wrap production calls with safecompletion() from Python Error Handler — maxretries=3 auto-retries 429 and 5xx, and each exception class raises with its exact remedy. 5. Add validatebeforesend() from Prevention Middleware to catch bad model IDs (with suggestions), malformed messages, and context overflows before spending money on a 400. 6. If errors persist across retries and providers, check status.openrouter.ai per the Error Handling table. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills jeremylongshore/openrouter-common-errors