images.edit endpoint rejects GPT Image models
Confirm this is a Node library issue and not an underlying OpenAI API issue
- [x] This is an issue with the Node library
Describe the bug
The images.edit endpoint currently appears to be in a broken state for all models:
- GPT Image models are rejected with a model validation error.
dall-e-2is reported as non-existent when explicitly provided.
This makes the images.edit endpoint completely unusable via the Node.js SDK (and presumably the raw API as well).
Environment
- SDK:
openainpm package v6.34.0 (latest) - Runtime: Node.js v22.14.0
- API Key: Valid, confirmed working for
images.generate
Expected Behavior
Per the Image Generation guide, gpt-image-2 should support image editing:
"Creates an edited or extended image given one or more source images and a prompt. This endpoint supports GPT Image models (
gpt-image-1.5,gpt-image-1,gpt-image-1-mini, andchatgpt-image-latest) anddall-e-2."
The following request should succeed:
const { OpenAI, toFile } = require("openai");
const fs = require("fs");
const client = new OpenAI();
const image = await toFile(fs.createReadStream("photo.png"));
const response = await client.images.edit({
model: "gpt-image-2",
image,
prompt: "make the apple green",
});
Actual Behavior
1. GPT Image models are rejected
Request:
await client.images.edit({
model: "gpt-image-2",
image,
prompt: "make the apple green",
});
Response:
400 Invalid value: 'gpt-image-2'. Value must be 'dall-e-2'.
The same error occurs for gpt-image-1, gpt-image-1.5, gpt-image-1-mini, and chatgpt-image-latest.
2. dall-e-2 is reported as non-existent
Request:
await client.images.edit({
model: "dall-e-2",
image,
prompt: "make the apple green",
});
Response:
400 The model 'dall-e-2' does not exist.
To Reproduce
The issue is reproducible with raw HTTP as well:
curl -X POST "https://api.openai.com/v1/images/edits" \
-H "Authorization: Bearer \$OPENAI_API_KEY" \
-F "model=gpt-image-2" \
-F "[email protected]" \
-F "prompt=make the apple green"
Response:
{
"error": {
"message": "Invalid value: 'gpt-image-2'. Value must be 'dall-e-2'.",
"type": "invalid_request_error",
"param": "model",
"code": null
}
}
curl -X POST "https://api.openai.com/v1/images/edits" \
-H "Authorization: Bearer \$OPENAI_API_KEY" \
-F "model=dall-e-2" \
-F "[email protected]" \
-F "prompt=make the apple green"
Response:
{
"error": {
"message": "The model 'dall-e-2' does not exist.",
"type": "invalid_request_error",
"param": "model",
"code": "model_not_found"
}
}
Additional Context
images.generateworks correctly withgpt-image-2and all other GPT Image models.- The issue is specific to
images.edit. - The
images.editSDK method correctly routes to/images/editsand usesmultipart/form-data, so this is an API-side validation issue, not an SDK bug.
Code snippets
async function edit(args) {
const prompt = args._.slice(1).join(' ');
if (!prompt) {
console.error('Error: prompt is required');
process.exit(1);
}
if (!args.image) {
console.error('Error: --image is required');
process.exit(1);
}
const body = {
prompt,
image: await toFile(fs.createReadStream(args.image)),
model: args.model || DEFAULT_MODEL,
};
if (args.mask) body.mask = await toFile(fs.createReadStream(args.mask));
if (args.n) body.n = parseInt(args.n, 10);
if (args.size) body.size = args.size;
if (args.background) body.background = args.background;
if (args.user) body.user = args.user;
const res = await client.images.edit(body);
const data = res.data || [];
const prefix = 'png';
const paths = [];
for (let i = 0; i < data.length; i++) {
paths.push(saveImage(data[i].b64_json, prefix, i));
}
for (const p of paths) console.log(p);
}
OS
macOS
Node version
Node v22.14.0
Library version
openai v6.34.0
Took a look, https://github.com/openai/openai-node/pull/1853 should address it.
Thanks for reporting this. The image-edit validation issue has been fixed upstream: GPT Image models are now accepted by the image-edit endpoint and are exposed in the SDK. Legacy DALL-E models have been retired and are intentionally rejected. Closing as resolved.