Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 2 additions & 65 deletions content/docs/configuration/librechat_yaml/ai_endpoints/azure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -471,72 +471,9 @@ To use Vision (image analysis) with Azure OpenAI, make sure `gpt-4-vision-previe

This works the same as it does with the [OpenAI endpoint](/docs/configuration/pre_configured_ai/openai): there is no need to select the vision model, as it will be switched behind the scenes.

### Generate images with Azure OpenAI Service (DALL-E)
### Generate images with Azure OpenAI Service

| Model ID | Feature Availability | Max Request (characters) |
|----------|----------------------|-------------------------|
| dalle2 | East US | 1000 |
| dalle3 | Sweden Central | 4000 |

- First you need to create an Azure resource that hosts DALL-E
- At the time of writing, dall-e-3 is available in the `SwedenCentral` region, dall-e-2 in the `EastUS` region.
- Then, you need to deploy the image generation model in one of the above regions.
- Read the [Azure OpenAI Image Generation Quickstart Guide](https://learn.microsoft.com/en-us/azure/ai-services/openai/dall-e-quickstart) for further assistance
- Configure your environment variables based on Azure credentials:

The DALL-E configuration options:

#### DALL-E:

**API Keys:**
<OptionTable
options={[
['DALLE_API_KEY', 'string', 'The OpenAI API key for DALL-E 2 and DALL-E 3 services.','# DALLE_API_KEY='],
]}
/>

**API Keys (Version Specific):**
<OptionTable
options={[
['DALLE3_API_KEY', 'string', 'The OpenAI API key for DALL-E 3.','# DALLE3_API_KEY='],
['DALLE2_API_KEY', 'string', 'The OpenAI API key for DALL-E 2.','# DALLE2_API_KEY='],
]}
/>

**System Prompts:**
<OptionTable
options={[
['DALLE3_SYSTEM_PROMPT', 'string', 'The system prompt for DALL-E 3.','# DALLE3_SYSTEM_PROMPT="Your DALL-E-3 System Prompt here"'],
['DALLE2_SYSTEM_PROMPT', 'string', 'The system prompt for DALL-E 2.','# DALLE2_SYSTEM_PROMPT="Your DALL-E-2 System Prompt here"'],
]}
/>

**Reverse Proxy Settings:**
<OptionTable
options={[
['DALLE_REVERSE_PROXY', 'string', 'The reverse proxy URL for DALL-E API requests.','# DALLE_REVERSE_PROXY='],
]}
/>

**Base URLs:**
<OptionTable
options={[
['DALLE3_BASEURL', 'string', 'The base URL for DALL-E 3 API endpoints. Supports both `.openai.azure.com` (legacy) and `.cognitiveservices.azure.com` (new) domain formats.','# DALLE3_BASEURL=https://<AZURE_OPENAI_API_INSTANCE_NAME>.openai.azure.com/openai/deployments/<DALLE3_DEPLOYMENT_NAME>/\n# OR\n# DALLE3_BASEURL=https://<AZURE_OPENAI_API_INSTANCE_NAME>.cognitiveservices.azure.com/openai/deployments/<DALLE3_DEPLOYMENT_NAME>/'],
['DALLE2_BASEURL', 'string', 'The base URL for DALL-E 2 API endpoints. Supports both `.openai.azure.com` (legacy) and `.cognitiveservices.azure.com` (new) domain formats.','# DALLE2_BASEURL=https://<AZURE_OPENAI_API_INSTANCE_NAME>.openai.azure.com/openai/deployments/<DALLE2_DEPLOYMENT_NAME>/\n# OR\n# DALLE2_BASEURL=https://<AZURE_OPENAI_API_INSTANCE_NAME>.cognitiveservices.azure.com/openai/deployments/<DALLE2_DEPLOYMENT_NAME>/'],
]}
/>

**Azure OpenAI Integration (Optional):**
<OptionTable
options={[
['DALLE3_AZURE_API_VERSION', 'string', 'The API version for DALL-E 3 with Azure OpenAI service.','# DALLE3_AZURE_API_VERSION=the-api-version # e.g.: 2023-12-01-preview'],
['DALLE2_AZURE_API_VERSION', 'string', 'The API version for DALL-E 2 with Azure OpenAI service.','# DALLE2_AZURE_API_VERSION=the-api-version # e.g.: 2023-12-01-preview'],
]}
/>

Replace placeholder text with actual prompts or instructions, and provide your API keys if you choose to include them directly in the file (managing sensitive keys outside of the codebase is recommended). Review and respect OpenAI's usage policies when embedding API keys in software.

> Note: if you have PROXY set, it will be used for DALL-E calls also, which is universal for the app.
Deploy an image model on Azure and point [OpenAI Image Tools](/docs/features/image_gen#openai-image-tools) at it with `IMAGE_GEN_OAI_BASEURL` and `IMAGE_GEN_OAI_AZURE_API_VERSION`; see its [setup](/docs/features/image_gen#setup).

### Serverless Inference Endpoints

Expand Down
3 changes: 1 addition & 2 deletions content/docs/configuration/tools/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ Start a chat with that agent and ask for something that requires the tool, such

| Tool | Use it for | Required configuration | Details |
|------|------------|------------------------|---------|
| OpenAI Image Tools | Generate and edit images with OpenAI image models | `IMAGE_GEN_OAI_API_KEY`; optional `IMAGE_GEN_OAI_MODEL` | [Image Generation](/docs/features/image_gen#1--openai-image-tools-recommended) |
| OpenAI Image Tools | Generate and edit images with OpenAI image models | `IMAGE_GEN_OAI_API_KEY`; optional `IMAGE_GEN_OAI_MODEL` | [Image Generation](/docs/features/image_gen#openai-image-tools) |
| Gemini Image Tools | Generate images and edit with image context using Gemini | `GEMINI_API_KEY`, `GOOGLE_KEY`, or `GOOGLE_SERVICE_KEY_FILE`; optional `GEMINI_IMAGE_MODEL` | [Gemini Image Generation](/docs/configuration/tools/gemini_image_gen) |
| DALL-E-3 | Legacy OpenAI image generation | `DALLE3_API_KEY` or `DALLE_API_KEY` | [DALL-E](/docs/features/image_gen#3--dalle-legacy) |
| Flux | Cloud image generation and fine-tuned image models | `FLUX_API_KEY`; optional `FLUX_API_BASE_URL` | [Flux](/docs/configuration/tools/flux) |
| Stable Diffusion | Local or self-hosted image generation through Automatic1111 | `SD_WEBUI_URL` | [Stable Diffusion](/docs/configuration/tools/stable_diffusion) |
| Google Search | Google Custom Search results for an agent | `GOOGLE_SEARCH_API_KEY` and `GOOGLE_CSE_ID` | [Google Search](/docs/configuration/tools/google_search) |
Expand Down
2 changes: 1 addition & 1 deletion content/docs/development/tools_and_plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const loadTools = async ({ user, model, tools = [], options = {} }) => {
calculator: Calculator,
google: GoogleSearchAPI,
wolfram: WolframAlphaAPI,
'dall-e': OpenAICreateImage,
flux: FluxAPI,
'stable-diffusion': StableDiffusionAPI // <----- Newly Added. Note: the key is the 'name' provided in the class.
// We will now refer to this name as the `pluginKey`
};
Expand Down
5 changes: 2 additions & 3 deletions content/docs/features/agents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,8 @@ For the type attribute, use one of:

Agents can also be enhanced with various built-in tools:

- **[OpenAI Image Tools](/docs/features/image_gen#openai-image-tools)**: Image generation & editing using **[GPT-Image-1](https://platform.openai.com/docs/models/gpt-image-1)**
- **[OpenAI Image Tools](/docs/features/image_gen#openai-image-tools)**: Image generation & editing with OpenAI image models
- **[Gemini Image Tools](/docs/configuration/tools/gemini_image_gen)**: Image generation and image-context editing using Gemini image models
- **[DALL-E-3](/docs/features/image_gen#dalle-legacy)**: Image generation from text descriptions
- **[Stable Diffusion](/docs/features/image_gen#stable-diffusion-local)** / **[Flux](/docs/features/image_gen#flux)**: Text-to-image generation
- **[Wolfram](/docs/configuration/tools/wolfram)**: Computational and mathematical capabilities
- **[OpenWeather](/docs/configuration/tools/openweather)**: Weather data retrieval
Expand All @@ -375,7 +374,7 @@ Agents can also be enhanced with various built-in tools:
2. Restart LibreChat so the new environment variables are loaded.
3. Select **Agents** from the endpoint menu.
4. Open the Agent Builder from the side panel and create or edit an agent.
5. Open the agent's **Tools** list, select **OpenAI Image Tools**, **Gemini Image Tools**, **DALL-E-3**, **Stable Diffusion**, or **Flux**, then save the agent.
5. Open the agent's **Tools** list, select **OpenAI Image Tools**, **Gemini Image Tools**, **Stable Diffusion**, or **Flux**, then save the agent.
6. Start a chat with that agent and ask it to generate or edit an image.

For the full image setup guide, including model variables such as `IMAGE_GEN_OAI_MODEL`, see [Image Generation & Editing](/docs/features/image_gen).
Expand Down
68 changes: 16 additions & 52 deletions content/docs/features/image_gen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Get image generation working in a few minutes with OpenAI Image Tools.

```bash filename=".env"
IMAGE_GEN_OAI_API_KEY=sk-your-openai-api-key
# Optional; defaults to gpt-image-1
IMAGE_GEN_OAI_MODEL=gpt-image-1
# Optional; defaults to gpt-image-2.5-flare
Comment thread
berry-13 marked this conversation as resolved.
IMAGE_GEN_OAI_MODEL=gpt-image-2.5-flare
```

</Step>
Expand Down Expand Up @@ -61,7 +61,7 @@ IMAGE_GEN_OAI_MODEL=gpt-image-1
- **Image Generation** creates brand-new images from text prompts (no upload required).
- **Image Editing** edits or remixes images you uploaded: change colors, add objects, extend the canvas, and more.

Both default to **GPT-Image-1** for instruction following, text rendering, detailed editing, and real-world knowledge. Use `IMAGE_GEN_OAI_MODEL` to choose a different OpenAI image model when your deployment supports it. See OpenAI's [Image Generation documentation](https://platform.openai.com/docs/guides/image-generation?image-generation-model=gpt-image-1) for more details.
Both default to `gpt-image-2.5-flare`. Use `IMAGE_GEN_OAI_MODEL` to choose a different OpenAI image model when your deployment supports it. OpenAI retires `gpt-image-1` on October 23, 2026, so remove it from `IMAGE_GEN_OAI_MODEL` if you set it explicitly. See OpenAI's [Image Generation documentation](https://platform.openai.com/docs/guides/image-generation) for more details.
Comment thread
berry-13 marked this conversation as resolved.
Comment thread
berry-13 marked this conversation as resolved.

### Generation vs. Editing

Expand All @@ -86,35 +86,39 @@ Both tools are always available, and the agent chooses the appropriate one based
**Image Generation**

- **prompt**: text description (required)
- **size**: `auto` (default), `1024x1024` (square), `1536x1024` (landscape), or `1024x1536` (portrait)
- **size**: `auto` (default), `1024x1024` (square), `1536x1024` (landscape), or `1024x1536` (portrait); models that support custom dimensions, such as `gpt-image-2.5-flare`, accept any `WIDTHxHEIGHT` within their limits, for example `2048x1152` or `3840x2160`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document the resize setting for custom dimensions

When a user requests the newly advertised 3840x2160 size, LibreChat still downsizes the saved image to a 768-pixel short edge by default—producing 1365x768 for 16:9—as confirmed in the LibreChat maintainer's explanation. Retaining the requested resolution requires fileConfig.imageGeneration.percentage: 100 (or an appropriate px cap), so document that requirement next to these examples; otherwise users will expect a 4K download but receive a resized file.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 8a5e923. Confirmed on LibreChat dev: tool images are saved through saveBase64Image with fileConfig.imageGeneration defaulting to 'high', which caps the short edge at 768px (resize.js), so 3840x2160 is stored at 1365x768. A callout under Parameters now says so and links fileConfig.imageGeneration with percentage: 100 or a px cap; the image-gen-default-model-matches-code scenario asserts the text and follows the link to #imagegeneration.

- **quality**: `auto` (default), `high`, `medium`, or `low`
- **background**: `auto` (default), `transparent`, or `opaque` (transparent requires PNG or WebP format)

**Image Editing**

- **image_ids**: array of image IDs to use as reference for editing (required)
- **prompt**: text description of the changes (required)
- **size**: `auto` (default), `1024x1024`, `1536x1024`, `1024x1536`, `256x256`, or `512x512`
- **size**: `auto` (default), `1024x1024`, `1536x1024`, or `1024x1536`; models that support custom dimensions accept any `WIDTHxHEIGHT` within their limits, for example `3840x2160`
- **quality**: `auto` (default), `high`, `medium`, or `low`

<Callout type="info" title="Keeping large sizes">
By default, LibreChat resizes saved images so their shorter side is at most 768 pixels, so a `3840x2160` result is stored at 1365x768. To keep the requested size, set [`fileConfig.imageGeneration`](/docs/configuration/librechat_yaml/object_structure/file_config#imagegeneration) to `percentage: 100`, or to a `px` cap large enough for your sizes.
</Callout>

### Setup

Create or reuse an OpenAI key and add it to `.env`, then add "OpenAI Image Tools" to your agent's **Tools** list:

```bash filename=".env"
IMAGE_GEN_OAI_API_KEY=sk-...
# optional extras
IMAGE_GEN_OAI_MODEL=gpt-image-1
IMAGE_GEN_OAI_MODEL=gpt-image-2.5-flare
IMAGE_GEN_OAI_BASEURL=https://...
```

For Azure OpenAI deployments, first request access at https://aka.ms/oai/gptimage1access, then add your credentials to `.env`:
For Azure OpenAI, deploy an image model in your Azure OpenAI resource, then add your credentials to `.env`. Set `IMAGE_GEN_OAI_MODEL` to the deployment name:

```bash filename=".env"
IMAGE_GEN_OAI_API_KEY=your-api-key
# optional extras
IMAGE_GEN_OAI_MODEL=gpt-image-1
IMAGE_GEN_OAI_BASEURL=https://deploymentname.openai.azure.com/openai/deployments/gpt-image-1/
IMAGE_GEN_OAI_MODEL=your-deployment-name
IMAGE_GEN_OAI_BASEURL=https://your-resource-name.openai.azure.com/openai/deployments/your-deployment-name/
IMAGE_GEN_OAI_AZURE_API_VERSION=2025-04-01-preview
```

Expand All @@ -124,7 +128,7 @@ Customize the tool descriptions and prompt guidance with these environment varia

```bash filename=".env"
# Image Model
IMAGE_GEN_OAI_MODEL=gpt-image-1
IMAGE_GEN_OAI_MODEL=gpt-image-2.5-flare

# Image Generation Tool Descriptions
IMAGE_GEN_OAI_DESCRIPTION=...
Expand All @@ -137,7 +141,7 @@ IMAGE_EDIT_OAI_PROMPT_DESCRIPTION=...

### Pricing

See the [GPT-Image-1 pricing page](https://platform.openai.com/docs/models/gpt-image-1) and [Image Generation documentation](https://platform.openai.com/docs/guides/image-generation?image-generation-model=gpt-image-1#cost-and-latency) for image generation costs.
See OpenAI's [API pricing page](https://openai.com/api/pricing/) and [Image Generation documentation](https://platform.openai.com/docs/guides/image-generation) for image generation costs.

## Gemini Image Tools

Expand Down Expand Up @@ -191,46 +195,6 @@ GEMINI_IMAGE_IDS_DESCRIPTION=...

More details are in the dedicated [Gemini Image Gen guide](/docs/configuration/tools/gemini_image_gen).

## DALL·E (legacy)

DALL·E provides legacy image generation using OpenAI's `dall-e-3` image model.

### Parameters

- **prompt**: text description of the desired image (required, up to 4000 characters)
- **style**: `vivid` (hyper-real, dramatic, default) or `natural` (less hyper-real)
- **quality**: `standard` (default) or `hd`
- **size**: `1024x1024` (default, square), `1792x1024` (wide), or `1024x1792` (tall)

### Setup

```bash filename=".env"
# 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
```

Enable the **DALL·E** tool for the agent and start prompting.

### Advanced Configuration

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

```bash filename=".env"
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
```

### Pricing

See the [DALL-E pricing page](https://platform.openai.com/docs/models/dall-e-3) and [Image Generation documentation](https://platform.openai.com/docs/guides/image-generation?image-generation-model=dall-e-3) for image generation costs.

## Stable Diffusion (local)

Run images entirely on your own machine or server. Point LibreChat at any Automatic1111 (or compatible) endpoint and you're set.
Expand Down Expand Up @@ -371,7 +335,7 @@ If a tool encounters an error, it returns a message explaining what went wrong.

## Prompting

You can customize the prompts for [OpenAI Image Tools](#advanced-configuration) and [DALL·E](#advanced-configuration-2), but the following tips inform the default prompts the tools supply, which is useful to know for your own writing:
You can customize the prompts for [OpenAI Image Tools](#advanced-configuration), but the following tips inform the default prompts the tool supplies, which is useful to know for your own writing:

1. Start with the **subject** and **style** (photo, oil painting, etc.).
2. Add **composition** and **camera/medium** ("wide-angle shot of…", "watercolour…").
Expand Down
57 changes: 57 additions & 0 deletions e2e/image-gen-verify.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { test, expect } from '@playwright/test'

test.describe('Image generation docs', () => {
test('@scenario:image-gen-page-has-no-dalle-setup no page documents the retired DALL-E tool', async ({
page,
}) => {
await page.goto('/docs/features/image_gen')
const main = page.locator('main')
await expect(page.getByRole('heading', { level: 1 }).first()).toBeVisible()
await expect(main.getByRole('heading', { name: /dall/i })).toHaveCount(0)
await expect(main).not.toContainText(/DALLE_API_KEY|DALLE3_/)

await page.goto('/docs/configuration/librechat_yaml/ai_endpoints/azure')
const azure = page.locator('main')
await expect(azure.getByRole('heading', { name: /generate images with azure/i })).toBeVisible()
await expect(azure).not.toContainText(/DALL-?E/i)
await expect(azure).toContainText('IMAGE_GEN_OAI_BASEURL')
})

test('@scenario:image-gen-default-model-matches-code the documented default is gpt-image-2.5-flare', async ({
page,
}) => {
await page.goto('/docs/features/image_gen')
const main = page.locator('main')
await expect(main).toContainText('defaults to gpt-image-2.5-flare')
await expect(main).not.toContainText('IMAGE_GEN_OAI_MODEL=gpt-image-1')
await expect(main).not.toContainText(/defaults? to \**gpt-image-1/i)
await expect(main).toContainText('accept any WIDTHxHEIGHT')
await expect(main).toContainText('stored at 1365x768')
const resizeLink = main.getByRole('link', { name: 'fileConfig.imageGeneration' })
await expect(resizeLink).toHaveAttribute('href', /file_config#imagegeneration$/)
await resizeLink.click()
await expect(page.locator('[id="imagegeneration"]')).toHaveCount(1)
})

test('@scenario:tools-table-and-agent-lists-omit-dalle feature cards and tool lists omit DALL-E and image links resolve', async ({
page,
}) => {
const anchors = new Set<string>()
for (const path of ['/docs/features', '/docs/configuration/tools', '/docs/features/agents']) {
await page.goto(path)
const main = page.locator('main')
await expect(page.getByRole('heading', { level: 1 }).first()).toBeVisible()
await expect(main).not.toContainText(/DALL-?E/i)
const hrefs = await main
.locator('a[href*="/docs/features/image_gen#"]')
.evaluateAll((links) => links.map((link) => link.getAttribute('href') ?? ''))
for (const href of hrefs) anchors.add(href.split('#')[1])
}

expect(anchors.size).toBeGreaterThan(0)
await page.goto('/docs/features/image_gen')
for (const anchor of anchors) {
await expect(page.locator(`[id="${anchor}"]`)).toHaveCount(1)
}
})
})
2 changes: 1 addition & 1 deletion lib/ui-i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ const en = {
items: {
imageGen: {
title: 'Image Generation',
description: 'Create images with GPT-Image-1, DALL-E, Stable Diffusion, and Flux',
description: 'Create images with GPT Image, Stable Diffusion, and Flux',
},
uploadAsText: {
title: 'Upload as Text',
Expand Down
2 changes: 1 addition & 1 deletion lib/ui-translations/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export const de: UIStrings = {
items: {
imageGen: {
title: 'Bildgenerierung',
description: 'Bilder erstellen mit GPT-Image-1, DALL-E, Stable Diffusion und Flux',
description: 'Bilder erstellen mit GPT Image, Stable Diffusion und Flux',
},
uploadAsText: {
title: 'Als Text hochladen',
Expand Down
2 changes: 1 addition & 1 deletion lib/ui-translations/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export const es: UIStrings = {
items: {
imageGen: {
title: 'Generación de imágenes',
description: 'Crea imágenes con GPT-Image-1, DALL-E, Stable Diffusion y Flux',
description: 'Crea imágenes con GPT Image, Stable Diffusion y Flux',
},
uploadAsText: {
title: 'Subir como texto',
Expand Down
2 changes: 1 addition & 1 deletion lib/ui-translations/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export const fr: UIStrings = {
items: {
imageGen: {
title: "Génération d'images",
description: 'Créez des images avec GPT-Image-1, DALL-E, Stable Diffusion et Flux',
description: 'Créez des images avec GPT Image, Stable Diffusion et Flux',
},
uploadAsText: {
title: 'Importer en tant que texte',
Expand Down
2 changes: 1 addition & 1 deletion lib/ui-translations/id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export const id: UIStrings = {
items: {
imageGen: {
title: 'Pembuatan gambar',
description: 'Buat gambar dengan GPT-Image-1, DALL-E, Stable Diffusion, dan Flux',
description: 'Buat gambar dengan GPT Image, Stable Diffusion, dan Flux',
},
uploadAsText: {
title: 'Unggah sebagai teks',
Expand Down
2 changes: 1 addition & 1 deletion lib/ui-translations/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export const it: UIStrings = {
items: {
imageGen: {
title: 'Generazione immagini',
description: 'Crea immagini con GPT-Image-1, DALL-E, Stable Diffusion e Flux',
description: 'Crea immagini con GPT Image, Stable Diffusion e Flux',
},
uploadAsText: {
title: 'Carica come testo',
Expand Down
Loading
Loading