[PR #22065] [CLOSED] feat: Add ModelsLab as image generation engine #49506

Closed
opened 2026-04-30 01:48:06 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22065
Author: @adhikjoshi
Created: 3/1/2026
Status: Closed

Base: mainHead: feat/modelslab-image-engine


📝 Commits (1)

  • a41aa73 feat: Add ModelsLab as image generation engine

📊 Changes

3 files changed (+118 additions, -0 deletions)

View changed files

📝 backend/open_webui/config.py (+6 -0)
📝 backend/open_webui/routers/images.py (+90 -0)
📝 src/lib/components/admin/Settings/Images.svelte (+22 -0)

📄 Description

contributor license agreement

Summary

Adds ModelsLab (https://modelslab.com) as a new image generation engine option in Open WebUI, following the existing Gemini engine pattern.

ModelsLab is an AI generation API platform providing access to Flux, SDXL, Stable Diffusion 3.5, and 100+ community models for image, video, and audio generation.

Changes

backend/open_webui/config.py

  • Adds IMAGES_MODELSLAB_API_KEY (PersistentConfig) — supports IMAGES_MODELSLAB_API_KEY env var

backend/open_webui/routers/images.py

  • get_image_model(): Default model is flux
  • get_models(): Returns 6 pre-configured models (Flux, Flux Pro, SDXL, SD 3.5, Realistic Vision, JuggernautXL)
  • ImagesConfig: Adds IMAGES_MODELSLAB_API_KEY: str
  • GET + UPDATE /config: Read/write the API key
  • image_generations(): Full ModelsLab API call with async polling

src/lib/components/admin/Settings/Images.svelte

  • Engine dropdown: adds ModelsLab option
  • Config section: API key input shown when ModelsLab is selected

API Details

  • Auth: Key-in-body ({"key": "API_KEY"}) — not Bearer header
  • Endpoint: POST https://modelslab.com/api/v6/images/text2img
  • Async polling: If status: processing, polls /images/fetch/{request_id} every 5s (up to 300s)
  • Docs: https://docs.modelslab.com

Setup (after merge)

  1. Go to Admin → Settings → Images
  2. Set Image Generation Engine to ModelsLab
  3. Enter your IMAGES_MODELSLAB_API_KEY
  4. Select a model (Flux, SDXL, etc.)
  5. Generate images from any chat

Checklist

  • Follows existing Gemini engine pattern
  • Key-in-body auth (matches ModelsLab's API design)
  • Async polling for slow generations
  • Config persisted via PersistentConfig
  • Frontend: dropdown option + API key input
  • No breaking changes

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/22065 **Author:** [@adhikjoshi](https://github.com/adhikjoshi) **Created:** 3/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/modelslab-image-engine` --- ### 📝 Commits (1) - [`a41aa73`](https://github.com/open-webui/open-webui/commit/a41aa733b2ebdf50b0dfcb2008786787111ed52c) feat: Add ModelsLab as image generation engine ### 📊 Changes **3 files changed** (+118 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+6 -0) 📝 `backend/open_webui/routers/images.py` (+90 -0) 📝 `src/lib/components/admin/Settings/Images.svelte` (+22 -0) </details> ### 📄 Description contributor license agreement ## Summary Adds **ModelsLab** (https://modelslab.com) as a new image generation engine option in Open WebUI, following the existing Gemini engine pattern. ModelsLab is an AI generation API platform providing access to Flux, SDXL, Stable Diffusion 3.5, and 100+ community models for image, video, and audio generation. ## Changes ### `backend/open_webui/config.py` - Adds `IMAGES_MODELSLAB_API_KEY` (`PersistentConfig`) — supports `IMAGES_MODELSLAB_API_KEY` env var ### `backend/open_webui/routers/images.py` - **`get_image_model()`**: Default model is `flux` - **`get_models()`**: Returns 6 pre-configured models (Flux, Flux Pro, SDXL, SD 3.5, Realistic Vision, JuggernautXL) - **`ImagesConfig`**: Adds `IMAGES_MODELSLAB_API_KEY: str` - **GET + UPDATE `/config`**: Read/write the API key - **`image_generations()`**: Full ModelsLab API call with async polling ### `src/lib/components/admin/Settings/Images.svelte` - Engine dropdown: adds **ModelsLab** option - Config section: API key input shown when ModelsLab is selected ## API Details - **Auth**: Key-in-body (`{"key": "API_KEY"}`) — not Bearer header - **Endpoint**: `POST https://modelslab.com/api/v6/images/text2img` - **Async polling**: If `status: processing`, polls `/images/fetch/{request_id}` every 5s (up to 300s) - **Docs**: https://docs.modelslab.com ## Setup (after merge) 1. Go to **Admin → Settings → Images** 2. Set **Image Generation Engine** to **ModelsLab** 3. Enter your `IMAGES_MODELSLAB_API_KEY` 4. Select a model (Flux, SDXL, etc.) 5. Generate images from any chat ## Checklist - [x] Follows existing Gemini engine pattern - [x] Key-in-body auth (matches ModelsLab's API design) - [x] Async polling for slow generations - [x] Config persisted via `PersistentConfig` - [x] Frontend: dropdown option + API key input - [x] No breaking changes --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-30 01:48:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#49506