Replace retired OpenAI image models with gpt-image-2 (DALL-E shut down 2026-05-12)

- openai_image: enum narrowed to ["gpt-image-2"]; DALL-E code path, sizes
  (1024x1792/1792x1024) and qualities (standard/hd) removed; estimate_cost
  updated to real GPT Image 2 pricing ($0.006/$0.053/$0.211 at 1024x1024)
- image_gen (deprecated but callable): default dall-e-3 -> gpt-image-2; drop
  response_format="b64_json", which GPT image models reject; update pricing
- docs/skills sweep: scrub retired-model references from README (en/zh),
  .env.example, docs/PROVIDERS.md (incl. pricing table + deprecation note),
  docs/ARCHITECTURE.md, AGENT_GUIDE.md, skills/creative/*, 14 pipeline
  director skills, and tests/qa/QA_PLAN.md

Source: https://developers.openai.com/api/docs/deprecations

proofread by fable 5 + codex
This commit is contained in:
Remotely Human
2026-07-02 11:36:31 +08:00
parent 07739952a8
commit fabc0e7088
26 changed files with 69 additions and 85 deletions
+6 -6
View File
@@ -7,7 +7,7 @@
pexels_image, pixabay_image). This file is kept for backwards
compatibility and will be removed in a future release.
Supports cloud API providers (FLUX via fal.ai/Replicate, OpenAI DALL-E)
Supports cloud API providers (FLUX via fal.ai/Replicate, OpenAI GPT Image)
and local Stable Diffusion via diffusers. Reports unavailable with
install instructions when no provider is configured.
"""
@@ -43,12 +43,12 @@ class ImageGen(BaseTool):
stability = ToolStability.EXPERIMENTAL
execution_mode = ExecutionMode.SYNC
determinism = Determinism.SEEDED
runtime = ToolRuntime.HYBRID # API (DALL-E/FLUX) or local (diffusers)
runtime = ToolRuntime.HYBRID # API (GPT Image/FLUX) or local (diffusers)
dependencies = [] # checked dynamically based on provider
install_instructions = (
"Set one of these environment variables:\n"
" OPENAI_API_KEY — for DALL-E 3\n"
" OPENAI_API_KEY — for GPT Image 2\n"
" FAL_KEY — for FLUX via fal.ai\n"
"Or install diffusers for local generation:\n"
" pip install diffusers transformers accelerate torch"
@@ -121,7 +121,7 @@ class ImageGen(BaseTool):
def estimate_cost(self, inputs: dict[str, Any]) -> float:
provider = inputs.get("provider") or self._detect_provider()
if provider == "openai":
return 0.04 # DALL-E 3 standard
return 0.053 # gpt-image-2 medium at 1024x1024 (call uses auto quality)
if provider == "flux":
return 0.03
return 0.0 # local
@@ -159,14 +159,14 @@ class ImageGen(BaseTool):
client = OpenAI()
prompt = inputs["prompt"]
size = f"{inputs.get('width', 1024)}x{inputs.get('height', 1024)}"
model = inputs.get("model", "dall-e-3")
model = inputs.get("model", "gpt-image-2")
# GPT image models don't accept response_format; they always return b64
response = client.images.generate(
model=model,
prompt=prompt,
size=size,
n=1,
response_format="b64_json",
)
image_data = base64.b64decode(response.data[0].b64_json)
+18 -38
View File
@@ -1,4 +1,4 @@
"""OpenAI GPT Image generation (gpt-image-2 / DALL-E 3)."""
"""OpenAI GPT Image generation (gpt-image-2)."""
from __future__ import annotations
@@ -60,20 +60,17 @@ class OpenAIImage(BaseTool):
"prompt": {"type": "string"},
"model": {
"type": "string",
"enum": ["gpt-image-2", "dall-e-3"],
"enum": ["gpt-image-2"],
"default": "gpt-image-2",
},
"size": {
"type": "string",
"enum": [
"1024x1024", "1536x1024", "1024x1536", "auto",
"1024x1792", "1792x1024", # dall-e-3 only
],
"enum": ["1024x1024", "1536x1024", "1024x1536", "auto"],
"default": "1024x1024",
},
"quality": {
"type": "string",
"enum": ["low", "medium", "high", "auto", "standard", "hd"],
"enum": ["low", "medium", "high", "auto"],
"default": "high",
},
"output_format": {
@@ -100,15 +97,12 @@ class OpenAIImage(BaseTool):
return ToolStatus.UNAVAILABLE
def estimate_cost(self, inputs: dict[str, Any]) -> float:
model = inputs.get("model", "gpt-image-2")
# gpt-image-2 per-image pricing at 1024x1024 (non-square sizes run
# slightly cheaper): https://developers.openai.com/api/docs/guides/image-generation
quality = inputs.get("quality", "high")
n = inputs.get("n", 1)
if "gpt-image" in model:
cost_map = {"low": 0.011, "medium": 0.042, "high": 0.167, "auto": 0.042}
return cost_map.get(quality, 0.042) * n
# dall-e-3 fallback pricing
quality_map = {"standard": 0.04, "hd": 0.08}
return quality_map.get(quality, 0.04) * n
cost_map = {"low": 0.006, "medium": 0.053, "high": 0.211, "auto": 0.053}
return cost_map.get(quality, 0.053) * n
def execute(self, inputs: dict[str, Any]) -> ToolResult:
if not os.environ.get("OPENAI_API_KEY"):
@@ -127,30 +121,16 @@ class OpenAIImage(BaseTool):
n = inputs.get("n", 1)
try:
if "gpt-image" in model:
quality = inputs.get("quality", "high")
output_format = inputs.get("output_format", "png")
response = client.images.generate(
model=model,
prompt=prompt,
size=size,
quality=quality,
output_format=output_format,
n=n,
)
else:
# dall-e-3 path
quality = inputs.get("quality", "standard")
if quality in ("low", "medium", "high", "auto"):
quality = "standard" # map to dall-e-3 quality options
response = client.images.generate(
model=model,
prompt=prompt,
size=size,
quality=quality,
n=1, # dall-e-3 only supports n=1
response_format="b64_json",
)
quality = inputs.get("quality", "high")
output_format = inputs.get("output_format", "png")
response = client.images.generate(
model=model,
prompt=prompt,
size=size,
quality=quality,
output_format=output_format,
n=n,
)
image_data = base64.b64decode(response.data[0].b64_json)
ext = inputs.get("output_format", "png")