OpenAI Image Tools
Set up the OpenAI Image Tools for agents, including Azure OpenAI deployments and custom tool descriptions.
OpenAI Image Tools is the agent toolkit behind image generation and editing with OpenAI image models. Adding it to an agent gives the agent two tools: one that generates from text and one that edits uploaded or earlier images.
Setup
- Create or reuse an OpenAI API key and add it to
.env:
IMAGE_GEN_OAI_API_KEY=sk-...- Restart LibreChat.
- In the Agent Builder, select Add next to Tools, choose OpenAI Image Tools, and save the agent.
If you leave IMAGE_GEN_OAI_API_KEY unset, each user is asked for their own key when they add the tool.
| Key | Type | Description | Example |
|---|---|---|---|
| IMAGE_GEN_OAI_API_KEY | string | OpenAI (or Azure OpenAI) API key for both image tools. Unset lets users enter their own key. | IMAGE_GEN_OAI_API_KEY=sk-... |
| IMAGE_GEN_OAI_MODEL | string | Image model to use, or the deployment name on Azure. Default: gpt-image-2.5-flare. | # IMAGE_GEN_OAI_MODEL=gpt-image-2.5-flare |
| IMAGE_GEN_OAI_BASEURL | string | Custom base URL, for a proxy, an OpenAI-compatible service, or an Azure deployment. | # IMAGE_GEN_OAI_BASEURL=https://... |
| IMAGE_GEN_OAI_AZURE_API_VERSION | string | Azure OpenAI API version. Setting it together with IMAGE_GEN_OAI_BASEURL switches the tools to Azure mode, which sends the key as an api-key header. | # IMAGE_GEN_OAI_AZURE_API_VERSION=2025-04-01-preview |
The image size an agent can request depends on the model: auto, 1024x1024, 1536x1024, and 1024x1536 work everywhere, and models that support custom dimensions, such as gpt-image-2.5-flare, accept others like 2048x1152 or 3840x2160. The API rejects sizes the configured model does not support.
OpenAI retired gpt-image-1 on October 23, 2026. If you set it in IMAGE_GEN_OAI_MODEL, remove it or switch to a current model.
Keeping large images
LibreChat resizes saved images so the shorter side is at most 768 pixels, so a 3840x2160 result is stored at 1365x768. To keep the size the model returned, set fileConfig.imageGeneration to percentage: 100.
Azure OpenAI
Point the base URL at your image deployment and set the API version:
IMAGE_GEN_OAI_API_KEY=your-azure-api-key
IMAGE_GEN_OAI_BASEURL=https://your-resource.openai.azure.com/openai/deployments/your-image-deployment/
IMAGE_GEN_OAI_AZURE_API_VERSION=2025-04-01-preview
IMAGE_GEN_OAI_MODEL=your-image-deploymentTool descriptions
The model decides when and how to call each tool from its description. You can replace the built-in text if you want to steer that, for example to enforce a house style:
| Key | Type | Description | Example |
|---|---|---|---|
| IMAGE_GEN_OAI_DESCRIPTION | string | Description of the generation tool. | # IMAGE_GEN_OAI_DESCRIPTION= |
| IMAGE_GEN_OAI_PROMPT_DESCRIPTION | string | Description of the generation tool prompt parameter. | # IMAGE_GEN_OAI_PROMPT_DESCRIPTION= |
| IMAGE_EDIT_OAI_DESCRIPTION | string | Description of the editing tool. | # IMAGE_EDIT_OAI_DESCRIPTION= |
| IMAGE_EDIT_OAI_PROMPT_DESCRIPTION | string | Description of the editing tool prompt parameter. | # IMAGE_EDIT_OAI_PROMPT_DESCRIPTION= |
Proxy
Requests honor the global PROXY variable. When PROXY is unset, HTTP_PROXY, HTTPS_PROXY, and NO_PROXY apply.
Pricing
OpenAI bills image generation per image, based on model, size, and quality. See OpenAI's image generation guide for current costs.
How is this guide?