Skip to content

feat: enhance OpenRouter model management with refresh functionality and Cloudflare bypass (fixes #3813, #3874) #3948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

indiesewell
Copy link

@indiesewell indiesewell commented May 25, 2025

Closes #3813
Closes #3874

🎯 Overview

This PR enhances OpenRouter integration by adding a model refresh button with comprehensive multilingual support and implementing a Cloudflare bypass solution for improved reliability.

🚀 Key Features

✨ Model Refresh Functionality

  • Manual Refresh Button: Added a refresh button in OpenRouter settings to manually update model list
  • Auto-initialization: Automatically initializes OpenRouter models on startup
  • Smart Model Selection: If current model becomes unavailable after refresh, automatically selects the first available model
  • Visual Feedback: Shows success/error messages with 3-second auto-dismiss

🌐 Multilingual Support

  • Added refreshModels translation key across 16 languages:
    • English, Chinese (Simplified & Traditional), Japanese, Korean
    • Spanish, French, German, Italian, Portuguese (Brazil)
    • Dutch, Polish, Russian, Turkish, Vietnamese, Hindi

🔧 Technical Improvements

  • Cloudflare Bypass: Implemented Node.js native https module to bypass Cloudflare blocking issues
  • Enhanced Error Handling: Better error detection and user feedback for network issues
  • Performance Optimization: Reduced redundant API calls with smart caching
  • React Query Integration: Proper cache invalidation after model refresh

📁 Files Changed

  • src/api/providers/fetchers/openrouter.ts - Added Cloudflare bypass logic
  • webview-ui/src/components/settings/providers/OpenRouter.tsx - Added refresh button UI and logic
  • webview-ui/src/i18n/locales/*/settings.json - Added translations for 16 languages
  • src/core/webview/webviewMessageHandler.ts - Enhanced auto-initialization

🐛 Problem Solved

  • Issue: Users couldn't refresh OpenRouter models without restarting the extension
  • Issue: Cloudflare blocking prevented reliable model fetching
  • Issue: No user feedback when model operations failed
  • Issue: Missing multilingual support for new features

✅ Testing

  • ✅ Manual refresh button works correctly
  • ✅ Success/error messages display properly
  • ✅ All 16 language translations verified
  • ✅ Cloudflare bypass resolves connection issues
  • ✅ Auto-model selection when current model unavailable

🔗 Related

Based on upstream v3.18.3 with proper Git merge to ensure compatibility.


Important

Enhances OpenRouter with a model refresh button, multilingual support, and Cloudflare bypass, improving reliability and user feedback.

  • Behavior:
    • Adds a refresh button in OpenRouter.tsx to manually update the model list with success/error messages.
    • Automatically initializes OpenRouter models on startup in webviewMessageHandler.ts.
    • Selects the first available model if the current model is unavailable after refresh.
  • Multilingual Support:
    • Adds refreshModels translation key in 16 languages in locales/*/settings.json.
  • Technical Improvements:
    • Implements Cloudflare bypass using Node.js https module in openrouter.ts.
    • Enhances error handling and user feedback for network issues.
    • Reduces redundant API calls with smart caching and React Query integration.
  • Files Changed:
    • openrouter.ts: Cloudflare bypass logic.
    • OpenRouter.tsx: Refresh button UI and logic.
    • webviewMessageHandler.ts: Auto-initialization logic.

This description was created by Ellipsis for 40331eb. You can customize this summary. It will automatically update as commits are pushed.

✨ OpenRouter Model Refresh Features:
- Add refresh button with multilingual support (16 languages)
- Implement Node.js native https module to bypass Cloudflare blocking
- Add auto-initialization of router models on startup
- Optimize model fetching with graceful error handling

🌐 Multilingual Support:
- Add 'refreshModels' translation key across all 16 supported languages
- Maintain consistent UI experience across different locales

🚀 Performance Improvements:
- Reduce redundant API calls with smart caching
- Better error handling for network issues

Based on upstream v3.18.3 with proper Git merge
@indiesewell indiesewell requested review from mrubens and cte as code owners May 25, 2025 03:59
@indiesewell indiesewell changed the title feat: enhance OpenRouter model management with refresh functionality and Cloudflare bypass feat: enhance OpenRouter model management with refresh functionality and Cloudflare bypass (fixes #3813, #3874) May 27, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label May 27, 2025
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 28, 2025
@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Preliminary Review] in Roo Code Roadmap May 28, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR - Needs Preliminary Review size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: PR [Needs Prelim Review]
Development

Successfully merging this pull request may close these issues.

Cannot select any model - the drop down after selection blanks out after selecting the model. API cannot select models other than Claude 3.7 Sonnet
2 participants