Skip to content

Commit c9bd2c6

Browse files
authored
fix(media): drop response_format for gpt-image-* on /v1/images/edits (#5727) (#5760)
OpenAI rejects response_format on /v1/images/edits when the model is a gpt-image-* model with HTTP 400 'Unknown parameter: response_format'. The generations branch already avoids setting response_format for gpt-image-*, but the edit (image-to-image) branch set it unconditionally whenever a reference image was supplied. Set response_format only for non-gpt-image-* models in the edit branch to match the generations behaviour.
1 parent f44ca62 commit c9bd2c6

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

apps/daemon/src/media/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,13 @@ async function renderCustomOpenAIImage(ctx: MediaContext, credentials: ProviderC
12461246
};
12471247
let url = buildOpenAIImageUrl(baseUrl, false);
12481248
if (ctx.imageRef?.dataUrl) {
1249-
body.response_format = 'b64_json';
1249+
// gpt-image-* does NOT accept response_format on /v1/images/edits
1250+
// (HTTP 400 "Unknown parameter: 'response_format'"). dall-e-2
1251+
// accepts it; the base b64 path is what callers expect either way,
1252+
// so we only set response_format for non-gpt-image models.
1253+
if (!wireModel.startsWith('gpt-image-')) {
1254+
body.response_format = 'b64_json';
1255+
}
12501256
body.images = [{ image_url: ctx.imageRef.dataUrl }];
12511257
url = buildOpenAIImageEditUrl(baseUrl);
12521258
}

0 commit comments

Comments
 (0)