#5339·PraisonAI

[BUG] image_generate() sends response_format — dall-e-3 and gpt-image-2.5-* fail on v4.7.10

Author: Dhivya-BharathyCreated Sep 28, 2026Updated Sep 28, 2026
Labelsbugdocumentationsecurityperformanceclaude

[BUG] praisonai.capabilities.image_generate() always sends response_format — OpenAI dall-e-3 and gpt-image-2.5-* fail on v4.7.10

Metadata

Field Value
Repository https://github.com/MervinPraison/PraisonAI
Release tested PraisonAI v4.7.10 (db166f427)
Package praisonai (praisonai.capabilities.images)
Related surfaces CLI praisonai images, MCP image tools, ImageAgent examples
Labels bug, sdk-contract, images, litellm, capabilities, openai
Severity High — default image capability path cannot complete a generation against current OpenAI APIs
Component src/praisonai/praisonai/capabilities/images.py
Discovered 2026-09-28 post-release audit (Windows, Python 3.13, LiteLLM bundled with PyPI install)
OpenAI catalog reference https://developers.openai.com/api/docs/models/all (Image: gpt-image-2.5-sunburst, gpt-image-2.5-flare, gpt-image-2)
Duplicate search gh search issues --repo MervinPraison/PraisonAI "response_format" "image_generate" → review before filing

Executive summary

PraisonAI v4.7.10 exposes image_generate() as the programmatic entrypoint for LiteLLM image generation. The helper unconditionally forwards response_format (default "url") to litellm.image_generation().

On current OpenAI + LiteLLM stacks this breaks both the SDK default model and the flagship catalog models PraisonAI already validates:

Model Failure class User-visible error theme
dall-e-3 (SDK default) HTTP 400 from OpenAI Unknown parameter: 'response_format'
gpt-image-2.5-flare (catalog flagship) LiteLLM pre-flight UnsupportedParamsError on response_format

Integrators following OpenAI’s model catalog or PraisonAI’s own praisonai models validate gpt-image-2.5-flare success message will still hit a hard failure at generation time. This is a contract bug: validation and capabilities disagree on what “supported” means.


Expected vs actual

Step Expected for a strong SDK Actual on v4.7.10
image_generate("prompt") with valid OPENAI_API_KEY Returns ImageResult with URL or b64 400 — unknown response_format for dall-e-3
image_generate("prompt", model="gpt-image-2.5-flare") Uses OpenAI GPT-Image 2.5 API UnsupportedParamsError before HTTP
praisonai models validate gpt-image-2.5-flare Implies generation route works SUCCESS (tool-calling flags only) — misleading for image SDK
Align with OpenAI catalog defaults Default model matches current generation stack Default remains dall-e-3 while catalog pushes GPT-Image 2.5

Root cause

In src/praisonai/praisonai/capabilities/images.py, image_generate() builds:

python
call_kwargs = {
    'model': model,
    'prompt': prompt,
    'n': n,
    'size': size,
    'response_format': response_format,  # always sent
    'timeout': timeout,
}
response = litellm.image_generation(**call_kwargs)

OpenAI’s newer image endpoints (including gpt-image-2.5-*) and the current dall-e-3 images route reject or do not accept response_format the way legacy DALL·E 2 did. LiteLLM explicitly documents dropping unsupported params (litellm.drop_params = True) — PraisonAI does not apply model-aware param filtering.

The same pattern likely affects aimage_generate() and image_edit() if they mirror kwargs construction (verify in fix PR).


Architecture (where the failure sits)

mermaid
sequenceDiagram
    participant User
    participant Cap as praisonai.capabilities.images
    participant LLM as LiteLLM image_generation
    participant OAI as OpenAI Images API

    User->>Cap: image_generate(prompt, model=dall-e-3)
    Cap->>LLM: prompt, size, response_format=url
    alt dall-e-3
        LLM->>OAI: POST /images/generations
        OAI-->>LLM: 400 unknown_parameter response_format
        LLM-->>Cap: BadRequestError
    else gpt-image-2.5-flare
        LLM-->>Cap: UnsupportedParamsError (pre-request)
    end
    Cap-->>User: exception (no ImageResult)

Minimal reproduction (copy-paste)

Requires Python 3.10+, pip install praisonai==4.7.10, and a valid OPENAI_API_KEY for the live API case (failures below reproduce even with a valid key because the request shape is invalid).

powershell
pip install "praisonai==4.7.10"
$env:OPENAI_API_KEY = "sk-..."   # real key for live repro

python -m praisonai --version
python -m praisonai models validate gpt-image-2.5-flare
python -m praisonai models validate dall-e-3

python -c "from praisonai.capabilities.images import image_generate; image_generate('a single green pixel', model='dall-e-3')"
python -c "from praisonai.capabilities.images import image_generate; image_generate('a single green pixel', model='gpt-image-2.5-flare')"

Terminal evidence — v4.7.10 live audit (2026-09-28)

Environment: Windows 10, Python 3.13, praisonai==4.7.10 from PyPI, LiteLLM from dependency closure, OPENAI_API_KEY set (redacted in log).

$ python -m praisonai --version
PraisonAI version 4.7.10

$ python -m praisonai models validate gpt-image-2.5-flare
SUCCESS: ✅ 'gpt-image-2.5-flare' is a valid model
Capabilities: tool-calling

$ python -c "from praisonai.capabilities.images import image_generate; image_generate('green pixel', model='dall-e-3')"
Traceback (most recent call last):
  ...
  File ".../praisonai/capabilities/images.py", line 97, in image_generate
    response = litellm.image_generation(**call_kwargs)
  ...
openai.BadRequestError: Error code: 400 - {'error': {'message': "Unknown parameter: 'response_format'.", 'type': 'invalid_request_error', 'param': 'response_format', 'code': 'unknown_parameter'}}

litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenAIException - Error code: 400 - {'error': {'message': "Unknown parameter: 'response_format'.", 'type': 'invalid_request_error', 'param': 'response_format', 'code': 'unknown_parameter'}}

$ python -c "from praisonai.capabilities.images import image_generate; image_generate('green pixel', model='gpt-image-2.5-flare')"
Traceback (most recent call last):
  ...
  File ".../praisonai/capabilities/images.py", line 97, in image_generate
    response = litellm.image_generation(**call_kwargs)
  ...
litellm.exceptions.UnsupportedParamsError: litellm.UnsupportedParamsError: Setting `response_format` is not supported by openai, gpt-image-2.5-flare. To drop it from the call, set `litellm.drop_params = True`.

Interpretation: The SDK never reaches a successful image payload. For GPT-Image 2.5, LiteLLM blocks the call locally; for DALL·E 3, OpenAI rejects the HTTP request.


Impact for SDK consumers

Stakeholder Failure mode
Application developer Copy-paste image_generate("...") fails in production after upgrade
MCP / automation Image tools wrap capabilities — broken default model + broken params
Docs / catalog alignment OpenAI “All models” lists GPT-Image 2.5; PraisonAI validates id but capability layer cannot use it
Release QA gap No integration test asserting image_generate reaches OpenAI with default model

Suggested fix

  1. Model-aware kwargs: Omit response_format (and legacy quality / style) when LiteLLM reports them unsupported for the target model; or set litellm.drop_params = True scoped to the call.
  2. Update default model to a supported OpenAI image id (e.g. gpt-image-2.5-flare or gpt-image-2) once generation succeeds in CI with mocked HTTP.
  3. Extend models validate or add models validate --capability image so “valid” implies the capability route works, not only chat catalogue membership.
  4. Regression tests: Mock litellm.image_generation and assert kwargs for dall-e-3, gpt-image-2.5-flare, and at least one non-OpenAI provider.

Proposed implementation sketch

python
import litellm

def _image_gen_kwargs(model: str, base: dict) -> dict:
    kwargs = dict(base)
    # Query litellm supported params or maintain a small allowlist per model family
    unsupported = litellm.get_supported_image_generation_params(model=model)
    if unsupported is not None:
        for key in list(kwargs):
            if key not in unsupported:
                kwargs.pop(key, None)
    return kwargs

(Exact API depends on installed LiteLLM version — align with project’s pinned range.)


Acceptance criteria

  • image_generate("test prompt") with default model completes or fails with auth/billing, not response_format errors
  • image_generate(..., model="gpt-image-2.5-flare") succeeds with valid OpenAI key (or mocked test equivalent)
  • image_generate(..., model="dall-e-3") either works or default is changed with migration note in changelog
  • Unit tests cover kwargs sent to LiteLLM for at least two model families
  • Changelog entry under v4.7.11+ documents breaking default model change if applicable

Workaround (until fixed)

Call LiteLLM directly with params known to work for your model, or patch locally:

python
import litellm
litellm.drop_params = True  # global — use cautiously

from praisonai.capabilities.images import image_generate

# Explicit model + avoid response_format by bypassing helper:
response = litellm.image_generation(model="gpt-image-2.5-flare", prompt="...", n=1, size="1024x1024")

Prefer fixing the capability helper so MCP and CLI inherit the behavior.


Relation to OpenAI model catalog

OpenAI documents multiple image SKUs (GPT-Image 2.5 Sunburst/Flare, GPT-Image 2, deprecated GPT-Image 1.x). PraisonAI’s LiteLLM catalogue already lists gpt-image-2.5-flare and gpt-image-2.5-sunburst as valid ids, but image_generate() cannot consume them due to param forwarding. This is distinct from “model not in catalogue” bugs — the id validates, the capability implementation is stale.


Test plan (for maintainers)

Test Type Notes
Default image_generate kwargs Unit Assert no response_format for gpt-image-2.5
Live smoke (optional CI secret) Integration Single 256px or minimal cost prompt
CLI praisonai images CLI Same code path via _cap("images", ...)
Backward compat dall-e-2 Unit If still supported, ensure b64 path works

Appendix — contrast with chat/agent path

Chat models (e.g. gpt-4o-mini) use Agent + LiteLLM completion and were not affected in the same audit. Image generation is a separate capability module; parity with OpenAI’s full catalog requires fixing this module independently of agent chat routing.


Appendix — severity rationale

High because:

  • Default public API surface is non-functional against OpenAI with standard keys.
  • Validators green-light models that the capability layer rejects.
  • Fix is localized but user trust impact is broad (any tutorial using image_generate()).

Appendix — filing checklist


Appendix — extended terminal transcript (validator vs generation mismatch)

$ python -m praisonai models validate gpt-image-2.5-flare
SUCCESS: ✅ 'gpt-image-2.5-flare' is a valid model
Capabilities: tool-calling

$ python -m praisonai models validate dall-e-3
SUCCESS: ✅ 'dall-e-3' is a valid model
Capabilities: tool-calling

$ python -c "from praisonai.capabilities.images import image_generate; print('calling...'); image_generate('test', model='gpt-image-2.5-flare')"
calling...
UnsupportedParamsError: Setting `response_format` is not supported by openai, gpt-image-2.5-flare. To drop it from the call, set `litellm.drop_params = True`.

This pair demonstrates validate SUCCESS → generate FAIL without any API key rotation or network ambiguity.


Appendix — code reference (default signature)

python
def image_generate(
    prompt: str,
    model: str = "dall-e-3",
    ...
    response_format: str = "url",
    ...
) -> List[ImageResult]:

Docstring examples still imply DALL·E 3-era parameters (quality, style, response_format) without noting OpenAI API drift in v4.7.10.


Appendix — consumer FAQ

Q: Does Agent(llm="gpt-image-2.5-flare") generate images?
A: No — that uses chat/completion routing, not image_generate(). This issue is specific to the capabilities image module.

Q: Should I use OpenAI’s HTTP API directly?
A: Workaround only until PraisonAI forwards compatible kwargs.

Q: Is this a LiteLLM bug?
A: LiteLLM correctly rejects unsupported params; PraisonAI should not send them for models that do not accept them.


Appendix — mermaid (validation vs execution gap)

mermaid
flowchart LR
    A[models validate] --> B{In LiteLLM cost map?}
    B -->|yes| C[SUCCESS message]
    D[image_generate] --> E{Params compatible?}
    E -->|no| F[Exception]
    C -.->|does not imply| E

Appendix — release context (v4.7.10)

Tag v4.7.10 (db166f427) is the latest published release at audit time. Capabilities image module behavior matches prior tags regarding response_format forwarding; the failure became critical as OpenAI tightened parameter schemas and shipped GPT-Image 2.5 ids in the public catalog.


Appendix — duplicate-issue search (run before filing)

gh search issues --repo MervinPraison/PraisonAI "image_generate" --limit 30
gh search issues --repo MervinPraison/PraisonAI "response_format" "dall-e" --limit 30
gh search issues --repo MervinPraison/PraisonAI "gpt-image-2.5" --limit 30

Appendix — post-fix verification commands

powershell
pip install praisonai==4.7.11  # after release
python -c "from praisonai.capabilities.images import image_generate; r=image_generate('pixel', model='gpt-image-2.5-flare'); print(len(r), r[0].url or 'b64')"

Expect non-empty result list and provider-side success or explicit quota error — not parameter errors.


Appendix — param matrix by model family (maintainer reference)

Parameter dall-e-2 era dall-e-3 (current API) gpt-image-2.5-*
prompt yes yes yes
n yes yes verify per sku
size yes yes yes
quality no historically yes verify
style no historically yes verify
response_format often yes rejected v4.7.10 unsupported in LiteLLM

PraisonAI should not send a union of all columns to every model.


Appendix — MCP and CLI blast radius

Any MCP tool wrapping image_generate() inherits broken kwargs. CLI subcommands that call _cap("images", "image_generate") fail identically. Fixing only documentation without code leaves automation hosts broken.


Appendix — regression test payload (mock)

python
def test_image_generate_drops_response_format_for_gpt_image(monkeypatch):
    captured = {}
    def fake_image_generation(**kwargs):
        captured.update(kwargs)
        class R: data = []
        return R()
    monkeypatch.setattr(litellm, "image_generation", fake_image_generation)
    from praisonai.capabilities.images import image_generate
    image_generate("x", model="gpt-image-2.5-flare")
    assert "response_format" not in captured

Appendix — changelog snippet (suggested)

markdown
### Fixed
- `image_generate()` omits unsupported parameters for OpenAI GPT-Image 2.5 and current DALL·E 3 routes.
- Default image model updated to `gpt-image-2.5-flare` (breaking).

### Migration
- If you relied on `response_format="b64_json"`, pass provider-specific flags documented for your model.

Appendix — security note

Broken requests still transmit prompts to LiteLLM/OpenAI client libraries when auth is configured. Failures are immediate, but integrators should not log full prompts on error paths in production.


Appendix — performance note

UnsupportedParamsError fails locally without HTTP — good for fast feedback once fixed. DALL·E 3 400 fails after request assembly — wastes latency until params are trimmed.


Appendix — OpenAI error codes (dall-e-3 repro)

json
{
  "error": {
    "message": "Unknown parameter: 'response_format'.",
    "type": "invalid_request_error",
    "param": "response_format",
    "code": "unknown_parameter"
  }
}

PraisonAI should map this to a actionable SDK error suggesting upgrade or param drop.


Appendix — version pin note

Re-test when bumping LiteLLM in PraisonAI — param support tables change per LiteLLM release. Add compatibility matrix to maintainer docs.


Appendix — image_edit parity check

Apply the same param-filtering logic to image_edit() and aimage_edit() if those functions forward response_format unconditionally — parity audit required in fix PR.


Appendix — GitHub issue title (copy-paste)

[BUG] image_generate() sends response_format — dall-e-3 and gpt-image-2.5-* fail on v4.7.10


End of issue document.