Skip to content

Add auto model selection with intelligent routing (Gemini CLI v0.11.2+) - #25

Open
benzntech wants to merge 2 commits into
cruzyjapan:mainfrom
benzntech:feature/auto-model-selection
Open

benzntech wants to merge 2 commits into
cruzyjapan:mainfrom
benzntech:feature/auto-model-selection

Conversation

@benzntech

Copy link
Copy Markdown

Summary

This PR adds support for Gemini CLI's intelligent model routing feature, allowing users to select "Auto" mode which dynamically chooses between Flash and Pro models based on task complexity.

Changes

  • UI Settings: Added "Auto (Smart Routing)" as the first option in model selection dropdown
  • Default Model: Changed default from gemini-2.5-flash to auto across all components
  • Client-side: Updated ChatInterface.jsx and ToolsSettings.jsx to support auto mode
  • Server-side: Updated server/gemini-cli.js to pass --model auto to Gemini CLI

Features

Model Options

Users can now choose from:

  1. Auto (Smart Routing) ← Default & Recommended
    • Automatically selects Flash or Pro based on task complexity
  2. Gemini 2.5 Flash - Fast and efficient
  3. Gemini 2.5 Pro - Most advanced (with quota limits note)

How It Works

The Auto mode leverages Gemini CLI v0.11.2+'s built-in intelligent routing:

  • Simple tasks → Uses gemini-2.5-flash (faster, cheaper)
  • Complex tasks → Uses gemini-2.5-pro (more capable)
  • Task complexity analysis is handled automatically by Gemini CLI

Benefits

  • ✅ Cost Optimization: Flash model for simple queries reduces costs
  • ✅ Performance: Faster responses for simple tasks
  • ✅ Intelligent: Automatically uses Pro for complex tasks that need it
  • ✅ User Control: Users can still manually select specific models if desired

Files Modified

  • src/components/ToolsSettings.jsx - Added auto option to model dropdown
  • src/components/ChatInterface.jsx - Updated default model to auto
  • server/gemini-cli.js - Pass auto model flag to CLI

Testing

  • ✅ Tested with Gemini CLI v0.17.1 (supports auto mode)
  • ✅ Auto mode flag (--model auto) works correctly
  • ✅ UI displays model selection properly
  • ✅ Settings persist across sessions

Screenshots

Settings - Model Selection

The new Auto mode appears as the first and default option in Settings > Tools > Gemini Model:

Model Selection

References

Related PRs

Benson K B added 2 commits November 24, 2025 20:12
- Add path validation to prevent errors from invalid characters
- Implement automatic cleanup on server startup
- Add spawn validation to prevent cd errors
- Create manual cleanup API endpoint
- Filter invalid projects during getProjects calls
- Add 'auto' model option to UI settings (Smart Routing)
- Update default model from gemini-2.5-flash to auto across all components
- Auto mode dynamically selects Flash or Pro based on task complexity
- Update ToolsSettings.jsx to include auto option with description
- Update ChatInterface.jsx to use auto as default
- Update server/gemini-cli.js to pass auto model to Gemini CLI

The auto mode leverages Gemini CLI v0.11.2+'s intelligent routing feature
that analyzes task complexity and automatically selects the optimal model
(Flash for simple tasks, Pro for complex ones).

References:
- Gemini CLI Discussion #12375
- https://medium.com/google-cloud/practical-gemini-cli-intelligent-model-router-e01e543ec438
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant