Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🪦 chore: Retire the DALL-E 3 Tool (#17205)
Marco Berettaaec11338e617
diff --git a/.env.example b/.env.exampleindex d326385ca3..75806a2862 100644--- a/.env.example+++ b/.env.example@@ -694,23 +694,6 @@ AZURE_AI_SEARCH_SEARCH_OPTION_SELECT=# IMAGE_GEN_OAI_PROMPT_DESCRIPTION=Custom prompt description for image generation tool# IMAGE_EDIT_OAI_PROMPT_DESCRIPTION=Custom prompt description for image editing tool-# DALL·E-#-----------------# DALLE_API_KEY=-# DALLE3_API_KEY=-# DALLE2_API_KEY=-# DALLE3_SYSTEM_PROMPT=-# DALLE2_SYSTEM_PROMPT=-# DALLE_REVERSE_PROXY=-# DALLE3_BASEURL=-# DALLE2_BASEURL=--# DALL·E (via Azure OpenAI)-# Note: requires some of the variables above to be set-#-----------------# DALLE3_AZURE_API_VERSION=-# DALLE2_AZURE_API_VERSION=-# Flux#-----------------FLUX_API_BASE_URL=https://api.us1.bfl.aidiff --git a/README.md b/README.mdindex 2caf010296..67dd3b4393 100644--- a/README.md+++ b/README.md@@ -110,7 +110,7 @@ Read the [full v0.8.8 changelog](https://www.librechat.ai/changelog/v0.8.8).- 🎨 **Image Generation & Editing**- Text-to-image and image-to-image with [GPT-Image-1](https://www.librechat.ai/docs/features/image_gen#1--openai-image-tools-recommended)- - Text-to-image with [DALL-E (3/2)](https://www.librechat.ai/docs/features/image_gen#2--dalle-legacy), [Stable Diffusion](https://www.librechat.ai/docs/features/image_gen#3--stable-diffusion-local), [Flux](https://www.librechat.ai/docs/features/image_gen#4--flux), or any [MCP server](https://www.librechat.ai/docs/features/image_gen#5--model-context-protocol-mcp)+ - Text-to-image with [Stable Diffusion](https://www.librechat.ai/docs/features/image_gen#3--stable-diffusion-local), [Flux](https://www.librechat.ai/docs/features/image_gen#4--flux), or any [MCP server](https://www.librechat.ai/docs/features/image_gen#5--model-context-protocol-mcp)- Produce stunning visuals from prompts or refine existing images with a single instruction- 💾 **Presets & Context Management**:diff --git a/README.zh.md b/README.zh.mdindex 4b49693156..982f2ad626 100644--- a/README.zh.md+++ b/README.zh.md@@ -92,7 +92,7 @@- 🎨 **图像生成与编辑**:- 使用 [GPT-Image-1](https://www.librechat.ai/docs/features/image_gen#1--openai-image-tools-recommended) 进行文生图与图生图。- - 支持 [DALL-E (3/2)](https://www.librechat.ai/docs/features/image_gen#2--dalle-legacy), [Stable Diffusion](https://www.librechat.ai/docs/features/image_gen#3--stable-diffusion-local), [Flux](https://www.librechat.ai/docs/features/image_gen#4--flux) 或任何 [MCP 服务器](https://www.librechat.ai/docs/features/image_gen#5--model-context-protocol-mcp)。+ - 支持 [Stable Diffusion](https://www.librechat.ai/docs/features/image_gen#3--stable-diffusion-local), [Flux](https://www.librechat.ai/docs/features/image_gen#4--flux) 或任何 [MCP 服务器](https://www.librechat.ai/docs/features/image_gen#5--model-context-protocol-mcp)。- 根据提示词生成惊艳的视觉效果,或通过指令精修现有图像。- 💾 **预设与上下文管理**:diff --git a/api/app/clients/tools/index.js b/api/app/clients/tools/index.jsindex bb58e81221..709b5d1b6e 100644--- a/api/app/clients/tools/index.js+++ b/api/app/clients/tools/index.js@@ -1,7 +1,6 @@const manifest = require('./manifest');// Structured Tools-const DALLE3 = require('./structured/DALLE3');const FluxAPI = require('./structured/FluxAPI');const OpenWeather = require('./structured/OpenWeather');const StructuredWolfram = require('./structured/Wolfram');@@ -16,7 +15,6 @@ const createGeminiImageTool = require('./structured/GeminiImageGen');module.exports = {...manifest,// Structured Tools- DALLE3,FluxAPI,OpenWeather,StructuredSD,diff --git a/api/app/clients/tools/manifest.json b/api/app/clients/tools/manifest.jsonindex 4b3c57ce17..c6ffa08c1c 100644--- a/api/app/clients/tools/manifest.json+++ b/api/app/clients/tools/manifest.json@@ -57,19 +57,6 @@}]},- {- "name": "DALL-E-3",- "pluginKey": "dalle",- "description": "[DALL-E-3] Create realistic images and art from a description in natural language",- "icon": "assets/openai.svg",- "authConfig": [- {- "authField": "DALLE3_API_KEY||DALLE_API_KEY",- "label": "OpenAI API Key",- "description": "You can use DALL-E with your API Key from OpenAI."- }- ]- },{"name": "Tavily Search","pluginKey": "tavily_search_results_json",diff --git a/api/app/clients/tools/structured/DALLE3.js b/api/app/clients/tools/structured/DALLE3.jsdeleted file mode 100644index 5bcd87a0ce..0000000000--- a/api/app/clients/tools/structured/DALLE3.js+++ /dev/null@@ -1,257 +0,0 @@-const path = require('path');-const OpenAI = require('openai');-const { v4: uuidv4 } = require('uuid');-const { fetch } = require('undici');-const { logger } = require('@librechat/data-schemas');-const { Tool } = require('@librechat/agents/langchain/tools');-const {- getImageBasename,- extractBaseURL,- getProxyDispatcher,- getEnvProxyDispatcher,- createMinimalRetentionRequest,-} = require('@librechat/api');-const { FileContext, ContentTypes } = require('librechat-data-provider');--const dalle3JsonSchema = {- type: 'object',- properties: {- prompt: {- type: 'string',- maxLength: 4000,- description:- 'A text description of the desired image, following the rules, up to 4000 characters.',- },- style: {- type: 'string',- enum: ['vivid', 'natural'],- description:- 'Must be one of `vivid` or `natural`. `vivid` generates hyper-real and dramatic images, `natural` produces more natural, less hyper-real looking images',- },- quality: {- type: 'string',- enum: ['hd', 'standard'],- description: 'The quality of the generated image. Only `hd` and `standard` are supported.',- },- size: {- type: 'string',- enum: ['1024x1024', '1792x1024', '1024x1792'],- description:- 'The size of the requested image. Use 1024x1024 (square) as the default, 1792x1024 if the user requests a wide image, and 1024x1792 for full-body portraits. Always include this parameter in the request.',- },- },- required: ['prompt', 'style', 'quality', 'size'],-};--const displayMessage =- "DALL-E displayed an image. All generated images are already plainly visible, so don't repeat the descriptions in detail. Do not list download links as they are available in the UI already. The user may download the images by clicking on them, but do not mention anything about downloading to the user.";-class DALLE3 extends Tool {- constructor(fields = {}) {- super();- /** @type {boolean} Used to initialize the Tool without necessary variables. */- this.override = fields.override ?? false;- /** @type {boolean} Necessary for output to contain all image metadata. */- this.returnMetadata = fields.returnMetadata ?? false;-- this.userId = fields.userId;- this.tenantId = fields.req?.user?.tenantId;- this.retentionRequest = createMinimalRetentionRequest(fields.req);- this.fileStrategy = fields.fileStrategy;- /** @type {boolean} */- this.isAgent = fields.isAgent;- if (this.isAgent) {- /** Ensures LangChain maps [content, artifact] tuple to ToolMessage fields instead of serializing it into content. */- this.responseFormat = 'content_and_artifact';- }- if (fields.processFileURL) {- /** @type {processFileURL} Necessary for output to contain all image metadata. */- this.processFileURL = fields.processFileURL.bind(this);- }-- let apiKey = fields.DALLE3_API_KEY ?? fields.DALLE_API_KEY ?? this.getApiKey();- const config = { apiKey };- if (process.env.DALLE_REVERSE_PROXY) {- config.baseURL = extractBaseURL(process.env.DALLE_REVERSE_PROXY);- }-- if (process.env.DALLE3_AZURE_API_VERSION && process.env.DALLE3_BASEURL) {- config.baseURL = process.env.DALLE3_BASEURL;- config.defaultQuery = { 'api-version': process.env.DALLE3_AZURE_API_VERSION };- config.defaultHeaders = {- 'api-key': process.env.DALLE3_API_KEY,- 'Content-Type': 'application/json',- };- config.apiKey = process.env.DALLE3_API_KEY;- }-- const proxyDispatcher = getProxyDispatcher();- if (proxyDispatcher) {- config.fetchOptions = {- dispatcher: proxyDispatcher,- };- }-- /** @type {OpenAI} */- this.openai = new OpenAI(config);- this.name = 'dalle';- this.description = `Use DALLE to create images from text descriptions.- - It requires prompts to be in English, detailed, and to specify image type and human features for diversity.- - Create only one image, without repeating or listing descriptions outside the "prompts" field.- - Maintains the original intent of the description, with parameters for image style, quality, and size to tailor the output.`;- this.description_for_model =- process.env.DALLE3_SYSTEM_PROMPT ??- `// Whenever a description of an image is given, generate prompts (following these rules), and use dalle to create the image. If the user does not ask for a specific number of images, default to creating 2 prompts to send to dalle that are written to be as diverse as possible. All prompts sent to dalle must abide by the following policies:- // 1. Prompts must be in English. Translate to English if needed.- // 2. One image per function call. Create only 1 image per request unless explicitly told to generate more than 1 image.- // 3. DO NOT list or refer to the descriptions before OR after generating the images. They should ONLY ever be written out ONCE, in the \`"prompts"\` field of the request. You do not need to ask for permission to generate, just do it!- // 4. Always mention the image type (photo, oil painting, watercolor painting, illustration, cartoon, drawing, vector, render, etc.) at the beginning of the caption. Unless the captions suggests otherwise, make one of the images a photo.- // 5. Diversify depictions of ALL images with people to always include always DESCENT and GENDER for EACH person using direct terms. Adjust only human descriptions.- // - EXPLICITLY specify these attributes, not abstractly reference them. The attributes should be specified in a minimal way and should directly describe their physical form.- // - Your choices should be grounded in reality. For example, all of a given OCCUPATION should not be the same gender or race. Additionally, focus on creating diverse, inclusive, and exploratory scenes via the properties you choose during rewrites. Make choices that may be insightful or unique sometimes.- // - Use "various" or "diverse" ONLY IF the description refers to groups of more than 3 people. Do not change the number of people requested in the original description.- // - Don't alter memes, fictional character origins, or unseen people. Maintain the original prompt's intent and prioritize quality.- // The prompt must intricately describe every part of the image in concrete, objective detail. THINK about what the end goal of the description is, and extrapolate that to what would make satisfying images.- // All descriptions sent to dalle should be a paragraph of text that is extremely descriptive and detailed. Each should be more than 3 sentences long.- // - The "vivid" style is HIGHLY preferred, but "natural" is also supported.`;- this.schema = dalle3JsonSchema;- }-- static get jsonSchema() {- return dalle3JsonSchema;- }-- getApiKey() {- const apiKey = process.env.DALLE3_API_KEY ?? process.env.DALLE_API_KEY ?? '';- if (!apiKey && !this.override) {- throw new Error('Missing DALLE_API_KEY environment variable.');- }- return apiKey;- }-- replaceUnwantedChars(inputString) {- return inputString- .replace(/\r\n|\r|\n/g, ' ')- .replace(/"/g, '')- .trim();- }-- wrapInMarkdown(imageUrl) {- return ``;- }-- returnValue(value) {- if (this.isAgent === true && typeof value === 'string') {- return [value, {}];- } else if (this.isAgent === true && typeof value === 'object') {- return [displayMessage, value];- }-- return value;- }-- async _call(data) {- const { prompt, quality = 'standard', size = '1024x1024', style = 'vivid' } = data;- if (!prompt) {- throw new Error('Missing required field: prompt');- }-- let resp;- try {- resp = await this.openai.images.generate({- model: 'dall-e-3',- quality,- style,- size,- prompt: this.replaceUnwantedChars(prompt),- n: 1,- });- } catch (error) {- logger.error('[DALL-E-3] Problem generating the image:', error);- return this- .returnValue(`Something went wrong when trying to generate the image. The DALL-E API may be unavailable:-Error Message: ${error.message}`);- }-- if (!resp) {- return this.returnValue(- 'Something went wrong when trying to generate the image. The DALL-E API may be unavailable',- );- }-- const theImageUrl = resp.data[0].url;-- if (!theImageUrl) {- return this.returnValue(- 'No image URL returned from OpenAI API. There may be a problem with the API or your configuration.',- );- }-- if (this.isAgent) {- let fetchOptions = {};- const dispatcher = getEnvProxyDispatcher();- if (dispatcher) {- fetchOptions.dispatcher = dispatcher;- }- const imageResponse = await fetch(theImageUrl, fetchOptions);- const arrayBuffer = await imageResponse.arrayBuffer();- const base64 = Buffer.from(arrayBuffer).toString('base64');- const content = [- {- type: ContentTypes.IMAGE_URL,- image_url: {- url: `data:image/png;base64,${base64}`,- },- },- ];-- const response = [- {- type: ContentTypes.TEXT,- text: displayMessage,- },- ];- return [response, { content }];- }-- const imageBasename = getImageBasename(theImageUrl);- const imageExt = path.extname(imageBasename);-- const extension = imageExt.startsWith('.') ? imageExt.slice(1) : imageExt;- const imageName = `img-${uuidv4()}.${extension}`;-- logger.debug('[DALL-E-3]', {- imageName,- imageBasename,- imageExt,- extension,- theImageUrl,- data: resp.data[0],- });-- try {- const result = await this.processFileURL({- URL: theImageUrl,- basePath: 'images',- userId: this.userId,- fileName: imageName,- fileStrategy: this.fileStrategy,- context: FileContext.image_generation,- tenantId: this.tenantId,- req: this.retentionRequest,- });-- if (this.returnMetadata) {- this.result = result;- } else {- this.result = this.wrapInMarkdown(result.filepath);- }- } catch (error) {- logger.error('Error while saving the image:', error);- this.result = `Failed to save the image locally. ${error.message}`;- }-- return this.returnValue(this.result);- }-}--module.exports = DALLE3;diff --git a/api/app/clients/tools/structured/specs/DALLE3-proxy.spec.js b/api/app/clients/tools/structured/specs/DALLE3-proxy.spec.jsdeleted file mode 100644index b958ed7b5b..0000000000--- a/api/app/clients/tools/structured/specs/DALLE3-proxy.spec.js+++ /dev/null@@ -1,71 +0,0 @@-const DALLE3 = require('../DALLE3');--const processFileURL = jest.fn();-const proxyEnvKeys = [- 'PROXY',- 'proxy',- 'HTTP_PROXY',- 'HTTPS_PROXY',- 'NO_PROXY',- 'http_proxy',- 'https_proxy',- 'no_proxy',-];--function clearProxyEnv() {- proxyEnvKeys.forEach((key) => delete process.env[key]);-}--describe('DALLE3 Proxy Configuration', () => {- let originalEnv;-- beforeAll(() => {- originalEnv = { ...process.env };- });-- beforeEach(() => {- jest.resetModules();- process.env = { ...originalEnv };- clearProxyEnv();- });-- afterEach(() => {- process.env = originalEnv;- });-- it('should configure fetchOptions.dispatcher when proxy env is set', () => {- // Set proxy environment variable- process.env.PROXY = 'http://proxy.example.com:8080';- process.env.DALLE_API_KEY = 'test-api-key';-- // Create instance- const dalleWithProxy = new DALLE3({ processFileURL });-- // Check that the openai client exists- expect(dalleWithProxy.openai).toBeDefined();-- // Check that _options exists and has fetchOptions with a dispatcher- expect(dalleWithProxy.openai._options).toBeDefined();- expect(dalleWithProxy.openai._options.fetchOptions).toBeDefined();- expect(dalleWithProxy.openai._options.fetchOptions.dispatcher).toBeDefined();- expect(dalleWithProxy.openai._options.fetchOptions.dispatcher).toBeDefined();- });-- it('should not configure a dispatcher when proxy env is not set', () => {- process.env.DALLE_API_KEY = 'test-api-key';-- // Create instance- const dalleWithoutProxy = new DALLE3({ processFileURL });-- // Check that the openai client exists- expect(dalleWithoutProxy.openai).toBeDefined();-- // Check that _options exists but fetchOptions either doesn't exist or doesn't have a dispatcher- expect(dalleWithoutProxy.openai._options).toBeDefined();-- // fetchOptions should either not exist or not have a dispatcher- if (dalleWithoutProxy.openai._options.fetchOptions) {- expect(dalleWithoutProxy.openai._options.fetchOptions.dispatcher).toBeUndefined();- }- });-});diff --git a/api/app/clients/tools/structured/specs/DALLE3.spec.js b/api/app/clients/tools/structured/specs/DALLE3.spec.jsdeleted file mode 100644index 6071929bfc..0000000000--- a/api/app/clients/tools/structured/specs/DALLE3.spec.js+++ /dev/null@@ -1,207 +0,0 @@-const OpenAI = require('openai');-const { logger } = require('@librechat/data-schemas');-const DALLE3 = require('../DALLE3');--jest.mock('openai');-jest.mock('@librechat/data-schemas', () => {- return {- logger: {- info: jest.fn(),- warn: jest.fn(),- debug: jest.fn(),- error: jest.fn(),- },- };-});--const processFileURL = jest.fn();--const generate = jest.fn();-OpenAI.mockImplementation(() => ({- images: {- generate,- },-}));--jest.mock('fs', () => {- return {- existsSync: jest.fn(),- mkdirSync: jest.fn(),- promises: {- writeFile: jest.fn(),- readFile: jest.fn(),- unlink: jest.fn(),- },- };-});--jest.mock('path', () => {- return {- resolve: jest.fn(),- join: jest.fn(),- relative: jest.fn(),- extname: jest.fn().mockImplementation((filename) => {- return filename.slice(filename.lastIndexOf('.'));- }),- };-});--describe('DALLE3', () => {- let originalEnv;- let dalle; // Keep this declaration if you need to use dalle in other tests- const mockApiKey = 'mock_api_key';-- beforeAll(() => {- // Save the original process.env- originalEnv = { ...process.env };- });-- beforeEach(() => {- // Reset the process.env before each test- jest.resetModules();- process.env = { ...originalEnv, DALLE_API_KEY: mockApiKey };- // Instantiate DALLE3 for tests that do not depend on DALLE3_SYSTEM_PROMPT- dalle = new DALLE3({ processFileURL });- });-- afterEach(() => {- jest.clearAllMocks();- // Restore the original process.env after each test- process.env = originalEnv;- });-- it('should throw an error if all potential API keys are missing', () => {- delete process.env.DALLE3_API_KEY;- delete process.env.DALLE_API_KEY;- expect(() => new DALLE3()).toThrow('Missing DALLE_API_KEY environment variable.');- });-- it('should replace unwanted characters in input string', () => {- const input = 'This is a test\nstring with "quotes" and new lines.';- const expectedOutput = 'This is a test string with quotes and new lines.';- expect(dalle.replaceUnwantedChars(input)).toBe(expectedOutput);- });-- it('should generate markdown image URL correctly', () => {- const imageName = 'test.png';- const markdownImage = dalle.wrapInMarkdown(imageName);- expect(markdownImage).toBe('');- });-- it('should call OpenAI API with correct parameters', async () => {- const mockData = {- prompt: 'A test prompt',- quality: 'standard',- size: '1024x1024',- style: 'vivid',- };-- const mockResponse = {- data: [- {- url: 'http://example.com/img-test.png',- },- ],- };-- generate.mockResolvedValue(mockResponse);- processFileURL.mockResolvedValue({- filepath: 'http://example.com/img-test.png',- });-- const result = await dalle._call(mockData);-- expect(generate).toHaveBeenCalledWith({- model: 'dall-e-3',- quality: mockData.quality,- style: mockData.style,- size: mockData.size,- prompt: mockData.prompt,- n: 1,- });-- expect(result).toContain('![generated image]');- });-- it('should use the system prompt if provided', () => {- process.env.DALLE3_SYSTEM_PROMPT = 'System prompt for testing';- jest.resetModules(); // This will ensure the module is fresh and will read the new env var- const DALLE3 = require('../DALLE3'); // Re-require after setting the env var- const dalleWithSystemPrompt = new DALLE3();- expect(dalleWithSystemPrompt.description_for_model).toBe('System prompt for testing');- });-- it('should not use the system prompt if not provided', async () => {- delete process.env.DALLE3_SYSTEM_PROMPT;- const dalleWithoutSystemPrompt = new DALLE3();- expect(dalleWithoutSystemPrompt.description_for_model).not.toBe('System prompt for testing');- });-- it('should throw an error if prompt is missing', async () => {- const mockData = {- quality: 'standard',- size: '1024x1024',- style: 'vivid',- };- await expect(dalle._call(mockData)).rejects.toThrow('Missing required field: prompt');- });-- it('should log appropriate debug values', async () => {- const mockData = {- prompt: 'A test prompt',- };- const mockResponse = {- data: [- {- url: 'http://example.com/invalid-url',- },- ],- };-- generate.mockResolvedValue(mockResponse);- await dalle._call(mockData);- expect(logger.debug).toHaveBeenCalledWith('[DALL-E-3]', {- data: { url: 'http://example.com/invalid-url' },- theImageUrl: 'http://example.com/invalid-url',- extension: expect.any(String),- imageBasename: expect.any(String),- imageExt: expect.any(String),- imageName: expect.any(String),- });- });-- it('should log an error and return the image URL if there is an error saving the image', async () => {- const mockData = {- prompt: 'A test prompt',- };- const mockResponse = {- data: [- {- url: 'http://example.com/img-test.png',- },- ],- };- const error = new Error('Error while saving the image');- generate.mockResolvedValue(mockResponse);- processFileURL.mockRejectedValue(error);- const result = await dalle._call(mockData);- expect(logger.error).toHaveBeenCalledWith('Error while saving the image:', error);- expect(result).toBe('Failed to save the image locally. Error while saving the image');- });-- it('should handle error when saving image to Firebase Storage fails', async () => {- const mockData = {- prompt: 'A test prompt',- };- const mockImageUrl = 'http://example.com/img-test.png';- const mockResponse = { data: [{ url: mockImageUrl }] };- const error = new Error('Error while saving to Firebase');- generate.mockResolvedValue(mockResponse);- processFileURL.mockRejectedValue(error);-- const result = await dalle._call(mockData);-- expect(logger.error).toHaveBeenCalledWith('Error while saving the image:', error);- expect(result).toContain('Failed to save the image');- });-});diff --git a/api/app/clients/tools/structured/specs/imageTools-agent.spec.js b/api/app/clients/tools/structured/specs/imageTools-agent.spec.jsindex c27e73725d..f8da0976c6 100644--- a/api/app/clients/tools/structured/specs/imageTools-agent.spec.js+++ b/api/app/clients/tools/structured/specs/imageTools-agent.spec.js@@ -2,29 +2,21 @@* Regression tests for image tool agent mode — verifies that invoke() returns* a ToolMessage with base64 in artifact.content rather than serialized into content.*- * Root cause: DALLE3/FluxAPI/StableDiffusion extend LangChain's Tool but did not+ * Root cause: FluxAPI/StableDiffusion extend LangChain's Tool but did not* set responseFormat = 'content_and_artifact'. LangChain's invoke() would then* JSON.stringify the entire [content, artifact] tuple into ToolMessage.content,* dumping base64 into token counting and causing context exhaustion.*/const axios = require('axios');-const OpenAI = require('openai');-const undici = require('undici');const fetch = require('node-fetch');const { ContentTypes } = require('librechat-data-provider');const { ToolMessage } = require('@librechat/agents/langchain/messages');const StableDiffusionAPI = require('../StableDiffusion');const FluxAPI = require('../FluxAPI');-const DALLE3 = require('../DALLE3');jest.mock('axios');-jest.mock('openai');jest.mock('node-fetch');-jest.mock('undici', () => ({- ProxyAgent: jest.fn(),- fetch: jest.fn(),-}));jest.mock('@librechat/data-schemas', () => ({logger: { info: jest.fn(), warn: jest.fn(), debug: jest.fn(), error: jest.fn() },}));@@ -50,7 +42,7 @@ const makeToolCall = (name, args) => ({});describe('image tools - agent mode ToolMessage format', () => {- const ENV_KEYS = ['DALLE_API_KEY', 'FLUX_API_KEY', 'SD_WEBUI_URL', 'PROXY'];+ const ENV_KEYS = ['FLUX_API_KEY', 'SD_WEBUI_URL', 'PROXY'];let savedEnv = {};beforeEach(() => {@@ -58,7 +50,6 @@ describe('image tools - agent mode ToolMessage format', () => {for (const key of ENV_KEYS) {savedEnv[key] = process.env[key];}- process.env.DALLE_API_KEY = 'test-dalle-key';process.env.FLUX_API_KEY = 'test-flux-key';process.env.SD_WEBUI_URL = 'http://localhost:7860';delete process.env.PROXY;@@ -75,95 +66,6 @@ describe('image tools - agent mode ToolMessage format', () => {savedEnv = {};});- describe('DALLE3', () => {- beforeEach(() => {- OpenAI.mockImplementation(() => ({- images: {- generate: jest.fn().mockResolvedValue({- data: [{ url: 'https://example.com/image.png' }],- }),- },- }));- undici.fetch.mockResolvedValue({- arrayBuffer: () => Promise.resolve(Buffer.from(FAKE_BASE64, 'base64')),- });- });-- it('sets responseFormat to content_and_artifact when isAgent is true', () => {- const dalle = new DALLE3({ isAgent: true });- expect(dalle.responseFormat).toBe('content_and_artifact');- });-- it('does not set responseFormat when isAgent is false', () => {- const dalle = new DALLE3({ isAgent: false, processFileURL: jest.fn() });- expect(dalle.responseFormat).not.toBe('content_and_artifact');- });-- it('keeps tenant context without retaining the request object', () => {- const req = {- user: { id: 'user-1', tenantId: 'tenant-a' },- body: { conversationId: 'convo-1', isTemporary: 'true' },- config: { interfaceConfig: { retentionMode: 'all' } },- socket: {},- };- const dalle = new DALLE3({ isAgent: false, processFileURL: jest.fn(), req });-- expect(dalle.tenantId).toBe('tenant-a');- expect(dalle.req).toBeUndefined();- expect(dalle.retentionRequest).toEqual({- user: { id: 'user-1', tenantId: 'tenant-a' },- body: { conversationId: 'convo-1', isTemporary: 'true' },- config: { interfaceConfig: { retentionMode: 'all' } },- });- });-- it('invoke() returns ToolMessage with base64 in artifact, not serialized in content', async () => {- const dalle = new DALLE3({ isAgent: true });- const result = await dalle.invoke(- makeToolCall('dalle', {- prompt: 'a box',- quality: 'standard',- size: '1024x1024',- style: 'vivid',- }),- );-- expect(result).toBeInstanceOf(ToolMessage);-- const contentStr =- typeof result.content === 'string' ? result.content : JSON.stringify(result.content);- expect(contentStr).not.toContain(FAKE_BASE64);-- expect(result.artifact).toBeDefined();- const artifactContent = result.artifact?.content;- expect(Array.isArray(artifactContent)).toBe(true);- expect(artifactContent[0].type).toBe(ContentTypes.IMAGE_URL);- expect(artifactContent[0].image_url.url).toContain('base64');- });-- it('invoke() returns ToolMessage with error string in content when API fails', async () => {- OpenAI.mockImplementation(() => ({- images: { generate: jest.fn().mockRejectedValue(new Error('API error')) },- }));-- const dalle = new DALLE3({ isAgent: true });- const result = await dalle.invoke(- makeToolCall('dalle', {- prompt: 'a box',- quality: 'standard',- size: '1024x1024',- style: 'vivid',- }),- );-- expect(result).toBeInstanceOf(ToolMessage);- const contentStr =- typeof result.content === 'string' ? result.content : JSON.stringify(result.content);- expect(contentStr).toContain('Something went wrong');- expect(result.artifact).toBeDefined();- });- });-describe('FluxAPI', () => {beforeEach(() => {jest.useFakeTimers();diff --git a/api/app/clients/tools/util/handleTools.js b/api/app/clients/tools/util/handleTools.jsindex b02270f001..57aa0ce203 100644--- a/api/app/clients/tools/util/handleTools.js+++ b/api/app/clients/tools/util/handleTools.js@@ -48,7 +48,6 @@ const {// Basic ToolsGoogleSearchAPI,// Structured Tools- DALLE3,FluxAPI,OpenWeather,StructuredSD,@@ -128,7 +127,6 @@ const getAuthFields = (toolKey) => {* @param {LoadToolOptions} [params.options]* @param {boolean} [params.useSpecs]* @param {Array<string>} params.tools- * @param {boolean} [params.functions]* @param {boolean} [params.returnMap]* @param {AppConfig['webSearch']} [params.webSearch]* @param {AppConfig['fileStrategy']} [params.fileStrategy]@@ -144,7 +142,6 @@ const loadTools = async ({userMCPAuthMap,tools = [],options = {},- functions = true,returnMap = false,webSearch,fileStrategy,@@ -223,10 +220,6 @@ const loadTools = async ({: true;let loggedMCPDenied = false;- if (functions === true) {- toolConstructors.dalle = DALLE3;- }-/** @type {ImageGenOptions} */const imageGenOptions = {isAgent: !!agent,@@ -239,7 +232,6 @@ const loadTools = async ({const toolOptions = {flux: imageGenOptions,- dalle: imageGenOptions,'stable-diffusion': imageGenOptions,gemini_image_gen: imageGenOptions,};diff --git a/api/app/clients/tools/util/handleTools.test.js b/api/app/clients/tools/util/handleTools.test.jsindex d386288345..2d18c25596 100644--- a/api/app/clients/tools/util/handleTools.test.js+++ b/api/app/clients/tools/util/handleTools.test.js@@ -47,11 +47,11 @@ jest.mock('~/server/services/Config', () => ({}),getCachedTools: jest.fn().mockResolvedValue({// Default cached tools for tests- dalle: {+ flux: {type: 'function',function: {- name: 'dalle',- description: 'DALL-E image generation',+ name: 'flux',+ description: 'Flux image generation',parameters: {},},},@@ -99,14 +99,14 @@ const { ASK_USER_QUESTION_TOOL_NAME, STANDARD_MCP_CAPABILITY_PROFILE } = requireconst { User } = require('~/db/models');const PluginService = require('~/server/services/PluginService');const { loadTools, loadToolWithAuth } = require('./handleTools');-const { StructuredSD, availableTools, DALLE3 } = require('../');+const { StructuredSD, availableTools, FluxAPI } = require('../');describe('Tool Handlers', () => {let mongoServer;let fakeUser;- const pluginKey = 'dalle';+ const pluginKey = 'flux';const pluginKey2 = 'wolfram';- const ToolClass = DALLE3;+ const ToolClass = FluxAPI;const initialTools = [pluginKey, pluginKey2];const mockCredential = 'mock-credential';const mainPlugin = availableTools.find((tool) => tool.pluginKey === pluginKey);@@ -241,48 +241,55 @@ describe('Tool Handlers', () => {expect(tool).toBeInstanceOf(ToolClass2);});+ class AuthTool {}+it('should initialize an authenticated tool with primary auth field', async () => {- process.env.DALLE3_API_KEY = 'mocked_api_key';+ process.env.PRIMARY_API_KEY = 'mocked_api_key';const initToolFunction = loadToolWithAuth('userId',- ['DALLE3_API_KEY||DALLE_API_KEY'],- ToolClass,+ ['PRIMARY_API_KEY||ALTERNATE_API_KEY'],+ AuthTool,);const authTool = await initToolFunction();- expect(authTool).toBeInstanceOf(ToolClass);+ expect(authTool).toBeInstanceOf(AuthTool);expect(mockPluginService.getUserPluginAuthValue).not.toHaveBeenCalled();});it('should initialize an authenticated tool with alternate auth field when primary is missing', async () => {- delete process.env.DALLE3_API_KEY; // Ensure the primary key is not set- process.env.DALLE_API_KEY = 'mocked_alternate_api_key';+ delete process.env.PRIMARY_API_KEY; // Ensure the primary key is not set+ process.env.ALTERNATE_API_KEY = 'mocked_alternate_api_key';const initToolFunction = loadToolWithAuth('userId',- ['DALLE3_API_KEY||DALLE_API_KEY'],- ToolClass,+ ['PRIMARY_API_KEY||ALTERNATE_API_KEY'],+ AuthTool,);const authTool = await initToolFunction();- expect(authTool).toBeInstanceOf(ToolClass);+ expect(authTool).toBeInstanceOf(AuthTool);expect(mockPluginService.getUserPluginAuthValue).toHaveBeenCalledTimes(1);expect(mockPluginService.getUserPluginAuthValue).toHaveBeenCalledWith('userId',- 'DALLE3_API_KEY',+ 'PRIMARY_API_KEY',true,);});it('should fallback to getUserPluginAuthValue when env vars are missing', async () => {- mockPluginService.updateUserPluginAuth('userId', 'DALLE_API_KEY', 'dalle', 'mocked_api_key');+ mockPluginService.updateUserPluginAuth(+ 'userId',+ 'ALTERNATE_API_KEY',+ 'custom-tool',+ 'mocked_api_key',+ );const initToolFunction = loadToolWithAuth('userId',- ['DALLE3_API_KEY||DALLE_API_KEY'],- ToolClass,+ ['PRIMARY_API_KEY||ALTERNATE_API_KEY'],+ AuthTool,);const authTool = await initToolFunction();- expect(authTool).toBeInstanceOf(ToolClass);+ expect(authTool).toBeInstanceOf(AuthTool);expect(mockPluginService.getUserPluginAuthValue).toHaveBeenCalledTimes(2);});@@ -316,12 +323,11 @@ describe('Tool Handlers', () => {});expect(toolFunctions).toEqual({});});- it('should return the StructuredTool version when using functions', async () => {+ it('should return the StructuredTool version', async () => {process.env.SD_WEBUI_URL = mockCredential;toolFunctions = await loadTools({user: fakeUser._id,tools: ['stable-diffusion'],- functions: true,returnMap: true,useSpecs: true,});diff --git a/api/server/controllers/tools.js b/api/server/controllers/tools.jsindex 9efa44f41d..440a45c7c3 100644--- a/api/server/controllers/tools.js+++ b/api/server/controllers/tools.js@@ -161,7 +161,6 @@ const callTool = async (req, res) => {const { loadedTools } = await loadTools({user: req.user.id,tools: [toolId],- functions: true,options: {req,returnMetadata: true,diff --git a/api/server/services/ToolService.js b/api/server/services/ToolService.jsindex 65db50b28e..410d3d7e4a 100644--- a/api/server/services/ToolService.js+++ b/api/server/services/ToolService.js@@ -470,7 +470,6 @@ async function processRequiredActions(client, requiredActions) {user: client.req.user.id,model: client.req.body.model ?? 'gpt-4o-mini',tools,- functions: true,endpoint: client.req.body.endpoint,options: {processFileURL,@@ -1846,7 +1845,6 @@ async function loadAgentTools({agent,signal,userMCPAuthMap,- functions: true,user: req.user.id,tools: _agentTools,options: {@@ -2482,7 +2480,6 @@ async function loadToolsForExecution({agent,signal,userMCPAuthMap,- functions: true,tools: regularToolNames,user: req.user.id,options: {diff --git a/e2e/specs/mock/scenarios/dalle-retired.spec.ts b/e2e/specs/mock/scenarios/dalle-retired.spec.tsnew file mode 100644index 0000000000..cd57840830--- /dev/null+++ b/e2e/specs/mock/scenarios/dalle-retired.spec.ts@@ -0,0 +1,78 @@+import { expect, test } from '@playwright/test';+import type { Page } from '@playwright/test';+import type { AgentDetail } from '../agents.helpers';+import { cleanupAgent, openAgentBuilder, uniqueAgentName } from '../agents.helpers';+import {+ MOCK_ENDPOINTS,+ NEW_CHAT_PATH,+ getAccessToken,+ messagesView,+ replyPrompt,+ replyText,+ requestJson,+ sendMessage,+} from '../helpers';+import { withMongo } from '../db';++/* The agent is selected through the desktop agent builder side panel. */+test.use({ viewport: { width: 1280, height: 800 }, isMobile: false, hasTouch: false });++const DALLE_TOOL_ID = 'dalle';++type ToolEntry = { pluginKey: string };++test.describe('retired DALL-E 3 tool', () => {+ test('the agent tool catalog no longer offers DALL-E 3 @scenario:dalle-missing-from-tool-catalog', async ({+ page,+ }) => {+ await page.goto(NEW_CHAT_PATH, { timeout: 15000 });+ const token = await getAccessToken(page);+ const tools = await requestJson<ToolEntry[]>(page, { path: '/api/agents/tools', token });++ expect(tools.length).toBeGreaterThan(0);+ expect(tools.map((tool) => tool.pluginKey)).not.toContain(DALLE_TOOL_ID);+ });++ test('an agent saved with the DALL-E 3 tool still replies @scenario:legacy-dalle-agent-still-replies', async ({+ page,+ }) => {+ test.setTimeout(120000);+ await page.goto(NEW_CHAT_PATH, { timeout: 15000 });+ const token = await getAccessToken(page);+ const agent = await requestJson<AgentDetail>(page, {+ path: '/api/agents',+ token,+ method: 'POST',+ body: {+ name: uniqueAgentName('E2E Legacy DALL-E Agent'),+ instructions: 'Reply to the user.',+ provider: MOCK_ENDPOINTS[0].label,+ model: MOCK_ENDPOINTS[0].model,+ tools: [],+ },+ });++ try {+ /* Agents saved before the retirement still carry the tool id in storage. */+ await withMongo((db) =>+ db.collection('agents').updateOne({ id: agent.id }, { $set: { tools: [DALLE_TOOL_ID] } }),+ );++ await selectAgent(page, agent);+ const label = `legacy-dalle-${Date.now()}`;+ const response = await sendMessage(page, replyPrompt(label));+ expect(response.ok()).toBeTruthy();+ await expect(messagesView(page).getByText(replyText(label))).toBeVisible({ timeout: 30000 });+ } finally {+ await cleanupAgent(page, agent.id);+ }+ });+});++async function selectAgent(page: Page, agent: AgentDetail) {+ const form = await openAgentBuilder(page);+ await form.getByRole('combobox', { name: 'Agent', exact: true }).click();+ await page.getByRole('option', { name: agent.name }).click();+ await expect(form.getByLabel('Agent name')).toHaveValue(agent.name ?? '');+ await form.getByRole('button', { name: 'Select Agent' }).click();+}diff --git a/packages/api/src/tools/registry/definitions.ts b/packages/api/src/tools/registry/definitions.tsindex 0f93a828e0..846a426881 100644--- a/packages/api/src/tools/registry/definitions.ts+++ b/packages/api/src/tools/registry/definitions.ts@@ -38,37 +38,6 @@ export const googleSearchSchema: ExtendedJsonSchema = {required: ['query'],};-/** DALL-E 3 tool JSON schema */-export const dalle3Schema: ExtendedJsonSchema = {- type: 'object',- properties: {- prompt: {- type: 'string',- maxLength: 4000,- description:- 'A text description of the desired image, following the rules, up to 4000 characters.',- },- style: {- type: 'string',- enum: ['vivid', 'natural'],- description:- 'Must be one of `vivid` or `natural`. `vivid` generates hyper-real and dramatic images, `natural` produces more natural, less hyper-real looking images',- },- quality: {- type: 'string',- enum: ['hd', 'standard'],- description: 'The quality of the generated image. Only `hd` and `standard` are supported.',- },- size: {- type: 'string',- enum: ['1024x1024', '1792x1024', '1024x1792'],- description:- 'The size of the requested image. Use 1024x1024 (square) as the default, 1792x1024 if the user requests a wide image, and 1024x1792 for full-body portraits. Always include this parameter in the request.',- },- },- required: ['prompt', 'style', 'quality', 'size'],-};-/** Flux API tool JSON schema */export const fluxApiSchema: ExtendedJsonSchema = {type: 'object',@@ -340,15 +309,6 @@ export const toolDefinitions: Record<string, ToolRegistryDefinition> = {schema: googleSearchSchema,toolType: 'builtin',},- dalle: {- name: 'dalle',- description: `Use DALLE to create images from text descriptions.- - It requires prompts to be in English, detailed, and to specify image type and human features for diversity.- - Create only one image, without repeating or listing descriptions outside the "prompts" field.- - Maintains the original intent of the description, with parameters for image style, quality, and size to tailor the output.`,- schema: dalle3Schema,- toolType: 'builtin',- },flux: {name: 'flux',description: