Skip to main content

Gemini

warning

This tutorial is a community contribution and is not supported by the Open WebUI team. It serves only as a demonstration on how to customize Open WebUI for your specific use case. Want to contribute? Check out the contributing tutorial.

Open WebUI also supports image generation through the Google AI Studio API also known as the Gemini API.

Initial Setup

  1. Obtain an API key from Google AI Studio.
  2. You may need to create a project and enable the Generative Language API in addition to adding billing information.

Configuring Open WebUI

  1. In Open WebUI, navigate to the Admin Panel > Settings > Images menu.
  2. Set the Image Generation Engine field to Gemini.
  3. Set the API Base URL to https://generativelanguage.googleapis.com/v1beta.
  4. Enter your Google AI Studio API key.
  5. Enter the model you wish to use from these available models.
  6. Set the image size to one of the available image sizes.

Screenshot of the Open WebUI Images settings page with Gemini selected and the API key, model, and image size fields highlighted.

info

This feature appears to only work for models supported with this endpoint: https://generativelanguage.googleapis.com/v1beta/models/<MODEL_NAME>:predict. This is the OpenAI BETA endpoint, which Google provides for experimental OpenAI compatibility.

Google Imagen models use this endpoint while Gemini models use a different endpoint ending with :generateContent

Imagen model endpoint example:

Gemini model endpoint example:

Trying to call a Gemini model, such as gemini-2.5-flash-image aka Nano Banana would result in an error due to the difference in supported endpoints for Image Generation.

400: [ERROR: models/gemini-2.5-flash-image is not found for API version v1beta, or is not supported for predict. Call ListModels to see the list of available models and their supported methods.]

LiteLLM Proxy with Gemini Endpoints

Image generation with a LiteLLM proxy using Gemini or Imagen endpoints is supported with Open WebUI. Configure the Image Generation as follows:

  1. In Open WebUI, navigate to the Admin Panel > Settings > Images menu.
  2. Set the Image Generation Engine field to Open AI.
  3. Change the API endpoint URL to https://<your-litellm-url>:<port>/v1.
  4. Enter your LiteLLM API key.
  5. The API version can be left blank.
  6. Enter the image model name as it appears in your LiteLLM configuration.
  7. Set the image size to one of the available sizes for the selected model.
tip

To find your LiteLLM connection information, navigate to the Admin Panel > Settings > Connections menu. Your connection information will be listed under the Gemini API connection.