Common Issues
API Key Problems
Error: 'API error: 401' or 'Invalid API key'
Error: 'API error: 401' or 'Invalid API key'
Verify your API key
- Go to OpenRouter Keys
- Check if your key is active and not expired
- Copy the key again (make sure no extra spaces)
Update in PolyChat-AI
- Open Settings (
Ctrl+,orCmd+,) - Paste the new key in the “Clé API OpenRouter” field
- Click “Sauvegarder”
Error: 'API error: 402' or 'Insufficient credits'
Error: 'API error: 402' or 'Insufficient credits'
- Visit OpenRouter Credits to add funds
- Check your current balance in the OpenRouter dashboard
- Consider using free models (filter by “Free” in model selection)
openrouter/free- Access to free models- Look for models with “Free” badge in Settings
Settings won't save API key
Settings won't save API key
- Check Browser Storage
- Clear Cache
- Browser Compatibility
- Open DevTools (
F12) - Go to “Application” → “Local Storage”
- Find the
polychat-settingsentry - Verify it updates when you save
Connection & Network Issues
Error: 'Failed to fetch AI response' or network timeout
Error: 'Failed to fetch AI response' or network timeout
Check OpenRouter status
Try a different network
- Mobile hotspot
- VPN
- Different WiFi network
Slow response times
Slow response times
Switch models
google/gemini-3-flash(very fast)deepseek/deepseek-v3.2(good speed/quality)- Any model with “flash” in the name
Enable streaming
Simplify prompts
Check Usage Dashboard
Ctrl+U to compare response times across models you’ve used.Error: 'API error: 429' - Rate limit exceeded
Error: 'API error: 429' - Rate limit exceeded
- Wait: Rate limits reset after a short period (usually 1 minute)
- Reduce request frequency: Add a small delay between messages
- Upgrade account: Higher OpenRouter tiers have higher rate limits
- Check if you’re making duplicate requests: Debug with DevTools Network tab
Model & Response Issues
Model not available or deprecated
Model not available or deprecated
Search for updated models
- Look for the same provider (e.g., “anthropic”, “openai”)
- Find a newer version (higher version number)
- Check the “created” date to find recent models
anthropic/claude-3-opus is unavailable, try anthropic/claude-4.5-sonnet instead.Poor quality responses or hallucinations
Poor quality responses or hallucinations
- Improve Your Prompt
- Try Better Models
- Use System Prompts
- Multi-Model Comparison
- Be specific and detailed
- Provide context and examples
- Use system prompts for consistent behavior
- Break complex tasks into steps
Response cut off or incomplete
Response cut off or incomplete
-
Check model context length:
- Open Settings and view “Ctx” column
- Models with higher context (e.g., 200k) can handle longer responses
-
Ask for continuation:
- Simplify your request: Break into smaller questions
-
Streaming issue: If streaming was interrupted:
- Check your network connection
- Try sending the message again
- See code reference:
src/services/openRouter.ts:144-189
Image generation not working
Image generation not working
Verify model supports images
gemini-2.5-flash-imagegpt-4oclaude-3.5-sonnetorclaude-3.7-sonnet
src/services/openRouter.ts:538-551 for the complete list.Use dedicated image models
getImageModels() to fetch image-capable models. These are filtered to show only models with text+image->text+image modality.generateImageReliable() function which automatically retries with fallback models. See src/services/openRouter.ts:734-824UI & Display Issues
Usage Dashboard shows no data
Usage Dashboard shows no data
- Check browser DevTools:
- Open DevTools (
F12) - Application → Local Storage
- Find
polychat-usage-stats
- Open DevTools (
- Verify data structure:
- Send a test message to start tracking
- Check that tracking functions are called (see
src/hooks/useUsageStats.ts:26-90) - If
lastUpdatedis old, stats may have been reset
Theme or colors not applying
Theme or colors not applying
src/components/Settings/SettingsModalModern.tsx:65-68Settings modal won't open
Settings modal won't open
- Check DevTools Console (
F12): Look for JavaScript errors - Try alternative access method: Use menu instead of
Ctrl+, - Check browser extensions: Disable extensions that might conflict
- Reload the page: Hard refresh and try again
Model list not loading in Settings
Model list not loading in Settings
- Check network connectivity
- Verify no CORS errors in console
- Try reloading the page
- Check if OpenRouter API is down
getTopWeeklyModels() and getImageModels() in src/services/openRouter.tsDebugging Tools
Browser DevTools
Use these DevTools features for debugging:- Console
- Network
- Application
- Press
F12→ Console tab - Look for red error messages
- Check for warnings about API calls
Failed to fetch: Network issueUncaught TypeError: JavaScript errorCORS error: API access issue
Source Code References
Key files to check when debugging:| Issue Type | File Location | Line Reference |
|---|---|---|
| API calls | src/services/openRouter.ts | Lines 5-97 (fetch), 102-191 (streaming) |
| Settings persistence | src/hooks/useSettings.ts | Check persist middleware |
| Usage tracking | src/hooks/useUsageStats.ts | Lines 26-90 (tracking functions) |
| Model list | src/hooks/useModels.ts | Check model fetching |
| UI components | src/components/Settings/ | Settings modal and dashboard |
Testing API Directly
Test OpenRouter API outside the app:Advanced Debugging
Enable Verbose Logging
Add console logs to track execution:Monitor State Changes
For Zustand stores, add middleware:Performance Profiling
Getting Help
Before Asking for Help
Gather this information:Resources
OpenRouter Discord
OpenRouter Docs
GitHub Issues
Check Status
Error Code Reference
| Code | Meaning | Typical Cause |
|---|---|---|
| 400 | Bad Request | Malformed API request |
| 401 | Unauthorized | Invalid API key |
| 402 | Payment Required | Insufficient credits |
| 403 | Forbidden | API key lacks permissions |
| 429 | Rate Limited | Too many requests |
| 500 | Server Error | OpenRouter API issue |
| 502 | Bad Gateway | OpenRouter upstream issue |
| 503 | Service Unavailable | OpenRouter maintenance |
Reset & Recovery
Reset All Settings
Reset Usage Statistics
- Open DevTools → Application → Local Storage
- Delete
polychat-usage-stats - Reload the page