Skip to content

Support for proxy URL for gemini #1878

Open
@alianos-

Description

OpenAI and Anthropic each have ENV variables that you can set in the .env file and their clients will pick them over the default if they are set.

The Gemini client however does not do that, so in order to provide a custom host URL it needs to be passed explicitly on gemini client instantiation.

The code changes for the chatbot to support this are negligible but I am not sure how to contribute, and, I think one of the files I changed should not be edited directly. In essence all we need to do is add the env variable, and then pass it to the gemini client with the following change

from

    const googleModel = genAI.getGenerativeModel(
      { model: chatSettings.model }
    )

to

    const googleModel = genAI.getGenerativeModel(
      { model: chatSettings.model },
      { baseUrl: profile.google_gemini_base_url }
    )

I attached a diff.txt file so maybe a dev can try git apply diff.txt or even copy by hand, it's like 4 changed lines to support this.
diff.txt

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions