Skip to main content

Common Issues

API Key Problems

Cause: Your OpenRouter API key is invalid, expired, or incorrectly formatted.Solutions:
1

Verify your API key

  1. Go to OpenRouter Keys
  2. Check if your key is active and not expired
  3. Copy the key again (make sure no extra spaces)
2

Update in PolyChat-AI

  1. Open Settings (Ctrl+, or Cmd+,)
  2. Paste the new key in the “Clé API OpenRouter” field
  3. Click “Sauvegarder”
3

Test the connection

Send a test message to verify the key works
API keys starting with sk-or-v1- are the correct format. If yours doesn’t match, it may be invalid.
Cause: Your OpenRouter account has insufficient credits or hasn’t been funded.Solutions:
  1. Visit OpenRouter Credits to add funds
  2. Check your current balance in the OpenRouter dashboard
  3. Consider using free models (filter by “Free” in model selection)
Free model alternatives:
  • openrouter/free - Access to free models
  • Look for models with “Free” badge in Settings
Cause: Browser localStorage issues or JavaScript errors.Solutions:
  1. Open DevTools (F12)
  2. Go to “Application” → “Local Storage”
  3. Find the polychat-settings entry
  4. Verify it updates when you save

Connection & Network Issues

Cause: Network connectivity issues or OpenRouter API downtime.Diagnostic steps:
# Test OpenRouter API directly
curl -I https://openrouter.ai/api/v1/models
Solutions:
1

Check your internet connection

Verify you’re online and can access other websites
2

Check OpenRouter status

Visit OpenRouter Status or check their Discord
3

Try a different network

Corporate firewalls may block OpenRouter. Try:
  • Mobile hotspot
  • VPN
  • Different WiFi network
4

Check for CORS issues

Open DevTools Console (F12) and look for CORS errors. If present, this is an OpenRouter API issue.
Cause: Model overload, network latency, or complex prompts.Solutions:

Switch models

Faster alternatives:
  • google/gemini-3-flash (very fast)
  • deepseek/deepseek-v3.2 (good speed/quality)
  • Any model with “flash” in the name

Enable streaming

Streaming responses feel faster by showing results as they arrive. This should be enabled by default.

Simplify prompts

Shorter, clearer prompts typically get faster responses.

Check Usage Dashboard

Press Ctrl+U to compare response times across models you’ve used.
Cause: You’ve sent too many requests in a short time period.Solutions:
  1. Wait: Rate limits reset after a short period (usually 1 minute)
  2. Reduce request frequency: Add a small delay between messages
  3. Upgrade account: Higher OpenRouter tiers have higher rate limits
  4. Check if you’re making duplicate requests: Debug with DevTools Network tab
If you’re rate limited on free models, try switching to a paid model which may have different limits.

Model & Response Issues

Cause: The selected model has been removed or renamed by the provider.Solutions:
1

Open Settings

Press Ctrl+, (or Cmd+,)
2

Search for updated models

In the “Modèle par défaut” section:
  • Look for the same provider (e.g., “anthropic”, “openai”)
  • Find a newer version (higher version number)
  • Check the “created” date to find recent models
3

Select and save

Click the new model and save settings
Example: If anthropic/claude-3-opus is unavailable, try anthropic/claude-4.5-sonnet instead.
Cause: Model limitations, unclear prompts, or inappropriate model selection.Solutions:
  • Be specific and detailed
  • Provide context and examples
  • Use system prompts for consistent behavior
  • Break complex tasks into steps
Cause: Token limit reached or streaming interruption.Solutions:
  1. Check model context length:
    • Open Settings and view “Ctx” column
    • Models with higher context (e.g., 200k) can handle longer responses
  2. Ask for continuation:
    Please continue from where you left off.
    
  3. Simplify your request: Break into smaller questions
  4. Streaming issue: If streaming was interrupted:
    • Check your network connection
    • Try sending the message again
    • See code reference: src/services/openRouter.ts:144-189
Cause: Wrong model selected or model doesn’t support image generation.Solutions:
1

Verify model supports images

Only certain models can generate images. Check the model ID contains:
  • gemini-2.5-flash-image
  • gpt-4o
  • claude-3.5-sonnet or claude-3.7-sonnet
See src/services/openRouter.ts:538-551 for the complete list.
2

Use dedicated image models

The app provides getImageModels() to fetch image-capable models. These are filtered to show only models with text+image->text+image modality.
3

Check error message

If you see “Le modèle X ne supporte pas la génération d’images”, switch to a supported model.
Image generation uses the generateImageReliable() function which automatically retries with fallback models. See src/services/openRouter.ts:734-824

UI & Display Issues

Cause: No messages sent yet, or localStorage was cleared.Diagnostic:
  1. Check browser DevTools:
    • Open DevTools (F12)
    • Application → Local Storage
    • Find polychat-usage-stats
  2. Verify data structure:
    {
      "totalConversations": 0,
      "totalMessages": 0,
      "totalUserMessages": 0,
      "totalAssistantMessages": 0,
      "avgResponseTimeMs": 0,
      "perModel": {},
      "lastUpdated": "2025-01-01T00:00:00.000Z"
    }
    
Solutions:
  • Send a test message to start tracking
  • Check that tracking functions are called (see src/hooks/useUsageStats.ts:26-90)
  • If lastUpdated is old, stats may have been reset
Cause: CSS not loaded or theme setting not persisted.Solutions:
1

Check Settings

  1. Open Settings (Ctrl+,)
  2. Go to “Apparence” section
  3. Manually select theme again
2

Verify DOM attributes

Open DevTools Elements tab and check:
<html data-theme="dark" data-accent="violet">
3

Clear CSS cache

Hard reload: Ctrl+Shift+R or Cmd+Shift+R
Theme changes are applied via:
document.documentElement.setAttribute('data-theme', newTheme);
document.body.className = `theme-${newTheme}`;
See src/components/Settings/SettingsModalModern.tsx:65-68
Cause: JavaScript error or keyboard shortcut conflict.Solutions:
  1. Check DevTools Console (F12): Look for JavaScript errors
  2. Try alternative access method: Use menu instead of Ctrl+,
  3. Check browser extensions: Disable extensions that might conflict
  4. Reload the page: Hard refresh and try again
Cause: Failed to fetch models from OpenRouter API.Diagnostic:Open DevTools Network tab and check for:
Request: https://openrouter.ai/api/v1/models
Status: Should be 200 OK
Solutions:
  • Check network connectivity
  • Verify no CORS errors in console
  • Try reloading the page
  • Check if OpenRouter API is down
The app fetches models via getTopWeeklyModels() and getImageModels() in src/services/openRouter.ts

Debugging Tools

Browser DevTools

Use these DevTools features for debugging:
Purpose: View JavaScript errors and logsHow to use:
  1. Press F12 → Console tab
  2. Look for red error messages
  3. Check for warnings about API calls
Common errors:
  • Failed to fetch: Network issue
  • Uncaught TypeError: JavaScript error
  • CORS error: API access issue

Source Code References

Key files to check when debugging:
Issue TypeFile LocationLine Reference
API callssrc/services/openRouter.tsLines 5-97 (fetch), 102-191 (streaming)
Settings persistencesrc/hooks/useSettings.tsCheck persist middleware
Usage trackingsrc/hooks/useUsageStats.tsLines 26-90 (tracking functions)
Model listsrc/hooks/useModels.tsCheck model fetching
UI componentssrc/components/Settings/Settings modal and dashboard

Testing API Directly

Test OpenRouter API outside the app:
# Test with curl
curl https://openrouter.ai/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "anthropic/claude-4.5-sonnet",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
Expected response:
{
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      }
    }
  ]
}
If this fails, the issue is with your API key or OpenRouter account, not PolyChat-AI.

Advanced Debugging

Enable Verbose Logging

Add console logs to track execution:
// In src/services/openRouter.ts
export const fetchAIResponse = async (...) => {
  console.log('API Request:', { messages, model });
  
  const response = await fetch(API_URL, ...);
  console.log('API Response Status:', response.status);
  
  const data = await response.json();
  console.log('API Response Data:', data);
  
  return data.choices[0].message.content;
};

Monitor State Changes

For Zustand stores, add middleware:
import { create } from 'zustand';
import { devtools } from 'zustand/middleware';

export const useSettings = create(
  devtools(
    persist(
      (set) => ({
        // ... your state
      }),
      { name: 'polychat-settings' }
    ),
    { name: 'Settings Store' }
  )
);
Then install Redux DevTools to inspect state.

Performance Profiling

1

Open Performance tab

Press F12 → Performance
2

Record interaction

Click record, send a message, stop recording
3

Analyze

Look for:
  • Long tasks (> 50ms)
  • Network waterfalls
  • Memory leaks

Getting Help

Before Asking for Help

Gather this information:

Resources

OpenRouter Discord

Get help with API and model issues

OpenRouter Docs

Official API documentation

GitHub Issues

Report bugs in PolyChat-AI (check with your team for the repo URL)

Check Status

Verify OpenRouter API uptime

Error Code Reference

CodeMeaningTypical Cause
400Bad RequestMalformed API request
401UnauthorizedInvalid API key
402Payment RequiredInsufficient credits
403ForbiddenAPI key lacks permissions
429Rate LimitedToo many requests
500Server ErrorOpenRouter API issue
502Bad GatewayOpenRouter upstream issue
503Service UnavailableOpenRouter maintenance

Reset & Recovery

Reset All Settings

This will erase all your settings, API key, and preferences. Usage statistics will be preserved.
1

Open DevTools

Press F12 → Application → Local Storage
2

Delete settings key

Find and delete polychat-settings
3

Reload

Refresh the page to start with default settings

Reset Usage Statistics

1

Open Usage Dashboard

Press Ctrl+U (or Cmd+U)
2

Find reset button

Look for “Reset Statistics” or similar option
3

Confirm

Confirm the reset action
Or manually via DevTools:
  1. Open DevTools → Application → Local Storage
  2. Delete polychat-usage-stats
  3. Reload the page

Complete Reset

To completely reset PolyChat-AI:
// Run in DevTools Console
localStorage.clear();
location.reload();
This deletes ALL local data and reloads the app with defaults.

Build docs developers (and LLMs) love