Default PaintPlus OpenAI provider to gpt-image-2, fix GPU quick-start

dall-e-2/dall-e-3 retired May 12 2026 and gpt-image-1 deprecates Oct 23
2026, so move every OpenAI default (config.py, both provider classes,
both compose files, .env.example, the in-app provider-settings dropdown,
README) to gpt-image-2 for both generation and edits. Also fix response
parsing in ai_provider.py's OpenAIProvider, which never sent a model
param and assumed a url response — gpt-image-1/2 only return b64_json.

Separately, .env.example shipped AI_PROVIDER=replicate by default, but
replicate has no driver in remote_provider.py, so following the
documented "cp .env.example .env" setup silently broke every AI call
and defeated the GPU quick-start (an explicit non-empty .env value
overrides docker-compose.gpu.yml's own local_gpu fallback). Default to
local_gpu instead, mark replicate/stability as not-yet-implemented, and
recommend Lykon/dreamshaper-8-inpainting as a hands/face-tuned
HF_MODEL_INPAINT override for 4-6GB cards (Quadro P2200, GTX 1060/1660).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nb2vJ8W7bHKx1JXVvpCraH
This commit is contained in:
Claude
2026-06-26 15:17:18 +00:00
parent 36a126bee7
commit 43c66ea860
8 changed files with 55 additions and 46 deletions
+22 -12
View File
@@ -19,18 +19,22 @@
# local_gpu = FREE, runs on YOUR GPU — best option if you have an NVIDIA card
# (use docker-compose.gpu.yml — models auto-download on first use)
# mock = Free, returns original image unchanged (UI testing only)
# openai = DALL-E 3 / gpt-image-1 (~$0.02-0.04/image)
# stability = Stability AI SDXL (~$0.01/image)
# replicate = Multiple models (~$0.002-0.03/image)
# openai = gpt-image-2 generation + edits (~$0.006-0.21/image, see below)
# stability = NOT IMPLEMENTED YET — config field exists but no driver in
# remote_provider.py; setting this breaks every AI call
# replicate = NOT IMPLEMENTED YET — same as above (Replicate IS used for
# Smart Select's SAM fallback, but that's a separate code path)
# invokeai = Self-hosted InvokeAI running on another machine
# comfyui = Self-hosted ComfyUI running on another machine
#
# GPU QUICK-START:
# docker compose -f docker-compose.gpu.yml up --build
# (AI_PROVIDER defaults to local_gpu in that compose file)
# (AI_PROVIDER defaults to local_gpu in that compose file — but only if this
# var is unset/blank; since AI_PROVIDER=local_gpu is set explicitly below,
# that's what you get either way)
# =============================================================================
AI_PROVIDER=replicate
AI_PROVIDER=local_gpu
# ── Local GPU settings (only relevant when AI_PROVIDER=local_gpu) ────────────
# Auto-download HuggingFace models on first request (true/false)
@@ -40,7 +44,11 @@ LOCAL_GPU_MAX_PIPELINES=2
# HuggingFace token — only needed for gated/private models
#HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Override auto-selected model for any operation (leave blank = auto by VRAM tier)
#HF_MODEL_INPAINT=your-org/your-inpaint-model
# On 4-6GB cards (Quadro P2200, GTX 1060/1660, etc.) the auto-tier picks either
# slow SDXL+CPU-offload or a generic (not hand/face-tuned) SD checkpoint.
# Lykon/dreamshaper-8-inpainting is SD1.5-based (1.7GB, fast, no offload needed)
# and noticeably better on hands/faces — worth forcing on small cards:
#HF_MODEL_INPAINT=Lykon/dreamshaper-8-inpainting
#HF_MODEL_TXT2IMG=your-org/your-txt2img-model
#HF_MODEL_IMG2IMG=your-org/your-img2img-model
# ─────────────────────────────────────────────────────────────────────────────
@@ -76,17 +84,19 @@ LOCAL_GPU_MAX_PIPELINES=2
REPLICATE_API_KEY=r8_PASTE_YOUR_KEY_HERE
# ───────────────────────────────────────────────────────────────────────────
# OPENAI (cloud, dall-e-3 / gpt-image-1)
# OPENAI (cloud, gpt-image-2)
# Get key at: https://platform.openai.com/api-keys
# AI_PROVIDER=openai
# ───────────────────────────────────────────────────────────────────────────
# dall-e-2 and dall-e-3 were retired May 12, 2026; gpt-image-1 deprecates
# Oct 23, 2026. gpt-image-2 is the current model and handles both
# generation and masked edits (inpaint/img2img/outpaint) — no org
# verification step needed, unlike gpt-image-1.
# Pricing (1024x1024): ~$0.006 low / $0.053 medium / $0.211 high quality.
#OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#OPENAI_MODEL=dall-e-3
#OPENAI_MODEL=gpt-image-2
# Model for inpaint/img2img/outpaint (the /v1/images/edits endpoint).
# dall-e-3 does NOT support edits at all — keep this on gpt-image-1 for
# ChatGPT-comparable edit quality, or set dall-e-2 for the older/cheaper option.
# Note: gpt-image-1 may require completing org verification at platform.openai.com.
#OPENAI_EDIT_MODEL=gpt-image-1
#OPENAI_EDIT_MODEL=gpt-image-2
# ───────────────────────────────────────────────────────────────────────────
# INVOKEAI (self-hosted, best for Flux/SDXL)