Appearance
Image Generation
Overview
GhostAI supports multi-provider image generation directly in chat. Choose from multiple image models across different providers, and your selection is automatically saved so it persists across sessions.
Image prompts are privacy-protected through the same PII detection pipeline used for text, preventing accidental data leakage through image generation requests.
Availability
Image generation is available on Personal and above when a valid provider key is configured. The image generation tool must be enabled in the chat toolbar.
Supported Image Models
Direct Provider Models
| Model | Provider | Key Required | Notes |
|---|---|---|---|
| DALL-E 3 | OpenAI | openai | High-quality, prompt-following, multiple sizes |
| Gemini 2.5 Flash Image | Google Gemini | gemini | Native Gemini image generation, fast |
OpenRouter Models
These models are accessed through your OpenRouter API key:
| Model | Provider | Notes |
|---|---|---|
| Flux 2 Pro | Black Forest Labs | State-of-the-art open model |
| GPT-5 Image Mini | OpenAI (via OpenRouter) | Lightweight OpenAI image generation |
| Seedream 3.0 | ByteDance | High-quality Asian art styles |
| Stable Diffusion 3.5 Large | Stability AI | Open-source, highly customizable |
OpenRouter Gateway
OpenRouter provides access to many image models with a single API key. If you have an OpenRouter key configured, these models appear automatically in the image model selector.
Selecting an Image Model
Image Model Selector
The image model selector appears in the chat toolbar when the Image Generation tool is enabled. Click the selector dropdown to choose from available models.
Your selected model is automatically saved to your user preferences and restored when you return to GhostAI -- even across browser sessions and devices.
Enabling the Image Tool
- Look for the tool toggles in the chat toolbar (below the message input)
- Enable Image Generation (camera icon)
- The image model selector appears next to the tool toggles
- Select your preferred model from the dropdown
Model Availability
Models appear in the selector based on which provider keys you have configured:
| If You Have... | You Can Use... |
|---|---|
| OpenAI key | DALL-E 3 |
| Gemini key | Gemini 2.5 Flash Image (direct) |
| OpenRouter key | Flux 2 Pro, GPT-5 Image Mini, Seedream, Stable Diffusion, Gemini (via OpenRouter) |
| No keys | Platform default models (if cloud keys are configured) |
How It Works
Generation Flow
User prompt → PII Detection → Tokenized prompt → Image Model API → Image saved to disk → URL returned in chat- PII Protection -- Your image prompt passes through the PII detection pipeline
- Model Routing -- GhostAI routes the request to the correct provider based on your selected model
- Key Resolution -- The system resolves the appropriate API key using the multi-tier hierarchy (User > Org > Cloud, where environment keys are registered as platform defaults)
- Image Generation -- The provider generates the image
- Disk Storage -- Generated images are saved to the server's persistent storage
- Chat Display -- The image URL is returned and displayed inline in the chat
Image Storage
Generated images are stored on the server and served via static file URLs. This approach:
- Avoids large base64 data in chat messages
- Enables reliable browser rendering
- Supports image caching and CDN delivery in production
- Keeps chat history lightweight
Persistent Model Selection
Your image model preference is saved to your user settings on the backend:
- Saved automatically when you change the model selector
- Restored on load in both regular chat and comparison chat
- Per-user -- each user has their own preference
- Synced via API -- uses the
PUT /api/settings/model-config/userendpoint with thedefault_image_modelfield
Using in Comparison Chat
Image generation works in comparison chat mode too. When comparing models:
- Each model pane generates its own unique image independently
- The same image model is used across all panes (your selected preference)
- Results are routed to the correct pane using unique pane indices
- You can compare how different LLMs interpret and describe the same image generation task
Provider Key Requirements
To use image generation, you need at least one of these keys configured:
| Provider | Key Type | Where to Get It |
|---|---|---|
| OpenAI | API Key (sk-proj-...) | platform.openai.com/api-keys |
| Google Gemini | API Key (AIza...) | aistudio.google.com/apikey |
| OpenRouter | API Key (sk-or-v1-...) | openrouter.ai/keys |
Keys can be configured at any tier:
- Personal -- Settings > Provider Keys > User
- Organization -- Settings > Provider Keys > Organization (admin)
- Platform -- Settings > Provider Keys > Cloud (cloud admin)
See Bring Your Own Key for details on key management.
Error Handling
If image generation fails, GhostAI:
- Shows an error message in the chat with the failure reason
- Creates an in-app notification alerting you to the issue
- Logs the failure for key health monitoring
- The health system may mark the key as degraded or unhealthy after repeated failures
Common failure reasons:
| Error | Cause | Fix |
|---|---|---|
| "API key not configured" | No key available for the selected model's provider | Add a key in Settings > Provider Keys |
| "Rate limit exceeded" | Too many requests to the provider | Wait and retry, or switch models |
| "Content policy violation" | Provider rejected the prompt | Rephrase the prompt |
| "Insufficient quota" | Provider account out of credits | Top up your provider account |
FAQ
Can I use different image models in different chats?
Your image model selection is global (per-user). Changing the model affects all new image generations. Previously generated images are not affected.
Do generated images contain my PII?
No. Image prompts pass through PII detection and tokenization before being sent to the provider. The provider never sees your original sensitive data.
Where are generated images stored?
Images are stored on the GhostAI server in the data/generated_images/ directory and served via /api/generated-images/. In production deployments, this can be backed by cloud storage.
Can my organization admin control which image models are available?
Yes. Organization admins can lock or disable specific providers, which affects which image models appear in the selector. For example, disabling the OpenAI provider hides DALL-E 3.