deepchat icon indicating copy to clipboard operation
deepchat copied to clipboard

[BUG] chatgpt-image-2 is not routed as an image generation model

Open Marco9442 opened this issue 3 months ago • 1 comments

System details / 系统信息

DeepChat dev branch at c60a38f8611f92776eec6e0823ffa3df8bdc99c8. Source-level routing issue; platform independent.

What's wrong? / 出了什么问题?

chatgpt-image-2 is recognized inconsistently by the OpenAI image-generation settings and the actual model-routing logic.

Steps to reproduce from the current source:

  1. Configure an OpenAI/OpenAI-compatible/New API model with ID chatgpt-image-2, without manually forcing the model type or API endpoint to image generation.
  2. src/shared/imageGenerationSettings.ts treats it as an OpenAI image-generation route because the fallback is gpt-image-2 and the check uses modelId.includes(...). Therefore chatgpt-image-2 matches.
  3. src/main/provider/providers/aiSdkProvider.ts only detects image models whose IDs start with dall-e- or gpt-image-, so chatgpt-image-2 does not match.
  4. src/shared/model.ts uses the same startsWith('gpt-image-') rule for New API image-model inference and Responses incompatibility detection, so it also does not infer chatgpt-image-2 as image generation from the model ID.

Expected: chatgpt-image-2 should be classified and routed consistently as an image-generation model, the same way the image-generation settings logic already treats it.

Actual: the image settings logic can recognize the model while runtime/New API routing still treats it as a chat model unless metadata or a manual Image Generation / image endpoint override is provided.

Relevant code:

  • src/shared/imageGenerationSettings.ts: OPENAI_IMAGE_GENERATION_MODEL_ID_FALLBACK = 'gpt-image-2' + modelId.includes(...)
  • src/main/provider/providers/aiSdkProvider.ts: OPENAI_IMAGE_GENERATION_MODEL_PREFIXES = ['dall-e-', 'gpt-image-']
  • src/shared/model.ts: image inference and Responses incompatibility checks only use the gpt-image- prefix

There is currently no exact chatgpt-image-2 handling in the repository.

A possible fix would be to centralize the OpenAI image-model ID check in one shared helper (including chatgpt-image- aliases) and reuse it for settings, runtime routing, and New API inference, so these paths cannot diverge.

Marco9442 avatar Aug 18 '26 02:08 Marco9442

Closing this issue because I misidentified the model name. OpenAI image model IDs use the gpt-image-* naming pattern, which DeepChat already handles with the gpt-image- prefix. Sorry for the noise.

Marco9442 avatar Aug 18 '26 02:08 Marco9442