You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please upvote and get the PR noticed by google team if you are interested in seeing openrouter support!
gentle ping @scidomino
✅ What Works:
Basic Content Generation: Successfully generates responses using
OpenRouter's API
Streaming Support: Streaming generation works as expected
Token Counting: Provides token usage statistics
Model Mapping: Correctly maps Gemini model names to OpenRouter
format (e.g., gemini-2.5-flash → google/gemini-2.5-flash)
Error Handling: Properly handles API errors and provides meaningful
error messages
📝 Important Notes:
Token Limits: I've set a default max_tokens of 20000 for coding use case
Cost Awareness: OpenRouter charges per token, so users should be
aware of costs when using this integration.
No Embedding Support: As designed, embeddings are not supported
through OpenRouter for Gemini models.
🚀 Usage:
To use OpenRouter with Gemini CLI:
# Set your OpenRouter API key
export OPENROUTER_API_KEY="your-api-key"
# Run Gemini CLI
gemini
# Select "OpenRouter" when prompted for authentication
Or for non-interactive mode:
export OPENROUTER_API_KEY="your-api-key"
echo "Your prompt here" | gemini
The integration is fully functional and ready for use!
Reacted by Marius, dangerzone, Mateus Sampaio, Mage, Justin Firth, Baginda, Jorge Villada, samud008 and otakutyrant
I submitted a pull request which not only supports open router but anthropic, openai including resposnes and does tool formatting for qwen and other models...also fireworks #3405
https://github.com/acoliver/llxprt-code - I've gone a step further and done a full fork. We'll release packages to npm in a few days. The readme and front page has explicit instructions on how to use openrouter among others. (/provider openai /baseurl thebaseurl /keyfile ~/.mykeyfile or /key {mykey} /model (picklist) ) - it also supports local models :-) It continues to support all of the gemini models as well. I plan to keep it relatively up to date with gemini-cli fixes as well for as long as possible.
Reacted by Marius, Sherwin Techico, dcieslak19973, buster-blue and otakutyrant
I appreciate the desire to support models through open router, but we are fully focused on gemini models and endpoints right now, and do not plan to support the differences between the model access on open router vs our own endpoints.
Reacted by Maaz Chowdhry, Ujang Karnadi, Robin, Bernardo Ferrari, minicx, Weichen Zhang, TennyZhuang and Bradley McCrorey
Reacted by Alberto Cavalcante, Julia, Bernardo Ferrari and otakutyrant
I guess then https://opencode.ai is our only hope for choosing the best provider and model. Really sucks that this isn't a priority for you guys. Maybe someone from the windsurf team can explain it to you.
I actually think Google's decision is better. Let google pursue their roadmap, really work on the IDE bits and such and let the community extend it into the multi model agentic platform it was meant to be.
For anybody looking for an alternative cli coding agent that supports openrouter, I started working on one here: https://github.com/fdietze/alors it's early-stage, but works well for code editing already. Contributions welcome.
Activity
heymaaz commentedon Jun 25, 2025
Yes please!
heartyguy commentedon Jun 26, 2025
Would love to take a stab at this!
sruckh commentedon Jun 26, 2025
+1 for adding openrouter support, even if it only supports the Gemini models. Although access to all OpenRouter models would be superb!
lostmaniac commentedon Jun 26, 2025
+1
Singein commentedon Jun 26, 2025
+1
BieggerM commentedon Jun 26, 2025
+1
puzige commentedon Jun 27, 2025
+1
feat: Add OpenRouter support for Gemini models
heartyguy commentedon Jun 28, 2025
Made a PR at Add OpenRouter support for Gemini models #2319
Please upvote and get the PR noticed by google team if you are interested in seeing openrouter support!
gentle ping @scidomino
✅ What Works:
OpenRouter's API
format (e.g., gemini-2.5-flash → google/gemini-2.5-flash)
error messages
📝 Important Notes:
aware of costs when using this integration.
through OpenRouter for Gemini models.
🚀 Usage:
To use OpenRouter with Gemini CLI:
The integration is fully functional and ready for use!
acoliver commentedon Jul 6, 2025
I submitted a pull request which not only supports open router but anthropic, openai including resposnes and does tool formatting for qwen and other models...also fireworks #3405
acoliver commentedon Jul 18, 2025
https://github.com/acoliver/llxprt-code - I've gone a step further and done a full fork. We'll release packages to npm in a few days. The readme and front page has explicit instructions on how to use openrouter among others. (/provider openai /baseurl thebaseurl /keyfile ~/.mykeyfile or /key {mykey} /model (picklist) ) - it also supports local models :-) It continues to support all of the gemini models as well. I plan to keep it relatively up to date with gemini-cli fixes as well for as long as possible.
allenhutchison commentedon Aug 1, 2025
I appreciate the desire to support models through open router, but we are fully focused on gemini models and endpoints right now, and do not plan to support the differences between the model access on open router vs our own endpoints.
heymaaz commentedon Aug 2, 2025
I guess then https://opencode.ai is our only hope for choosing the best provider and model. Really sucks that this isn't a priority for you guys. Maybe someone from the windsurf team can explain it to you.
acoliver commentedon Aug 2, 2025
@heymaaz not actually https://github.com/acoliver/llxprt-code keeps up with gemini-cli, adds multi-provider and local models support. We're even testing an automerge to cherrypick googles changes as they go.
I actually think Google's decision is better. Let google pursue their roadmap, really work on the IDE bits and such and let the community extend it into the multi model agentic platform it was meant to be.
fdietze commentedon Aug 3, 2025
For anybody looking for an alternative cli coding agent that supports openrouter, I started working on one here: https://github.com/fdietze/alors it's early-stage, but works well for code editing already. Contributions welcome.
acoliver commentedon Aug 3, 2025
@fdietze if you're not deadset on rolling your own I'd love to work with you on llxprt-code https://github.com/acoliver/llxprt-code
4fthawaiian commentedon Jun 12, 2026
just use pi :)
fix(tbench): gemini-cli hardenings — TRUST_WORKSPACE + settings.json …