provider/openai: Codex image generation loses its only model when gpt-image-2 is marked deprecated
Description
I previously generated images through OpenChamber using my ChatGPT Plus subscription via Codex OAuth. On Nov 24, openai/gpt-image-2 was still selected in settings but no longer appeared in OpenCode’s runtime model list. Chat still worked. Image generation failed locally with ModelNotFoundError (shown by OpenChamber as no longer available), before any request was sent to Codex.
models.dev #14331 marked gpt-image-2 as deprecated. OpenCode filters out deprecated catalog models, but the Codex image allowlist only includes gpt-image-2 (#60085); I found the same allowlist on dev. This leaves no OpenAI image model available on this connection. OpenAI’s public API notice lists Feb 10, 2027 as the shutdown date; I have not tested whether the Codex backend still accepts the old model or which replacements it supports.
Plugins
OpenChamber’s built-in image tool; OpenCode’s own image tool is disabled by OpenChamber. Not tested with a clean profile.
OpenCode version
2.3.2 bundled with OpenChamber Desktop 2.8.0.
Steps to reproduce
- Connect OpenAI using legacy Codex OAuth, not the separate ‘Sign in with ChatGPT’ flow.
- With the current online model catalog, check OpenCode’s
GET /api/modelforopenai/gpt-image-2; the model is missing. - In OpenChamber, invoke the image tool with
openai/gpt-image-2still saved as the selected model. It fails immediately. Expected: at least one image model supported by the Codex backend remains available.
Operating System
Windows 10 x64, build 19045.6466.
Terminal
Not applicable (desktop app).
Seen with a simulated model or a mock server, not a real provider; a maintainer should confirm.
Thanks for the detailed report and the analysis. I could reproduce this on 2.3.2, and it still happens on the latest dev (1aee987).
What I did: I started opencode serve in a clean profile with the live models.dev catalog, where openai/gpt-image-2 is marked deprecated. Then I stored a legacy Codex OAuth credential (chatgpt-browser). I don't have a real ChatGPT account here, so the credential was a fake one.
GET /api/model?types=image&types=chatlists no OpenAI image model at all.POST /api/experimental/generate/imagewithopenai/gpt-image-2fails locally withModelNotFoundError(Model not found: openai/gpt-image-2), before anything is sent to Codex.
As a control, I used the same catalog with only the deprecated status removed from gpt-image-2. The model is listed again, and the image request goes out to the provider (where it fails only because the token is fake). This matches your reading: deprecated catalog models are filtered out before the Codex image allowlist (which only has gpt-image-2) can keep it, so the Codex login is left with no image model.
The script below reproduces it. I couldn't check whether the Codex backend still accepts gpt-image-2 or which image models it supports instead, because that needs a real account. A maintainer will take it from here.
Reproduction script (repro.sh)
#!/bin/sh
# Reproduces #66303: with the live models.dev catalog (gpt-image-2 marked deprecated),
# the OpenAI Codex login has no image model left in GET /api/model.
# Usage: sh repro.sh (uses `opencode` from PATH)
# OC_DEV=/path/to/checkout sh repro.sh (runs from source)
set -e
PORT=${PORT:-47123}
export OPENCODE_PASSWORD=repro-pass
AUTH="-u opencode:repro-pass"
ROOT=$(mktemp -d)
export HOME=$ROOT/home XDG_DATA_HOME=$ROOT/data XDG_CONFIG_HOME=$ROOT/config XDG_CACHE_HOME=$ROOT/cache XDG_STATE_HOME=$ROOT/state
mkdir -p $HOME $ROOT/project && cd $ROOT/project && git init -q
if [ -n "$OC_DEV" ]; then
OC="bun --conditions=browser --preload=$OC_DEV/packages/tui/node_modules/@opentui/solid/scripts/preload.js $OC_DEV/packages/cli/src/index.ts"
else OC=opencode; fi
$OC --version
if [ "$CONTROL" = 1 ]; then
echo "== CONTROL: same live catalog, with only the deprecated status of openai/gpt-image-2 removed"
curl -s 'https://models.opencode.ai/experimental/v2.0/api.json?type=chat,image,decision,realtime,video&include=openai-codex,openai-chatgpt' > $ROOT/catalog.json
python3 - $ROOT/catalog.json <<'PY'
import json,sys
p=sys.argv[1]; d=json.load(open(p))
for prov in d.values():
ms=prov.get('models',{}) if isinstance(prov,dict) else {}
for k,m in ms.items():
if isinstance(m,dict) and 'gpt-image-2' in k: m.pop('status',None)
json.dump(d,open(p,'w'))
PY
export OPENCODE_MODELS_PATH=$ROOT/catalog.json
fi
$OC serve --hostname 127.0.0.1 --port $PORT > $ROOT/serve.log 2>&1 &
PID=$!; trap 'kill $PID 2>/dev/null' EXIT
for i in $(seq 1 60); do curl -sf $AUTH http://127.0.0.1:$PORT/api/model >/dev/null 2>&1 && break; sleep 1; done
echo "== models.dev live entry for openai/gpt-image-2 (status):"
curl -s https://models.opencode.ai/api.json | python3 -c "import json,sys;print(json.load(sys.stdin)['openai']['models']['gpt-image-2'].get('status'))"
echo "== store a (fake) legacy Codex OAuth credential (methodID chatgpt-browser)"
curl -s $AUTH -X POST http://127.0.0.1:$PORT/api/credential -H 'content-type: application/json' -d '{"integrationID":"openai","label":"codex","value":{"type":"oauth","methodID":"chatgpt-browser","refresh":"r","access":"a","expires":4102444800000,"metadata":{"accountID":"acct"}}}' | head -c 300; echo
sleep 3
echo "== openai image models in GET /api/model:"
curl -s $AUTH "http://127.0.0.1:$PORT/api/model?types=image&types=chat" | python3 -c "
import json,sys
d=json.load(sys.stdin); d=d.get('data',d)
oa=[m for m in d if m.get('providerID')=='openai']
print('openai models listed:', len(oa))
print('openai image models:', [m.get('id') for m in oa if m.get('type')=='image'])
print('gpt-image-2 present:', any(m.get('id')=='gpt-image-2' for m in oa))
"
echo "== POST /api/experimental/generate/image with openai/gpt-image-2:"
curl -s $AUTH -X POST http://127.0.0.1:$PORT/api/experimental/generate/image -H 'content-type: application/json' -d '{"model":{"providerID":"openai","id":"gpt-image-2"},"prompt":"a red circle"}' | head -c 400; echo
Run it: sh repro.sh
Thanks for the detailed report.
This is intentional. OpenCode doesn't offer image generation on ChatGPT subscription logins for now. Sign in with ChatGPT only exposes chat models, and the Codex OAuth login you're using is legacy and will probably be removed in the future, so we won't be adding new image models to it.
For image generation, connect OpenAI with an API key. Closing as not planned.
This is a real issue. It worked days again and now your saying tough luck? Id like a better explanation.