openrouter-common-errors
Diagnose and fix common OpenRouter API errors. Use when encountering error codes or unexpected failures. Trigger with phrases like 'openrouter error', 'openrouter 401', 'openrouter 429', 'fix openrouter'.
- License 许可
- MIT
- 最近更新
- 2026-05-26
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- openrouter-common-errors
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Diagnose and fix common OpenRouter API errors. Use when encountering error codes or unexpected failures. Trigger with phrases like 'openrouter error', 'openrouter 401', 'openrouter 429', 'fix openrouter'.
- allowed-tools
- Read, Write, Edit, Grep
- compatible-with
- claude-code, codex, openclaw
02 资源文件 6
- 参考文档references/authentication-errors-(401).md836 B
- 参考文档references/errors.md323 B
- 参考文档references/examples.md5.8 KB
- 参考文档references/model-errors-(400).md1.2 KB
- 参考文档references/rate-limit-errors-(429).md831 B
- 参考文档references/request-errors.md1.2 KB
03 SKILL.md 正文
Openrouter Common Errors
Overview
This skill provides a comprehensive reference for diagnosing and resolving the most frequently encountered OpenRouter API errors.
Prerequisites
- OpenRouter integration
- Basic HTTP status code knowledge
Instructions
- Identify the error code: Check the HTTP status code and the
error.codefield in the response body for the specific error type - Look up the error: Match the error against the common patterns below — 401 (auth), 402 (credits), 429 (rate limit), 400 (bad request), 5xx (server)
- Apply the fix: Follow the resolution steps for the specific error; most common errors are configuration issues that can be fixed without code changes
- Add error handling: Wrap API calls in try/catch blocks that handle each error category differently (retry for 429/5xx, fail fast for 401/400)
- Prevent recurrence: Add validation middleware that catches common mistakes (missing API key, invalid model ID, malformed messages) before making the API call
Output
- Error diagnosis with root cause identified
- Resolution steps specific to the error encountered
- Preventive validation middleware that catches common mistakes before API calls
Error Handling
| Error | Cause | Fix |
|---|---|---|
| 401 Unauthorized | Invalid, expired, or missing API key | Verify key starts with sk-or-; check it's not revoked at openrouter.ai/keys |
| 402 Payment Required | No credits remaining | Add credits at openrouter.ai/credits; or use a free model like google/gemma-2-9b-it:free |
| 429 Too Many Requests | Rate limit exceeded | Implement exponential backoff; respect Retry-After header; reduce request rate |
| 400 Bad Request | Malformed request body | Validate messages array format; check model ID includes provider prefix |
| 408 Request Timeout | Model took too long to respond | Retry with a faster model; reduce max_tokens; use streaming |
| 502/503 Server Error | Upstream provider outage | Retry with backoff; check status.openrouter.ai; use fallback models |
See ${CLAUDE_SKILL_DIR}/references/errors.md for full error reference.
Examples
See ${CLAUDE_SKILL_DIR}/references/examples.md for runnable code samples.
Resources
04 同仓库更多 Skills
zustand-store-ts
Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.
zustand-store-creator
Zustand Store Creator - Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category.
zero-trust-config-helper
Zero Trust Config Helper - Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category.
zapier-integration-helper
Zapier Integration Helper - Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category.
zai-cli
Execute z.AI CLI providing vision, search, reader, and GitHub exploration via CLI and MCP. Use when user needs image/video analysis, OCR, UI-to-code conversion, error diagnosis, real-time web search, web page to markdown extraction, or GitHub code exploration. Trigger with phrases like "analyze this image", "search the web for", "read this page", "explore this repo", or "use zai". Requires Z_AI_API_KEY.
yt-research
Research competitor YouTube channels, niches, and trending topics for your content strategy. Use this skill whenever the user says "research channels", "analyze competitors", "find trending topics", "niche analysis", "competitive research", "what are other creators doing", "scrape YouTube channels", or wants to understand the competitive landscape for a specific tool or topic area. Use when working with yt research. Trigger with 'yt', 'research'.