Skip to content

[Upstream PR #148] fix(openai): disable image generation tool for Codex models #115

@quangdang46

Description

@quangdang46

Mirrored from upstream 1jehuang/jcodePull Request #148 by @naveenreddy007
Original state: open
Created: 2026-05-06T18:46:15Z · Updated: 2026-05-06T18:46:19Z
Diff: https://github.com/1jehuang/jcode/pull/148.diff
This issue is an auto-mirrored copy. Comments and edits here are local to quangdang46/jcode — do not expect them to propagate upstream.


Summary

  • Do not attach the provider-native image_generation tool when the active OpenAI/ChatGPT model is a Codex model.
  • Preserve native image generation for non-Codex ChatGPT models.
  • Add payload regression tests for both supported and unsupported model families.

Why

ChatGPT/Codex routes such as gpt-5.3-codex-spark can reject requests with:

invalid_request_error: Tool 'image_generation' is not supported with gpt-5.3-codex-spark-1p-codexswic-ev3.

This happens because Jcode currently adds image_generation for all ChatGPT-mode OpenAI requests. Codex models do not support that native tool, so requests can fail before the assistant can respond.

Validation

  • cargo fmt --all
  • cargo test test_chatgpt_payload_ --lib
  • cargo build --release

View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions