Skip to content

fix(kie): correct 12 more mismatched KIE Market model ids (#11296) - #11667

Merged
diegosouzapw merged 1 commit into
release/v3.8.51from
fix/11296-kie-ai-model-ids
Aug 26, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.51from
fix/11296-kie-ai-model-ids

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Refs #11296

⚠️ base-red inherited: #11449 — ESLint errors (5), docs-sync migrations count (both pre-existing on release/v3.8.51, unrelated to this diff)

Root cause

PR #11326 (merged for #11225) fixed the 4 google-imagen/* KIE Market ids and asserted every other Market namespace "already matches its real upstream id byte-for-byte." That claim was never actually checked against docs.kie.ai for anything beyond google-imagen, and it was wrong: open-sse/handlers/imageGeneration.ts's KIE_MARKET_UPSTREAM_MODEL_IDS map sent several more catalog ids to POST https://api.kie.ai/api/v1/jobs/createTask unchanged even though they diverge from KIE's documented model value — exactly reproducing the reporter's post-fix complaint ("GPT Image 2, Flux, Seedream... The model name you specified is not supported").

TDD

A repro test (tests/unit/kie-market-upstream-id-11296-probe.test.ts, reused verbatim from the triage plan-file) proved 5/5 assertions RED against unfixed release/v3.8.51 code:

✖ GPT Image 2 T2I: actual 'gpt/gpt-image-2-text-to-image' vs expected 'gpt-image-2-text-to-image'
✖ GPT Image 2 I2I: actual 'gpt/gpt-image-2-image-to-image' vs expected 'gpt-image-2-image-to-image'
✖ GPT Image 1.5 T2I: actual 'gpt/gpt-image-1.5-text-to-image' vs expected 'gpt-image/1.5-text-to-image'
✖ Seedream 5.0 Lite T2I: actual 'seedream/5.0-lite-text-to-image' vs expected 'seedream/5-lite-text-to-image'
✖ Flux 2 Pro T2I: actual 'flux/2-pro-text-to-image' vs expected 'flux-2/pro-text-to-image'

What this PR fixes (verified individually against the literal example request JSON on docs.kie.ai — not inferred by pattern)

Catalog id We sent KIE actually expects
gpt/gpt-image-2-text-to-image gpt/gpt-image-2-text-to-image gpt-image-2-text-to-image
gpt/gpt-image-2-image-to-image gpt/gpt-image-2-image-to-image gpt-image-2-image-to-image
gpt/gpt-image-1.5-text-to-image gpt/gpt-image-1.5-text-to-image gpt-image/1.5-text-to-image
gpt/gpt-image-1.5-image-to-image gpt/gpt-image-1.5-image-to-image gpt-image/1.5-image-to-image
seedream/5.0-lite-text-to-image seedream/5.0-lite-text-to-image seedream/5-lite-text-to-image
seedream/5.0-lite-image-to-image seedream/5.0-lite-image-to-image seedream/5-lite-image-to-image
flux/2-pro-text-to-image flux/2-pro-text-to-image flux-2/pro-text-to-image
flux/2-pro-image-to-image flux/2-pro-image-to-image flux-2/pro-image-to-image
flux/2-text-to-image flux/2-text-to-image flux-2/flex-text-to-image
flux/2-image-to-image flux/2-image-to-image flux-2/flex-image-to-image
wan/2.7-image wan/2.7-image wan/2-7-image
wan/2.7-image-pro wan/2.7-image-pro wan/2-7-image-pro

The last 2 (Wan) were not in the original issue report — found during the mandatory full catalog sweep requested by the triage plan-file.

What I re-verified as already correct (no change)

Seedream 4.5 (T2I + edit), google-imagen (all 4, from #11326), grok-imagine, ideogram (v3-text-to-image, v3-edit, v3-remix — each individually confirmed; v3-reframe has no dedicated docs.kie.ai page as of this sweep, assumed correct by sibling pattern only), qwen, qwen2.

What remains open (not fixed here — documented in the map's comment, Refs not Closes)

  • z-image/4.0-text-to-image, z-image/4.5-text-to-image — the only documented Z-Image Market page (docs.kie.ai/market/z-image/z-image) shows a single fixed model enum value "z-image" with no version-specific id or version input parameter found in 3 separate lookup attempts. Unclear whether both catalog ids should collapse to the same upstream call, or whether the catalog itself needs correcting — needs a human/vendor-support decision, not a guess.
  • flux/kontext — no docs.kie.ai/market/flux2/kontext (or similar) Market page exists. Flux Kontext is documented under the separate /flux-kontext-api/* docs tree with its own endpoint (POST /api/v1/flux/kontext/generate, models flux-kontext-pro/flux-kontext-max), not the Market createTask flow this map feeds. This entry may be miscatalogued as isMarket: true in open-sse/config/providers/registry/kie/imageModels.ts and need a dedicated reroute (new endpoint wiring) rather than an id rewrite — out of scope for a data-correctness fix; confirmed there is no existing KIE-specific direct-routing hook for it in imageGeneration.ts today.

Gates run

  • node scripts/check/check-file-size.mjs — OK
  • node scripts/check/check-complexity.mjs — OK (2684 violations vs baseline 2774)
  • node scripts/check/check-cognitive-complexity.mjs — OK (1208 violations vs baseline 1223)
  • node scripts/check/check-changelog-integrity.mjs — OK
  • npm run typecheck:core — clean, exit 0
  • npx eslint --suppressions-location config/quality/eslint-suppressions.json <changed files> — clean, exit 0
  • node --import tsx/esm --test tests/unit/kie-market-upstream-model-id-11225.test.ts tests/unit/kie-market-upstream-id-11296-probe.test.ts — 27/27 pass
  • node --import tsx/esm --test tests/unit/kie-executor-routing.test.ts tests/unit/nanobanana-image-handler.test.ts tests/unit/image-generation-handler.test.ts — 48/48 pass (sibling KIE/image coverage, confirms no regression)

PR #11326 claimed every KIE Market catalog id except google-imagen
already matched its real KIE-documented upstream id. That claim was
false: GPT Image 2 T2I/I2I, GPT Image 1.5 T2I/I2I, Seedream 5.0 Lite
T2I/I2I, all 4 Flux 2 variants, and Wan 2.7 Image/Image Pro were all
sent to KIE's createTask unchanged despite diverging from the id KIE
actually documents, reproducing the reporter's post-fix failures.

Each new mapping was verified individually against the literal example
request JSON on docs.kie.ai (never inferred by pattern, since that is
exactly how the prior "everything else matches" claim went wrong).

z-image/4.0-*, z-image/4.5-* and flux/kontext remain unresolved and
are documented as open follow-ups in the map's comment: the only
documented Z-Image page shows a single fixed model id with no
version-specific variant, and flux/kontext has no Market createTask
documentation at all (it lives under a separate /flux-kontext-api/*
endpoint), so neither can be safely auto-fixed without further
investigation.
@diegosouzapw

Copy link
Copy Markdown
Collaborator Author

Validated in local merge-train (train tip a3a96af7308584900f0fab3ab4afd8499391230a, boarded #11663 #11664 #11665 #11667 #11668 #11669 #11670 #11678 on .113 /srv/omniroute-train) — typecheck:core, file-size, complexity, cognitive-complexity, changelog-integrity all GREEN. npm run test:unit showed 21 failures across 15 test files, none touching this PR's diff; reproduced identically (same test names, same asserts) on origin/release/v3.8.51 alone with zero PRs boarded (targeted re-run, 21/94 fail, same failure set) — confirmed base-red/environment-load drift per merge-gates.md §3, not introduced by any of the 8 boarded PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants