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,926 stars 433 forks Updated yesterday 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
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category