Skip to content

Add OpenRouter support #1515

Closed
Closed

Description

@dangerzone

Please add OpenRouter endpoint support

Activity

  1. heymaaz commented on Jun 25, 2025

    @heymaaz

    Yes please!

  2. added
    area/coreIssues related to User Interface, OS Support, Core Functionality
    priority/p1Important and should be addressed in the near term.
    and removed on Jun 25, 2025
  3. heartyguy commented on Jun 26, 2025

    @heartyguy
    Contributor

    Would love to take a stab at this!

  4. sruckh commented on Jun 26, 2025

    @sruckh

    +1 for adding openrouter support, even if it only supports the Gemini models. Although access to all OpenRouter models would be superb!

  5. lostmaniac commented on Jun 26, 2025

    @lostmaniac

    +1

  6. Singein commented on Jun 26, 2025

    @Singein

    +1

  7. BieggerM commented on Jun 26, 2025

    @BieggerM

    +1

  8. puzige commented on Jun 27, 2025

    @puzige

    +1

  9. added a commit that references this issue on Jun 28, 2025
    dc9c495
  10. heartyguy commented on Jun 28, 2025

    @heartyguy
    Contributor

    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:

    1. Basic Content Generation: Successfully generates responses using
      OpenRouter's API
    2. Streaming Support: Streaming generation works as expected
    3. Token Counting: Provides token usage statistics
    4. Model Mapping: Correctly maps Gemini model names to OpenRouter
      format (e.g., gemini-2.5-flash → google/gemini-2.5-flash)
    5. Error Handling: Properly handles API errors and provides meaningful
      error messages

    📝 Important Notes:

    1. Token Limits: I've set a default max_tokens of 20000 for coding use case
    2. Cost Awareness: OpenRouter charges per token, so users should be
      aware of costs when using this integration.
    3. 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!

  11. acoliver commented on Jul 6, 2025

    @acoliver

    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

  12. acoliver commented on Jul 18, 2025

    @acoliver

    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.

  13. added
    priority/p2Important but can be addressed in a future release.
    and removed
    priority/p1Important and should be addressed in the near term.
    on Jul 21, 2025
  14. allenhutchison commented on Aug 1, 2025

    @allenhutchison
    Contributor

    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.

  15. heymaaz commented on Aug 2, 2025

    @heymaaz

    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.

  16. acoliver commented on Aug 2, 2025

    @acoliver

    @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.

  17. fdietze commented on Aug 3, 2025

    @fdietze

    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.

  18. acoliver commented on Aug 3, 2025

    @acoliver

    @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

  19. 4fthawaiian commented on Jun 12, 2026

    @4fthawaiian

    just use pi :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreIssues related to User Interface, OS Support, Core Functionalitypriority/p2Important but can be addressed in a future release.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions