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 - alternatively an API Key from Google Cloud and activate the Generative Language API for the project.
  2. You most likely need to create a project and enable the Generative Language API in addition to adding billing information, because the image generation API is not available for free.
warning

If you are utilizing a free API key, it is vital to have a payment method on file. The absence of a valid payment method is a frequent cause of errors during the setup process.

tip

Alternatively, if you are using Vertex AI, you can create an API key in Google Cloud instead of a service account. This key will function correctly, provided it is assigned the appropriate permissions. And given the Generative Language API is enabled for the project.

Configuring Open WebUI

  1. In Open WebUI, navigate to the Settings > Admin > Experience > Images menu.
  2. Set the Image Generation Engine field to Gemini.
  3. Set the Base URL to https://generativelanguage.googleapis.com/v1beta.
  4. Enter your Google AI Studio API key.
  5. Enter the model you wish to use, either an Imagen model or a Gemini model.
  6. Set the Gemini Endpoint Method to match that model: predict for Imagen, generateContent for Gemini.

Example Minimal Setup

Create Image

  • Model: gemini-3-pro-image-preview
  • Image Size: (not sent to Gemini, can be left empty)
  • Image Prompt Generation: on (Legacy function calling only)
  • Image Generation Engine: Gemini
  • Base URL: https://generativelanguage.googleapis.com/v1beta
  • API Key: Enter your API Key
  • Gemini Endpoint Method: generateContent

Edit Image

  • Image Edit: on
  • Image Edit Engine: Gemini
  • Model: gemini-3-pro-image-preview
  • Image Size: (not sent to Gemini, can be left empty)
  • Base URL: https://generativelanguage.googleapis.com/v1beta
  • API Key: Enter your API Key

Screenshot of the Open WebUI Images settings page with Gemini selected.

info

Imagen and Gemini models are served from different endpoints, so Gemini Endpoint Method has to match the model you entered.

Imagen models use predict:

Gemini models use generateContent:

Leaving the method empty falls back to predict, so a Gemini model such as gemini-3-pro-image-preview fails until you switch it to generateContent.

400: [ERROR: models/gemini-3-pro-image-preview 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 Settings > Admin > Experience > Images menu.
  2. Set the Image Generation Engine field to Default (Open AI).
  3. Change the API Base 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 Settings > Admin > AI > Connections menu. Your connection information will be listed under the Gemini API connection.

This content is for informational purposes only and does not constitute a warranty, guarantee, or contractual commitment. Open WebUI is provided "as is." See your license for applicable terms.