Image Gen

optional extras

IMAGE_GEN_OAI_BASEURL=https://...

For Azure OpenAI deployments, you will first need access: https://aka.ms/oai/gptimage1access

Then, add your corresponding credentials to your .env file:


IMAGE_GEN_OAI_API_KEY=your-api-key

# optional extras

IMAGE_GEN_OAI_BASEURL=https://deploymentname.openai.azure.com/openai/deployments/gpt-image-1/
IMAGE_GEN_OAI_AZURE_API_VERSION=2025-04-01-preview

Then add “OpenAI Image Tools” to your Agent’s Tools list.

Advanced Configuration

You can customize the tool descriptions and prompt guidance by setting these environment variables:


# Image Generation Tool Descriptions

IMAGE_GEN_OAI_DESCRIPTION=...
IMAGE_GEN_OAI_PROMPT_DESCRIPTION=...

# Image Editing Tool Descriptions

IMAGE_EDIT_OAI_DESCRIPTION=...
IMAGE_EDIT_OAI_PROMPT_DESCRIPTION=...

Pricing

See the GPT-Image-1 pricing page and Image Generation Documentation for details on costs associated with image generation.


2 · Gemini Image Tools

Gemini Image Tools integrate Google’s latest image generation models, supporting both text-to-image generation and image context-aware editing.

Features

  • Text-to-Image Generation: Create high-quality images from detailed text descriptions
  • Image Context Support: Use existing images as context or inspiration for new generations
  • Image Editing: Generate new images based on modifications to existing ones (include original image ID)
  • Multiple Models: Choose between gemini-2.5-flash-image (default) or gemini-3-pro-image-preview
  • Dual API Support: Works with both simple Gemini API keys and Google Cloud Vertex AI

Parameters

prompt – Detailed text description of the desired image (required, up to 32,000 characters)

image_ids – Optional array of image IDs to use as visual context for generation

Setup

Get an API key from Google AI Studio:


GEMINI_API_KEY=your_api_key_here

Option 2: Vertex AI (Enterprise)

For Google Cloud users with Vertex AI access:


GOOGLE_SERVICE_KEY_FILE=/path/to/service-account.json
GOOGLE_CLOUD_LOCATION=us-central1 # optional, default: global

Model Selection


# Default model (fast and efficient)

GEMINI_IMAGE_MODEL=gemini-2.5-flash-image

# Higher quality model

GEMINI_IMAGE_MODEL=gemini-3-pro-image-preview

Advanced Configuration

Customize tool descriptions via environment variables:


GEMINI_IMAGE_GEN_DESCRIPTION=...
GEMINI_IMAGE_GEN_PROMPT_DESCRIPTION=...
GEMINI_IMAGE_IDS_DESCRIPTION=...

More details can be found in the dedicated Gemini Image Gen guide.


3 · DALL·E (legacy)

DALL·E provides high-quality image generation using OpenAI’s legacy image models.

Parameters

prompt – Text description of the desired image (required, up to 4000 characters)

stylevivid (hyper-real, dramatic - default) or natural (less hyper-real)

qualitystandard (default) or hd

size1024x1024 (default/square), 1792x1024 (wide), or 1024x1792 (tall)

Setup


# Required

DALLE_API_KEY=sk-... # or DALLE3_API_KEY=sk-...

# Optional

DALLE_REVERSE_PROXY=https://... # Alternative endpoint
DALLE3_BASEURL=https://... # For Azure or custom endpoints
DALLE3_AZURE_API_VERSION=2023-12-01-preview # For Azure deployments
DALLE3_SYSTEM_PROMPT=... # Custom system prompt for DALL·E

Advanced Configuration

For Azure OpenAI deployments, configure both the base URL and API version:


DALLE3_BASEURL=https://your-resource-name.openai.azure.com/openai/deployments/your-deployment-name
DALLE3_AZURE_API_VERSION=2023-12-01-preview
DALLE3_API_KEY=your-azure-api-key

Enable the DALL·E tool for the Agent and start prompting.

Pricing

See the DALL-E pricing page and Image Generation Documentation for details on costs associated with image generation.


4 · Stable Diffusion (local)

Run images entirely on your own machine or server.

Point LibreChat at any Automatic1111 (or compatible) endpoint and you’re set.

Parameters

prompt – Detailed keywords describing desired elements in the image (required)

negative_prompt – Keywords describing elements to exclude from the image (required)

The Stable Diffusion implementation uses these default parameters:

  • cfg_scale: 4.5
  • steps: 22
  • width: 1024
  • height: 1024

These values are currently fixed but provide good results for most use cases.

Setup


SD_WEBUI_URL=http://127.0.0.1:7860 # URL to your Automatic1111 WebUI

No API key required—just the reachable URL.

More details on setting up Automatic1111 can be found in the dedicated Stable Diffusion guide.


5 · Flux

Cloud generator with an emphasis on speed and optional fine-tuned models.

Features

  • Fast cloud-based image generation
  • Support for fine-tuned models
  • Multiple quality levels and aspect ratios
  • Raw mode for less processed, more natural-looking images

Parameters

The Flux tool supports three main actions:

  1. generate - Create a new image from a text prompt
  2. generate_finetuned - Create an image using a fine-tuned model
  3. list_finetunes - List available custom models for the user

More details can be found in the dedicated Flux guide.

Setup


FLUX*API_KEY=flux_live*...
FLUX_API_BASE_URL=https://api.us1.bfl.ai # default is fine for most users

Choose the Flux tool inside the Agent. Prompts are plain text; one call produces one image.

Pricing

See the Flux pricing page for details on costs associated with image generation.


6 · Model Context Protocol (MCP)

Image outputs are supported from MCP servers.

For example, the Puppeteer MCP Server can be used to generate screenshots of web pages, which correctly output the image in the expected format and is treated the same as LC’s built-in image tools.

The examples below assume LibreChat is running outside of Docker, directly using Node.js. The Model Context Protocol is a relatively new framework, and many developers are still learning how to properly serve their systems with uv/node for scalable distribution.

As this technology is still emerging, there are currently few image-generating servers available, and many existing ones have yet to adopt the correct response format for images.

While many MCP servers do function well within Docker, the following examples do not, or not without more advanced configurations, showcasing some of the current inconsistency between MCP servers.


mcpServers:
puppeteer:
command: npx
args: - -y - "@modelcontextprotocol/server-puppeteer"

The following is an example of an Image Generation server that outputs images using Replicate API, but returns URLs of the images, which doesn’t conform to MCP’s image response standard.

Note: for this particular server, you need to install the @gongrzhe/image-gen-server package globally using npm, i.e. npm install -g @gongrzhe/image-gen-server, then point to the package’s compiled files as shown below.


mcpServers:
image-gen:
command: "node" # First, install the package globally using npm: # `npm install -g @gongrzhe/image-gen-server` # Then, point to the location of the installed package, # which you can find by running `npm root -g`
args: - "`REPLACE_WITH_NODE_MODULES_LOCATION`/@gongrzhe/image-gen-server/build/index.js" # Example with output from `npm root -g`: # - "/home/danny/.nvm/versions/node/v20.19.0/lib/node_modules/@gongrzhe/image-gen-server/build/index.js"
env: # Do not hardcode the API token here, use the environment variable instead # The following will pick up the token from your .env file or environment
REPLICATE_API_TOKEN: "$`REPLICATE_API_TOKEN`"
MODEL: "google/imagen-3"

Image Storage and Handling

All generated images are:

  1. Saved according to the configured fileStrategy
  2. Displayed directly in the chat interface
  3. Image tool outputs are directly sent to the LLM as part of the immediate chat context following generation.
  • This may create issues if you are using an LLM that does not support image inputs.
  • There will be an option to disable this behavior on a per-agent-basis in the future.
  • These outputs are only directly sent to the LLM upon generation, not on every message.
  • To include the image in the chat, you can directly attach it to the message from the side panel.
  • To summarize, the LLM will only get vision context from images attached to user messages, and not from generations/edits, except for immediately after generation.

Proxy Support

All image generation tools support proxy configuration through the PROXY environment variable:


PROXY=http://proxy-url:port

Error Handling

If any of the tools encounter an error, they will return an error message explaining what went wrong. Common issues include:

  • Invalid API key
  • API unavailability
  • Content policy violations
  • Proxy/network issues
  • Invalid parameters
  • Unsupported image payload (see Image Storage and Handling above)

Prompting

Though you can customize the prompts for OpenAI Image Tools and DALL·E, the following tips inform the default prompts supplied by the tools, which is helpful to know for your own writing/prompting.

  1. Start with the subject and style (photo, oil painting, etc.).
  2. Add composition and camera / medium (“wide-angle shot of…”, “watercolour…”).
  3. Mention lighting & mood (“golden hour”, “dramatic shadows”).
  4. Finish with detail keywords (textures, colours, expressions).
  5. Keep negatives positive—describe what should be included, not what to avoid.

Example:

A cinematic photo of an antique library bathed in warm afternoon sunlight. Tall wooden shelves overflow with leather-bound books, and dust particles shimmer in the light. A single green-shaded banker’s lamp illuminates an open atlas on a polished mahogany desk in the foreground. 85 mm lens, shallow depth of field, rich amber tones, ultra-high detail.

Last updated on January 3, 2026

Memory Upload as Text

On this page