Beta OpenAI Images Edits API
https://api2.yujuntc.fun/openai/images/edits
https://api2.yujuntc.fun/v1/images/edits
OpenAI image editing API, input images and instructions, output modified images.
Request Headers
acceptstring
Specify the response format, only supporting `application/json`.
Please select
Content-Typestring
Use `multipart/form-data` to upload image files, or use `application/json` to reference images via URL (extended mode; JSON mode does not support direct upload of file bytes).
Please select
authorizationstring
Bearer token
Request Body
imagestring | arrayRequired parameter
Reference image URL. Accepts a single URL string or an array of URL strings (up to 16 for the GPT Image series models, `dall-e-2` supports only 1). The JSON mode **does not** accept uploaded file bytes—if you need to upload files directly, please use `multipart/form-data`.
promptstringRequired parameter
Describe the text of the desired editing effect. `dall-e-2` up to 1000 characters, GPT Image series models up to 32000 characters.
modelstring
Model used for image editing. Supports `dall-e-2`, `dall-e-3`, the GPT Image series (`gpt-image-1`, `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2.5-flare`, `gpt-image-2.5-sunburst`), and the Google Nano Banana series (`nano-banana`, `nano-banana-2-lite`, `nano-banana-2`, `nano-banana-2.1`, `nano-banana-pro`). `gpt-image-2` provides `gpt-image-2:official` (official channel, stable and compliant, billed based on the actual Token usage of text input, image input, and image output) and `gpt-image-2:reverse` (equivalent to the default `gpt-image-2`, with better cost performance); `gpt-image-2.5-flare` and `gpt-image-2.5-sunburst` also respectively provide `:official` variants with the same names, and are billed based on actual Token usage.
Please select
ninteger
Number of images to generate (1-10). `dall-e-3` is fixed at `1`. The `dall-e-2`, `gpt-image-1` / `gpt-image-1.5` / `gpt-image-2` / `gpt-image-2.5-flare` / `gpt-image-2.5-sunburst` series, as well as the `nano-banana` / `nano-banana-2-lite` / `nano-banana-2` / `nano-banana-2.1` / `nano-banana-pro` series all support `n>1`: the default model and `:reverse` are billed based on the number of successfully generated images, while `:official` is charged based on the actual Token usage aggregated across the entire response, without being multiplied repeatedly by `n`. Note that `response_format=b64_json` only supports `n=1`; when `n>1`, please use the default URL return. If some images fail to generate, only the successful ones will be returned and billed.
qualitystring
Image quality. The GPT Image series models support: `auto`, `high`, `medium`, `low`.
Please select
output_formatstring
The return formats of the GPT Image series models are: `png`, `jpeg`, or `webp`.
Please select
sizestring
Image dimensions, in the format `WIDTHxHEIGHT`, or `auto`. **The GPT Image 2 series (`gpt-image-2`, `gpt-image-2.5-flare`, `gpt-image-2.5-sunburst`)** accepts any `WIDTHxHEIGHT` value that conforms to this format, including 1K presets (`1024x1024`, `1536x1024`, `1024x1536`, `1792x1024`, `1024x1792`), 2K presets (`2048x2048`, `2048x1536`, `1536x2048`, `2048x1152`, `1152x2048`), 4K presets (`2880x2880`, `3264x2448`, `2448x3264`, `3840x2160`, `2160x3840`), and custom dimensions; the default model and `:reverse` are billed per image, while only the dimensions and quality of `:official` affect Token usage and are billed based on actual usage. Dimension limits: custom dimensions must be multiples of 16, the long side must be ≤ 3840, the total pixel count must be 655,360–8,294,400, and the aspect ratio must not exceed 3:1. `dall-e-2` supports: `256x256`, `512x512`, `1024x1024`. Omitting the `size` field is completely equivalent to explicitly passing `auto`: the GPT Image 2 series first identifies explicit pixels, ratios, landscape/portrait orientation, resolution tiers (such as 4K / high-res), or named canvases from the prompt; when a size intention is identified, it uses the planned specific dimensions, and when the prompt has no size requirement or automatic determination is unavailable, it falls back to the dimensions of the first reference image. The final dimensions will be normalized to the above limits; when absolute control is needed, please directly pass `WIDTHxHEIGHT`.
backgroundstring
Only applicable to the GPT Image series models. Transparency handling methods: `transparent` (transparent), `opaque` (opaque), or `auto` (automatic).
Please select
input_fidelitystring
The matching strength for the style and features of the input image. Supported by `gpt-image-1` and `gpt-image-1.5`; `gpt-image-1-mini` and the GPT Image 2 series will ignore this parameter.
Please select
response_formatstring
Response format: `url` (default) or `b64_json`.
Please select
output_compressioninteger
Compression level (0-100%) when outputting `webp` or `jpeg`.
callback_urlstring
Optional callback URL. When provided, the interface immediately returns `task_id` and pushes the results to that URL via POST after the image editing is completed.
asyncboolean
Whether to process in asynchronous mode. When set to `true`, the interface immediately returns `task_id`, without the need to provide `callback_url`, and then the result can be obtained by polling the corresponding task query interface; if `callback_url` is also provided, the result will be pushed to that callback address.
Please select
Response
Integration guide
Kind reminder: For streaming requests, the above code may not be fully applicable. Please refer to the integration documentation for changes.
OpenAI generation
Allow Use General Balance
When 'Allow General Balance' is enabled, the general balance is used automatically if an app's balance is insufficient.