The imageEdits operation does not work with the specified model, dall-e-3. Pleas...

2026年01月09日 15:27 状态: processing

🚨 错误信息

The imageEdits operation does not work with the specified model, dall-e-3. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://***.com/***?linkid=***

🤖 AI解决方案

代码糕手 - 报错分析报告

1. 错误翻译



原文:The imageEdits operation does not work with the specified model, dall-e-3. Please choose different model and try again.
译文:imageEdits 操作不能与指定的模型 dall-e-3 一起使用。请选择其他模型并重试。

2. 原因分析


这是一个 OpenAI 图像处理 API 的模型兼容性错误。您的代码尝试调用 imageEdits(图片编辑)API 操作,但为其指定了 dall-e-3 模型。根据 OpenAI 官方文档,dall-e-3 模型主要用于 imageGenerations(图片生成),而不支持 imageEdits 操作。

错误发生位置:在调用图片编辑 API 的代码处,model 参数被错误地设置为 "dall-e-3"

3. 解决方案


您需要将 model 参数更改为支持 imageEdits 操作的模型。目前,dall-e-2 是该操作受支持的模型。

python

原代码中可能类似这样:


response = openai.Image.create_edit(
image=open("original.png", "rb"),
mask=open("mask.png", "rb"),
prompt="A sunlit indoor lounge area with a pool containing a flamingo",
model="dall-e-3", # ❌ 错误的模型
size="1024x1024"
)

修复后的代码(替换模型参数):


response = openai.Image.create_edit(
image=open("original.png", "rb"),
mask=open("mask.png", "rb"),
prompt="A sunlit indoor lounge area with a pool containing a flamingo",
model="dall-e-2", # ✅ 正确的模型
size="1024x1024"
)

4. ️ 预防措施


  • 查阅官方文档 ️:在进行 API 集成前,务必查阅最新的[模型与端点兼容性矩阵](https://platform.openai.com/docs/models/model-endpoint-compatibility)。这可以帮助您快速匹配操作与模型。

  • 使用 SDK 的默认值 ️:大多数 SDK(如 openai Python 库)会为特定操作设置一个合适的默认模型。在不确定时,可以省略 model 参数,让 SDK 自动选择,这通常是更安全的方式。