Skip to content

image_gen openai plugin: API_MODEL hardcoded, breaks third-party OpenAI-compatible backends #18793

@y0shua1ee

Description

@y0shua1ee

Problem

The new plugins/image_gen/openai/__init__.py (from PR #13799) has a hardcoded API_MODEL:

API_MODEL = "gpt-image-2"

payload = {
    "model": API_MODEL,   # always "gpt-image-2", regardless of config
    ...
}

This means if a user sets image_gen.model: gpt-image-2-1k or uses a third-party OpenAI-compatible backend (e.g., Krill, OpenRouter image endpoints, local proxies) where the model name is different, the request still sends "model": "gpt-image-2".

Why this matters

  • Third-party providers that follow the OpenAI /v1/images/generations spec but have different model names cannot be used because the model name is not configurable.
  • The three-tier low/medium/high system only affects the quality parameter, not the model name sent to the API.
  • Users routing through OPENAI_BASE_URL to a compatible backend get the wrong model name.

Expected behavior

The plugin should respect the model ID from config — either by using it directly as the API model, or by providing a mechanism to override API_MODEL.

Proposed solution

Option A: Allow image_gen.openai.model to serve as the actual model field in the API request when it is not one of the three recognized tier IDs.

Option B: Add an image_gen.openai.api_model config key that overrides API_MODEL.

Option C: Read OPENAI_IMAGE_MODEL_NAME env var as escape hatch for the API model name.


Discovered while trying to use Krill AI as an image backend, which supports gpt-image-2 via OpenAI-compatible API but uses different model identifiers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/pluginsPlugin system and bundled pluginstype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions