Add Gemini CLI integration via OpenAI-compatible proxy#88
Open
wenze2527 wants to merge 1 commit intolm-sys:mainfrom
Open
Add Gemini CLI integration via OpenAI-compatible proxy#88wenze2527 wants to merge 1 commit intolm-sys:mainfrom
wenze2527 wants to merge 1 commit intolm-sys:mainfrom
Conversation
Enables RouteLLM to use Google Gemini CLI (personal OAuth) as the strong model alongside local Ollama models as the weak model. - gemini_proxy.py: FastAPI server wrapping `gemini -p` as an OpenAI-compatible endpoint on :8080; handles message flattening, async subprocess via asyncio.to_thread, and timeout handling - start.py: Orchestration launcher that boots the Gemini proxy, waits for health check, then starts RouteLLM with mf router on :6060; supports --threshold, --weak, --port args - start.bat: Windows batch launcher using hermes venv Python - start_and_test.bat: One-click launcher that starts RouteLLM (or detects it's already running) then runs the smoke test - test_routing.py: Smoke test that sends easy/medium/hard prompts and prints which model each was routed to Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gemini_proxy.py: FastAPI server that wrapsgemini -p(Google Gemini CLI) as an OpenAI-compatible endpoint on:8080. Enables RouteLLM to use a personal OAuth Gemini CLI session as the strong model without needing a direct API key.start.py: Orchestration launcher that boots the Gemini proxy, waits for its health check, then starts RouteLLM with themfrouter on:6060. Supports--threshold,--weak, and--portarguments.start.bat: Windows batch launcher using a local venv Python.start_and_test.bat: One-click Windows launcher that starts RouteLLM (or detects it's already running) then runs the smoke test automatically.test_routing.py: Smoke test that sends easy / medium / hard prompts and prints which model each query was routed to.Architecture
Key design decisions
generativelanguage.googleapis.comaccess. Wrappinggemini -pas a subprocess proxy is the only viable path.asyncio.to_thread(subprocess.run())instead ofasyncio.create_subprocess_execbecause the latter cannot resolve.cmdwrapper files on Windows.shutil.which("gemini"): Resolves the full path to the Gemini CLI executable at startup, avoiding PATH lookup failures inside subprocesses.Test plan
start.bat(orstart_and_test.batfor automatic testing)curl http://localhost:8080/healthcurl http://localhost:6060/v1/modelspython test_routing.py— confirm easy queries route to Ollama, hard queries route to Gemini🤖 Generated with Claude Code