openrouter-known-pitfalls

Featured

Avoid common OpenRouter integration mistakes and gotchas. Use proactively when starting a new integration or reviewing existing code. Triggers: 'openrouter pitfalls', 'openrouter gotchas', 'openrouter mistakes', 'openrouter best practices'.

AI & Automation 2,266 stars 315 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# OpenRouter Known Pitfalls ## Overview A curated list of real-world mistakes developers make when integrating OpenRouter, each with the specific API behavior that causes the problem and the exact fix. These are not theoretical -- they come from production incidents and support requests. ## Pitfall 1: Missing Provider Prefix on Model ID ```python # WRONG: Model ID without provider prefix response = client.chat.completions.create( model="gpt-4o", # ← Will fail with 400 "model not found" messages=[{"role": "user", "content": "Hello"}], ) # RIGHT: Always include provider/model format response = client.chat.completions.create( model="openai/gpt-4o", # ← Correct messages=[{"role": "user", "content": "Hello"}], ) ``` ## Pitfall 2: No max_tokens = Runaway Costs ```python # WRONG: No max_tokens -- model may generate 4000+ tokens response = client.chat.completions.create( model="anthropic/claude-3.5-sonnet", # $15/1M completion tokens messages=[{"role": "user", "content": "Write a story"}], # No max_tokens → could generate $0.06+ per request ) # RIGHT: Always set max_tokens response = client.chat.completions.create( model="anthropic/claude-3.5-sonnet", messages=[{"role": "user", "content": "Write a story"}], max_tokens=500, # ← Caps cost at ~$0.0075 ) ``` ## Pitfall 3: Hardcoded Model IDs Break When Models Are Renamed ```python # WRONG: Hardcoded model ID scattered across codebase # When "claude-3-opus" becomes "claude-3-opus-20240...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

openrouter-common-errors

Diagnose and fix common OpenRouter API errors. Use when encountering error codes, unexpected failures, or debugging API responses. Triggers: 'openrouter error', 'openrouter 401', 'openrouter 429', 'openrouter 402', 'fix openrouter'.

2,266 Updated today
jeremylongshore
AI & Automation Featured

clade-known-pitfalls

Common mistakes when building with the Anthropic API and how to avoid them. Use when working with known-pitfalls patterns. Trigger with "anthropic mistakes", "claude pitfalls", "anthropic gotchas", "common claude errors", "anthropic anti-patterns".

2,266 Updated today
jeremylongshore
AI & Automation Featured

openrouter-fallback-config

Configure automatic model fallbacks for high availability on OpenRouter. Use when building resilient systems that need to survive provider outages. Triggers: 'openrouter fallback', 'model fallback', 'openrouter failover', 'openrouter backup model'.

2,266 Updated today
jeremylongshore
AI & Automation Featured

openrouter-model-routing

Implement intelligent model routing to optimize cost, quality, and latency on OpenRouter. Use when building multi-model systems or optimizing spend across task types. Triggers: 'openrouter routing', 'model routing', 'route to model', 'model selection openrouter'.

2,266 Updated today
jeremylongshore
AI & Automation Featured

openrouter-pricing-basics

Understand OpenRouter pricing, calculate costs, and optimize spend. Use when budgeting, comparing model costs, or tracking spend. Triggers: 'openrouter pricing', 'openrouter cost', 'model pricing', 'openrouter budget', 'how much does openrouter cost'.

2,266 Updated today
jeremylongshore