mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[GH-ISSUE #18998] feat: Support Openrouter image generation #34268
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Joly0 on GitHub (Nov 6, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/18998
Check Existing Issues
Verify Feature Scope
Problem Description
It seems like it is currently not possible to use openrouter image generation endpoints in open-webui
Desired Solution you'd like
Being able to configure openrouter as a possible endpoint for open-webui.
Documentation is found here https://openrouter.ai/docs/features/multimodal/image-generation
Alternatives Considered
No response
Additional Context
No response
@Joly0 commented on GitHub (Nov 24, 2025):
@tjbck Which ticket is this a duplicate of? I cannot find any ticket that specifically asks for openrouter iamge generation support and it still does not work, even after latest update
@Joly0 commented on GitHub (Nov 24, 2025):
For example tried these settings after them being recommended on discord, but no luck
Also tried different endpoints or openai instead of gemini, but nothing works. Neither for nano banana nor for nano banana 2
@Classic298 commented on GitHub (Nov 25, 2025):
@Joly0 openrouter needs to be implemented differently with the new chunk size variables and base64 to img file variables introduced in .37
@Joly0 commented on GitHub (Nov 25, 2025):
@Classic298 Good to know, are there docs to follow? I havent found any working settings yet :(
@Classic298 commented on GitHub (Nov 25, 2025):
@Joly0
ENABLE_CHAT_RESPONSE_BASE64_IMAGE_URL_CONVERSION
Type: bool
Default: False
Description: When set to true, it automatically uploads base64-encoded images exceeding 1KB in markdown and converts them into image file URLs to reduce the size of response text. Some multimodal models directly output images as Base64 strings within the Markdown content. This results in larger response bodies, placing strain on CPU, network, Redis, and database resources.
CHAT_RESPONSE_STREAM_DELTA_CHUNK_SIZE
Type: int
Default: 1
Description: Sets a system-wide minimum value for the number of tokens to batch together before sending them to the client during a streaming response. This allows an administrator to enforce a baseline level of performance and stability across the entire system by preventing excessively small chunk sizes that can cause high CPU load. The final chunk size used for a response will be the highest value set among this global variable, the model's advanced parameters, or the per-chat settings. The default is 1, which applies no minimum batching at the global level.
https://docs.openwebui.com/getting-started/env-configuration
@Classic298 commented on GitHub (Nov 25, 2025):
and openrouter models should be directly implemented and NOT via the image config most likely
@Joly0 commented on GitHub (Nov 25, 2025):
What exactly do you mean with "directly implemented"? Are the settings i am trying to use in the admin interface the wrong place to configure that?
@Classic298 commented on GitHub (Nov 25, 2025):
@Joly0 for openrouter, yes.
you need to add the MODEL, as a model not as image generation.
Then it should work
@Joly0 commented on GitHub (Nov 25, 2025):
Hm, so i already have openrouter properly configured through the "Connection" admin settings, i assume you mean that. I have also set the mentioned env variables to "true" and "1" respectively and in a new chat session just picked the "Nano Banana Pro" model and asked it to generate an image (without enabling the image generation separately through the toggle in the chat input are), but now instead of an error saying that image generation threw an error, i get "Chunk is too big":
Anything else i need to configure? I thought this was covered in the last .37 update?
Also, will "native" support for openrouter image generation be implemented one day? I mean, thats what my feature request initially was about, so i do not have to select the image generation image separately but can just use the toggle as i was used to previously.
@Classic298 commented on GitHub (Nov 25, 2025):
sorry i quoted the wrong env var
CHAT_STREAM_RESPONSE_CHUNK_MAX_BUFFER_SIZE
Type: int
Default: Empty string (' '), which disables the limit (equivalent to None)
Description: Sets the maximum buffer size in bytes for handling stream response chunks. When a single chunk exceeds this limit, the system returns an empty JSON object and skips subsequent oversized data until encountering normally-sized chunks. This prevents memory issues when dealing with extremely large responses from certain providers (e.g., models like gemini-2.5-flash-image or services returning extensive web search data exceeding). Set to an empty string or a negative value to disable chunk size limitations entirely.
this one
set it to a very high number like the equivalent of 20 MB in byte.
@Joly0 commented on GitHub (Nov 25, 2025):
Found this https://github.com/open-webui/open-webui/issues/17626#issuecomment-3573639187
and also found the correct env variables there. Set them and it works now great. Just a weird bug, because i see the same image generated thrice now? Instead of only once.
Also, my second question still stands regarding "native" support for openrouter image generation
@Joly0 commented on GitHub (Nov 25, 2025):
@Classic298 commented on GitHub (Nov 25, 2025):
Sorry, what do you mean by this?
@Joly0 commented on GitHub (Nov 25, 2025):
I mean through the image generation settings instead of the normal model settings. So i do not have to change model, if i want to generate or edit an image, just have to enable the "Image generation" toggle in the chat input field.
@Classic298 commented on GitHub (Nov 25, 2025):
@ShirasawaSama any clue here why it renders three times?
@Joly0 commented on GitHub (Nov 25, 2025):
Not sure if its helpful, but dev tools network tab shows this:
@ShirasawaSama commented on GitHub (Nov 25, 2025):
Here are my environment variables:
Could you provide more context? For example, is the built-in image editing feature in OpenWebUI enabled?
https://github.com/open-webui/open-webui/issues/17626#issuecomment-3573639187
@Joly0 commented on GitHub (Nov 25, 2025):
Ah, yes, the built-in image generation/editing feature is enabled
Disabled that and now only getting 1 image
@davidpede commented on GitHub (Nov 26, 2025):
@Joly0 Can you explain exactly how you disabled the built-in image generation/editing feature? Have the same issue but have already toggled them both off in the admin panel:
@Joly0 commented on GitHub (Nov 26, 2025):
Did nothing else except disabling the toggle for the general image generation settings like you shown on your screenshot. I didn't change anything else.
Just disable, save, and then load a chat and it worked
@Joly0 commented on GitHub (Nov 27, 2025):
@Classic298 So aside from this issue with the multiple generated images, will openrouter image generation be natively supported through the admin image generation settings one day? My feature request was about that and was closed as dupliacte without an open duplicate existing (atleast couldnt find one). Would be cool, if this feature request could be re-opened or a new one be created.
Its annoying as an admin to tell users to select a specific model (which can change aswell) to use image generation. Its way easier to just tell them "enable the image toggle in the chat window", but that currently does not work with openrouter models
@Classic298 commented on GitHub (Nov 27, 2025):
No, probably not.
There is an open issue to it, i am not sure if tim is meaning to implement openrouter support here, let's see
https://github.com/open-webui/open-webui/issues/19522
@Seviks commented on GitHub (Jan 22, 2026):
@Joly0 Thanks to your information I got it working so far (as model), so thank you very much for sharing. We also would like to change aspect ratio and size of the image. Have you got that working? I tried setting image_config.image_size as a additional parameter with now luck (according to this doc: https://openrouter.ai/docs/guides/overview/multimodal/image-generation)