/Tool/OpenAI
app icon

OpenAI

Verified by Dify
No ratings yet
30.1k
L
langgenius/openai_tool

OpenAI Tools

ImageProductivity

OpenAI Tools

Generate and edit images or run background research from Dify workflows, chatflows, and agents.
One OpenAI provider configuration supplies credentials to all tools in this plugin.

Setup

  1. Create an API key in the OpenAI Platform.
  2. Install the OpenAI tools plugin in Dify and authorize it with the credentials below.
  3. Add a tool to your application, configure its model and options, and bind its inputs to workflow variables.
  4. Connect image files or research text to your application's output or a subsequent node.
CredentialRequiredUsage
OpenAI API keyYesUsed by every image and research tool.
OpenAI base URLNoLeave blank for OpenAI, or enter the base URL of a compatible service.
OpenAI organization IDNoSupply an organization ID when needed for your account.

Custom base URLs have trailing slashes removed and appended unless they already end in .
For example, becomes .
Credential validation lists models; successful authorization does not establish access to every model or endpoint.
GPT Image access may require OpenAI organization verification.

Tools

ToolModel selectionOperation
GPT Image 2 / 2.5 GenerateGPT Image 2, GPT Image 2.5 Flare, GPT Image 2.5 SunburstGenerate images from a prompt.
GPT Image 2 / 2.5 EditGPT Image 2, GPT Image 2.5 Flare, GPT Image 2.5 SunburstEdit or combine reference images, optionally using a mask.
GPT Image Generate, Generate images with the GPT Image 1 family.
GPT Image Edit, Edit reference images with the GPT Image 1 family.
Deep Research, Start, retrieve, or cancel a research task.
DALL-E 2Legacy image generation.
DALL-E 3Legacy image generation.

DALL-E 2 and DALL-E 3 remain registered in the plugin, but OpenAI removed both models from its API on May 12, 2026.
Use the GPT Image tools for OpenAI image requests.
See the official deprecation notice.

GPT Image 2 and 2.5

Model selection

Both tools default to .
Choose a GPT Image 2.5 model explicitly in the Model field to use the new models introduced with ChatGPT Images 2.5 on September 8, 2026.

API model IDUse casePublished snapshot
Existing GPT Image 2 generation and editing.
Fast, high-quality generation and editing.
Detailed creative work and precise editing.

The model selector uses the API model IDs; the snapshot IDs are reference metadata.
The Generate tool sends a text prompt to the Images API, while Edit sends a prompt and image files.
For another editing pass, feed a previous image output into the next Edit call.

Parameters

ParameterDefaultValues and behavior
RequiredDescribe the image to create or the changes to make.
One of the API model IDs listed above.
Automatic dimensions or a string meeting the limits below.
, , , ; GPT Image 2.5 also accepts and .
Integer from 1 to 10.
, , or .
, , , or ; uses the API's default PNG output.
Integer from 0 to 100, sent only for explicit JPEG or WebP output.
Generate only: or .
Required for EditOne or more Dify image files, up to 16.
UnsetEdit only: an optional PNG mask for localized changes.

Custom dimensions must satisfy all of these conditions:

  • Width and height are positive multiples of 16, with neither edge above 3840 pixels.
  • The aspect ratio is between 1:3 and 3:1.
  • The total pixel count is between 655,360 and 8,294,400.

Common sizes include , , and .
Sizes above are experimental.
Transparent backgrounds require PNG or WebP; selecting JPEG with returns a validation error.
Transparent output is supported by both GPT Image 2.5 models and is in preview for GPT Image 2.
For masked edits, use a mask matching the first input image's dimensions, with transparent areas indicating where to edit.
See the image generation guide for input-file requirements and mask behavior.

Example settings for a Generate node:

Outputs and usage

Each generated image is returned as a file with its MIME type.
When OpenAI supplies usage, each file also carries metadata and the tool emits a JSON payload such as:

These token counts are illustrative.
Usage belongs to the entire request, so do not sum the same usage metadata across its image files.
The JSON payload is omitted when the API returns no usage information.

At launch, both GPT Image 2.5 models use the following USD rates per million tokens:

Token categoryInputCached inputOutput
Text$5$1.25—
Image$8$2$30

The plugin reports tokens rather than calculating a monetary charge.
GPT Image 2 per-image estimates do not apply to GPT Image 2.5 because token consumption can differ.
Check OpenAI pricing for current rates.

GPT Image 1 tools

GPT Image Generate and GPT Image Edit default to and also offer .
Both accept , , , or sizes; , , , or quality; and 1–10 output images.
Generate additionally exposes background, output format, JPEG/WebP compression, and moderation controls.
Edit accepts reference image files and an optional mask, with output settings determined by the API beyond size and quality.
Both return image files; the separate usage JSON described above is specific to the GPT Image 2 / 2.5 tools.

Deep Research

Deep Research uses the Responses API and always starts tasks in background mode.
Select (the default) or .
The plugin exposes web search and code interpreter, both enabled by default.
Keep web search enabled for OpenAI research requests: it supplies the research source, while code interpreter adds data analysis.
See the official Deep Research guide.

Task lifecycle

ActionRequired inputsResult
Starts a task and returns confirmation text plus JSON containing and .
Returns the current status, or the report once the task is completed.
Requests cancellation and returns the resulting status.
  1. Call with a research prompt specifying the question, preferred sources, and desired output.
  2. Save the returned JSON in a workflow variable or application state.
  3. Call with that ID again while the status is or .
  4. On , use the tool's text output as the report; handle , , and as terminal statuses.

Each invocation makes one API request; the tool does not automatically poll or wait for a report.
Use with the same ID to request that a running task stop.

Options and outputs

optionally limits tool calls during research.
controls each API request in seconds and defaults to 3600 when unset; it is not a research-task duration limit.
The form also exposes (default ), (default ), and (default ), which are forwarded when supplied and subject to the selected model's API support.

Completed reports are returned as text, with numbered links and a reference list when URL citations are present.
The accompanying JSON contains response metadata rather than the report body: , , , and, when available, , , , , , , , and .
can include web-search actions, code-interpreter activity, and reasoning-summary text.
The top-level field describes the reasoning-summary setting, not a summary of the report.
Failed tasks return JSON with , , and / .
Input validation failures and API request errors may return only a text message, so inspect text output as well as JSON.

Local development

The plugin runner uses Python 3.12.
Install the locked dependencies from the repository root:

Run the OpenAI tool regression checks:

The tests mock API calls and do not generate billable images or research tasks.
Dependency constraints live in pyproject.toml, resolved versions in uv.lock, and plugin release metadata in manifest.yaml.

CATEGORY
Tool
VERSION
0.2.1
langgenius·Updated a month ago
REQUIREMENTS
LLM invocation
Tool invocation
Maximum memory
1MB
Access domain

No outbound calls found

Security
Security Rating

Last checked 09/09/2026 07:58 PM · version 0.2.1

Give a rate
SHARE WITH