fix(image-gen): Codex-auth images use the native images endpoints, no pinned chat model (#105398, #107076) - #111000
Merged
Merged
Conversation
… chat host model The openai-codex image provider rode a Responses call with a hosted image_generation tool on a pinned chat model (gpt-5.5). Two failure classes came with that shape: when OpenAI withdrew gpt-5.5 from an account cohort every image call 404'd while chat kept working (#105398, #107076), and the host model was free to answer in text instead of calling the tool, so we streamed SSE, kept partial frames and retried on empty streams. Post to chatgpt.com/backend-api/codex/images/generations and images/edits instead - the route the official Codex client uses (codex-rs/ext/image-generation). No host model, no SSE, no partial-frame handling; the response is a plain JSON body with b64_json. Remote source URLs are fetched client-side and inlined as data URLs because the backend's own downloader 400s on ordinary public images. The backend treats model/quality/size as advisory (#107233), so the result now reports reported_quality/reported_size next to the requested values plus the x-codex-imagegen-request-id for support. GPT Image 2.5 is deliberately not added to this catalog: the backend accepts any model id, including nonexistent ones, and generates with its server-managed engine (C2PA reports gpt-image 2.0), so a 2.5 tier here would be a label with no effect (#106708).
Contributor
૮ >ﻌ< ა ci reviewran on 3daf0a7 — fix(image_gen): Codex-auth images use the native images endp
|
Contributor
This was referenced Sep 14, 2026
Closed
Open
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Image generation via ChatGPT/Codex OAuth no longer depends on a pinned chat model: the
openai-codexprovider now posts straight to the Codex backend's nativeimages/generations/images/editsendpoints, the same route the official Codex client uses.Root cause
The provider sent a Responses call to
/backend-api/codex/responseswithmodel: "gpt-5.5"plus a hostedimage_generationtool, and let that chat model decide to call the tool. The chat model was only there to host the tool call, and it was hardcoded.Changes
plugins/image_gen/openai-codex/__init__.py:POST images/generations(text-to-image) orPOST images/edits(withimages[]inline data URLs) using the OAuth token andcodex_cloudflare_headers; body mirrors the official client'sImageGenerationRequest/ImageEditRequest(codex-rs/codex-api/src/images.rs). Deleted:_CODEX_CHAT_MODEL, the SSE parser, partial-frame handling, the no-tool-call retry loop, thetool_choiceworkaround. 428 → 293 lines.400 Error while downloading filefor ordinary public images (probed live).reported_quality,reported_size,pixel_sizealongside the requested values, plusimagegen_request_id(fromx-codex-imagegen-request-id) for OpenAI support tickets.httpx.MockTransport(request path, body, headers, edit inlining, error surfacing, empty data). 467 → 250 lines.image-generation.md(Codex note rewritten; 2.5 stance),image-gen-provider-plugin.md,plugin.yaml.What this fixes
gpt-5.5(#105398, #107076)HTTP 404: The model gpt-5.5 does not existempty_responseafter 1 retry, or a smeared partial frameb64_jsonor an errorreported_quality/reported_sizeshow what the backend actually didGPT Image 2.5 on this provider (#106708, #106717, #107174, #108175)
Deliberately not added. Live probes with a real ChatGPT OAuth token, Sep 14:
/responseshosted toolmodel=gpt-image-2.5-sunburst quality=max size=1536x1024model=gpt-image-2-codex quality=auto size=auto/images/generationsmodel=gpt-image-2.5-sunburst quality=high size=1536x1024quality=low size=1254x1254, PNG C2PAsoftwareAgent gpt-image version 2.0/images/generationsmodel=totally-not-a-modelThe official client also hardcodes
IMAGE_MODEL = "gpt-image-2"and exposes no selector (codex-rs/ext/image-generation/src/tool.rs); OpenAI tracks this at openai/codex#43965. A 2.5 tier here would be a label with no effect. 2.5 stays on the OpenAI API-key provider and FAL (#105988).Live verification (real provider class, temp
HERMES_HOME, real OAuth token)Also probed live: 6 source images on
images/edits→ 200; malformed body →400 Missing required parameter: 'prompt'surfaces verbatim. The generated bicycle image was inspected: complete, non-smeared.scripts/run_tests.sh tests/plugins/image_gen/ tests/tools/test_image_generation_plugin_dispatch.py tests/tools/test_image_generate_schema.py→ 236 passed.Supersedes #106362 (host-model retargeting; the host model is gone). Related: #107240 (metadata honesty; covered by
reported_*), #108171 / #108174 (aspect mismatch;reported_size+pixel_size).Infographic