openclaw - 💡(How to fix) Fix Bug: Codex image generation hardcoded gpt-5.4 model causes 500 errors (gpt-5.5 required) [3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#71513Fetched 2026-04-26 05:12:04
View on GitHub
Comments
3
Participants
2
Timeline
9
Reactions
0
Timeline (top)
commented ×3mentioned ×2subscribed ×2closed ×1

Codex image generation (via OAuth) fails with HTTP 500 on OpenClaw 2026.4.23 because generateOpenAICodexImage hardcodes model: "gpt-5.4" in the request body. OpenAI has retired gpt-5.4 from the Codex Responses API — it now requires `gpt-5.5".

Error Message

Codex image generation: response error statusCode=500

Root Cause

In src/image-generation/provider.ts (bundled as dist/image-generation-provider-dj3H3v8Q.js), the generateOpenAICodexImage function hardcodes:

body: {
    model: "gpt-5.4",  // ← hardcoded, should be gpt-5.5
    input: [{ role: "user", content }],
    instructions: OPENAI_CODEX_IMAGE_INSTRUCTIONS,
    tools: [{ type: "function", name: "generate_image", ... }],
    tool_choice: { type: "function", name: "generate_image" }
}

The Codex API now rejects gpt-5.4 and returns HTTP 500.

Fix Action

Fix / Workaround

Workaround (until next release)

⚠️ This patch is overwritten by npm update -g openclaw. Re-apply after updating.

Code Example

body: {
    model: "gpt-5.4",  // ← hardcoded, should be gpt-5.5
    input: [{ role: "user", content }],
    instructions: OPENAI_CODEX_IMAGE_INSTRUCTIONS,
    tools: [{ type: "function", name: "generate_image", ... }],
    tool_choice: { type: "function", name: "generate_image" }
}

---

image auth selected: provider=openai-codex mode=oauth transport=codex-responses requestedModel=gpt-image-2 responsesModel=gpt-5.4 timeoutMs=120000
Codex image generation: response error statusCode=500

---

FILE="$(npm root -g)/openclaw/dist/image-generation-provider-dj3H3v8Q.js"

# Fix the model in the request body
sed -i 's/model: "gpt-5.4"/model: "gpt-5.5"/' "$FILE"

# Fix the log message (cosmetic)
sed -i 's/responsesModel=gpt-5.4/responsesModel=gpt-5.5/' "$FILE"

# Restart gateway
openclaw gateway restart
RAW_BUFFERClick to expand / collapse

Summary

Codex image generation (via OAuth) fails with HTTP 500 on OpenClaw 2026.4.23 because generateOpenAICodexImage hardcodes model: "gpt-5.4" in the request body. OpenAI has retired gpt-5.4 from the Codex Responses API — it now requires `gpt-5.5".

Reproduction

  1. Install OpenClaw 2026.4.23
  2. Configure imageGenerationModel.primary: "openai/gpt-image-2" with Codex OAuth (no OPENAI_API_KEY)
  3. Run image_generate with any prompt
  4. Receive HTTP 500 from chatgpt.com/backend-api/codex/responses

Root Cause

In src/image-generation/provider.ts (bundled as dist/image-generation-provider-dj3H3v8Q.js), the generateOpenAICodexImage function hardcodes:

body: {
    model: "gpt-5.4",  // ← hardcoded, should be gpt-5.5
    input: [{ role: "user", content }],
    instructions: OPENAI_CODEX_IMAGE_INSTRUCTIONS,
    tools: [{ type: "function", name: "generate_image", ... }],
    tool_choice: { type: "function", name: "generate_image" }
}

The Codex API now rejects gpt-5.4 and returns HTTP 500.

Log Evidence

image auth selected: provider=openai-codex mode=oauth transport=codex-responses requestedModel=gpt-image-2 responsesModel=gpt-5.4 timeoutMs=120000
Codex image generation: response error statusCode=500

Workaround (until next release)

FILE="$(npm root -g)/openclaw/dist/image-generation-provider-dj3H3v8Q.js"

# Fix the model in the request body
sed -i 's/model: "gpt-5.4"/model: "gpt-5.5"/' "$FILE"

# Fix the log message (cosmetic)
sed -i 's/responsesModel=gpt-5.4/responsesModel=gpt-5.5/' "$FILE"

# Restart gateway
openclaw gateway restart

⚠️ This patch is overwritten by npm update -g openclaw. Re-apply after updating.

Related

  • Issue #71312 — same root cause (closed, fix not in 2026.4.23)
  • PR #71405 — fix: gpt-5.4 → gpt-5.5
  • PR #71407 — use gpt-image-2 model on gpt-5.5 endpoint
  • PR #71408 — canonical fix: read model from config (merged by @steipete)

extent analysis

TL;DR

Update the hardcoded model in the generateOpenAICodexImage function from gpt-5.4 to gpt-5.5 to fix the HTTP 500 error.

Guidance

  • Identify the image-generation-provider-dj3H3v8Q.js file and update the hardcoded model value to gpt-5.5 using a text editor or the provided sed command.
  • Restart the OpenClaw gateway after applying the patch to ensure the changes take effect.
  • Be aware that this patch will be overwritten by npm update -g openclaw, so re-apply the fix after updating.
  • Consider waiting for the next release, which should include the canonical fix to read the model from the configuration.

Example

The provided sed command can be used to update the hardcoded model value:

sed -i 's/model: "gpt-5.4"/model: "gpt-5.5"/' "$FILE"

Notes

This workaround is temporary and may not be suitable for production environments. The canonical fix, which reads the model from the configuration, is recommended for a more robust solution.

Recommendation

Apply the workaround by updating the hardcoded model value to gpt-5.5 using the provided sed command, as this is the most straightforward solution until the next release.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Bug: Codex image generation hardcoded gpt-5.4 model causes 500 errors (gpt-5.5 required) [3 comments, 2 participants]