mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[GH-ISSUE #18671] issue: Image Generation Display Issue with OpenRouter.ai API (Multimodal Output) #34195
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 @aiinsightec on GitHub (Oct 27, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/18671
Check Existing Issues
Installation Method
Git Clone
Open WebUI Version
v0.6.34
Ollama Version (if applicable)
No response
Operating System
Ubuntu 22.04
Browser (if applicable)
Chrome
Confirmation
README.md.Expected Behavior
Hi team,
I'm experiencing an issue with generated images in OpenWebUI when using models from OpenRouter.ai that support multimodal output (specifically image generation).
Problem Description:
When I configure OpenWebUI to use an OpenRouter.ai API key with image-capable models (e.g., google/gemini-2.5-flash-image-preview), the text responses are displayed correctly, but the generated images are not visible in the chat interface. I'm using a custom proxy that normalizes OpenRouter's multimodal responses into a format that should be compatible with OpenAI-like API structures.
Expected Behavior:
Images generated by OpenRouter.ai models should be displayed within the OpenWebUI chat interface, similar to how they would appear with OpenAI DALL-E or other image generation integrations.
Steps to Reproduce (if applicable):
Configure OpenWebUI with an OpenRouter.ai API key (or through a proxy).
Select an image generation capable model (e.g., google/gemini-2.5-flash-image-preview).
Send a prompt requesting an image ( "Generate a beautiful sunset over mountains").
Observe that only text content (if any) is displayed, but no image appears.
Context and Details:
OpenRouter.ai Response Format: OpenRouter.ai returns image generation responses in the message.images field, where images is an array of objects. Each object contains an image_url field, which in turn has a url field containing a data:image/png;base64,... string. You can find their documentation here: OpenRouter Image Generation Documentation
Example of OpenRouter's image response structure:
json
Proxy Conversion (if applicable): My proxy ensures that binary responses from other models (or direct base64 responses from Gemini's inline_data) are also converted into this message.images structure, or an OpenAI /data[].b64_json like structure. I've also implemented a conversion from URLs to base64 when the upstream API provides image URLs instead of direct base64 data.
Troubleshooting done:
Confirmed OpenRouter.ai API is returning valid image data (base64 URLs).
Checked network requests in browser developer tools; the responses coming into OpenWebUI contain the expected JSON structure with base64 image data.
Verified that the content field is present alongside the images field in the message object when images are generated.
Tested with various image prompts and models.
I suspect there might be a specific parsing requirement in OpenWebUI for handling multimodal especially from non-OpenAI APIs, or potentially a rendering issue with data:image/png;base64 URLs under certain conditions within the UI components.
Could you please provide guidance on the expected JSON structure for image generation responses for OpenWebUI, or suggest any specific configurations or known issues related to displaying images from custom API endpoints/proxies?
Thank you for your time and assistance!
Actual Behavior
Hi team,
I'm experiencing an issue with generated images in OpenWebUI when using models from OpenRouter.ai that support multimodal output (specifically image generation).
Problem Description:
When I configure OpenWebUI to use an OpenRouter.ai API key with image-capable models (e.g., google/gemini-2.5-flash-image-preview), the text responses are displayed correctly, but the generated images are not visible in the chat interface. I'm using a custom proxy that normalizes OpenRouter's multimodal responses into a format that should be compatible with OpenAI-like API structures.
Expected Behavior:
Images generated by OpenRouter.ai models should be displayed within the OpenWebUI chat interface, similar to how they would appear with OpenAI DALL-E or other image generation integrations.
Steps to Reproduce (if applicable):
Configure OpenWebUI with an OpenRouter.ai API key (or through a proxy).
Select an image generation capable model (e.g., google/gemini-2.5-flash-image-preview).
Send a prompt requesting an image ( "Generate a beautiful sunset over mountains").
Observe that only text content (if any) is displayed, but no image appears.
Context and Details:
OpenRouter.ai Response Format: OpenRouter.ai returns image generation responses in the message.images field, where images is an array of objects. Each object contains an image_url field, which in turn has a url field containing a data:image/png;base64,... string. You can find their documentation here: OpenRouter Image Generation Documentation
Example of OpenRouter's image response structure:
json
{
"choices": [
{
"message": {
"role": "assistant",
"content": "I've generated a beautiful sunset image for you.",
"images": [
{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}
}
]
}
}
]
}
Proxy Conversion (if applicable): My proxy ensures that binary responses from other models (or direct base64 responses from Gemini's inline_data) are also converted into this message.images structure, or an OpenAI /data[].b64_json like structure. I've also implemented a conversion from URLs to base64 when the upstream API provides image URLs instead of direct base64 data.
Troubleshooting done:
Confirmed OpenRouter.ai API is returning valid image data (base64 URLs).
Checked network requests in browser developer tools; the responses coming into OpenWebUI contain the expected JSON structure with base64 image data.
Verified that the content field is present alongside the images field in the message object when images are generated.
Tested with various image prompts and models.
I suspect there might be a specific parsing requirement in OpenWebUI for handling multimodal especially from non-OpenAI APIs, or potentially a rendering issue with data:image/png;base64 URLs under certain conditions within the UI components.
Could you please provide guidance on the expected JSON structure for image generation responses for OpenWebUI, or suggest any specific configurations or known issues related to displaying images from custom API endpoints/proxies?
Thank you for your time and assistance!
Steps to Reproduce
.
Logs & Screenshots
.
Additional Information
No response
@outis151 commented on GitHub (Oct 27, 2025):
Seems like a duplicate of #16935