[PR #8872] [MERGED] feat(images): GPT Image 2.6 and the shared animated GIF option #8854

Closed
opened 2026-11-07 17:40:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8872
Author: @SpicyMarinara
Created: 11/5/2026
Status: ✅ Merged
Merged: 11/5/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/gpt-image-26-foundation


📝 Commits (4)

  • fd7d6b7 feat(images): GPT Image 2.6 and animated GIF output (foundation)
  • 3eeb28f fix(images): GPT Image 2.6 foundation review fixes
  • 502f399 Merge remote-tracking branch 'origin/staging' into feat/gpt-image-26-foundation
  • 378abb8 docs(images): say that Regenerate forwards a GIF in the feature that first saves one

📊 Changes

17 files changed (+1128 additions, -101 deletions)

View changed files

📝 docs/development/optional-agent-packages.md (+33 -1)
📝 docs/media/image-providers.md (+27 -3)
➕ e2e/gpt-image-2-6.e2e.ts (+69 -0)
📝 packages/client/src/localization/locales/en.json (+21 -1)
📝 packages/server/src/routes/characters.routes.ts (+16 -2)
📝 packages/server/src/services/capability-packages/capability-module-runtime.service.ts (+2 -0)
📝 packages/server/src/services/image/image-generation.ts (+141 -62)
📝 packages/server/src/services/media/toapis-media.ts (+8 -22)
📝 packages/shared/src/constants/model-lists.ts (+73 -0)
📝 packages/shared/src/schemas/capability-package.schema.ts (+8 -1)
📝 packages/shared/src/types/capability-runtime.ts (+2 -0)
📝 packages/shared/src/types/generation-integration.ts (+12 -0)
📝 packages/shared/src/utils/chat-image-generation.ts (+29 -6)
📝 packages/shared/src/utils/openai-image.ts (+47 -1)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+2 -2)
📝 scripts/regressions/capability-runtime-host-services.regression.ts (+2 -0)
➕ scripts/regressions/gpt-image-2-6.regression.ts (+636 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.

Linked issue

Closes #8871. Part of #8870: the features that use this come as their own PRs, and the last one closes #8870.

Why this change

OpenAI's GPT Image 2.6 (Flare and Sunburst, 2026-11-04) makes animated GIFs from a prompt through the Images API. Marinara didn't recognize the 2.6 model ids, so they took the old DALL-E path. Nothing could request a GIF. This PR adds the models and one shared, guarded way to ask for a GIF. Animated expressions, Conversation GIFs, Illustrator GIFs and Otome Hearth's GIF stickers build on it.

What changed

  • Models: GPT Image 2.6 Flare and Sunburst are in the image model list. For stills they work like 2.5: custom sizes, the 2.5 pixel floor, quality up to Max, and transparent backgrounds.
  • One GIF option: ImageGenRequest.animation (frameCount, frameDurationMs). Frames are clamped to 2–12, at 20–2000 ms each in 10 ms steps, with defaults of 9 frames at 200 ms. Each frame is the smallest valid size, since OpenAI doesn't publish its total GIF pixel budget.
  • One check: imageConnectionMakesAnimatedGif, now in @marinara-engine/shared so client and server agree, and enforced once in generateImage, before any paid call:
    • Only an unprefixed gpt-image-2.6-* model on the native OpenAI backend may make GIFs.
    • Refused: ChatGPT (Codex login), OpenRouter openai/…, NanoGPT, ToAPIs, 2.5, and a request that carries a picture (OpenAI's GIF output can't animate one).
    • A fallback connection that can't animate is skipped.
    • A provider that answers with a still counts as a failed attempt; the result's bytes decide, not its label.
  • OpenAI request: a GIF is output_format: "gif" with frame_count and frame_duration_ms on /v1/images/generations only, with a loop line added to the prompt.
    • It never sends streaming, partial images or output_compression.
    • The connection's custom parameters can't override the size, format or frames.
    • Quality is sent only when it isn't "auto".
    • The final payload is logged in debug mode.
  • Saving: GIF results keep image/gif through gallery, thumbnails and avatar saves. Backgrounds and video first frames stay stills.
  • Chat image records can remember a GIF. Nothing writes one yet: the Conversation GIFs PR makes Regenerate forward it, with its own proof.
  • Agents: Capability API 1.816. animation is available to packages through images.generate. The server runtime host now reports capabilityApi, so a server package can tell an older Engine apart before paying. Older Engines refuse a package that requires 1.816.
  • Avatar generation route: accepts animation. A refusal is a 400 with code: "animation-unsupported".
  • Docs: docs/media/image-providers.md covers 2.6 and its GIF limits, and docs/development/optional-agent-packages.md covers Capability API 1.816. English UI keys for the feature PRs are added to en.json; the canonical catalog only.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Manually verify with a real OpenAI API key that a GPT Image 2.6 Flare still image generates at the expected size and quality.
  • Manually verify with a real OpenAI API key that a GIF request on 2.6 returns a playing GIF. All agent checks used fake servers, and no real GIF call has been made.
  • Manually verify that a 2.6 model on OpenRouter or ChatGPT (Codex login) refuses a GIF before spending anything.

Agent-run checks:

  • New scripts/regressions/gpt-image-2-6.regression.ts, with a fake OpenAI server, covers:

    • 2.6 stills;
    • the GIF body, clamps and per-frame size;
    • custom-parameter overrides;
    • every refusal, made before any HTTP call;
    • the fallback skip;
    • the still-answer failure;
    • the avatar route's GIF, its 400, and its debug logging.

    A mutation pass showed it fails when any guard is removed or moved.

  • node ./scripts/run-regressions.mjs with the image (30/30), gpt-image (3/3), avatar (27/27), capability-package-lifecycle, capability-runtime-host-services and chat-image filters: all pass.

  • pnpm check: passed on the branch. After merging current staging: server and client tsc --noEmit and pnpm localization:check pass.

  • e2e/gpt-image-2-6.e2e.ts: passed on desktop-chromium.

  • Independent review from four angles (contract, OpenAI bodies, save paths, tests): 7 findings, all fixed in the second commit.

  • Already broken before this branch, out of scope: e2e/gpt-image-2-5.e2e.ts looks for .mari-editor-panel, which the connection editor no longer has.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8872 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 11/5/2026 **Status:** ✅ Merged **Merged:** 11/5/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/gpt-image-26-foundation` --- ### 📝 Commits (4) - [`fd7d6b7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fd7d6b7cbbe72538ddc9f8aed952feacf634945f) feat(images): GPT Image 2.6 and animated GIF output (foundation) - [`3eeb28f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3eeb28f9cbc4258dad5095c2022d91320aa65828) fix(images): GPT Image 2.6 foundation review fixes - [`502f399`](https://github.com/Pasta-Devs/Marinara-Engine/commit/502f399b3147e4560e3689a86966a5f5ea658d23) Merge remote-tracking branch 'origin/staging' into feat/gpt-image-26-foundation - [`378abb8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/378abb8612b827edc2338c1a03466b880f19bbbd) docs(images): say that Regenerate forwards a GIF in the feature that first saves one ### 📊 Changes **17 files changed** (+1128 additions, -101 deletions) <details> <summary>View changed files</summary> 📝 `docs/development/optional-agent-packages.md` (+33 -1) 📝 `docs/media/image-providers.md` (+27 -3) ➕ `e2e/gpt-image-2-6.e2e.ts` (+69 -0) 📝 `packages/client/src/localization/locales/en.json` (+21 -1) 📝 `packages/server/src/routes/characters.routes.ts` (+16 -2) 📝 `packages/server/src/services/capability-packages/capability-module-runtime.service.ts` (+2 -0) 📝 `packages/server/src/services/image/image-generation.ts` (+141 -62) 📝 `packages/server/src/services/media/toapis-media.ts` (+8 -22) 📝 `packages/shared/src/constants/model-lists.ts` (+73 -0) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+8 -1) 📝 `packages/shared/src/types/capability-runtime.ts` (+2 -0) 📝 `packages/shared/src/types/generation-integration.ts` (+12 -0) 📝 `packages/shared/src/utils/chat-image-generation.ts` (+29 -6) 📝 `packages/shared/src/utils/openai-image.ts` (+47 -1) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+2 -2) 📝 `scripts/regressions/capability-runtime-host-services.regression.ts` (+2 -0) ➕ `scripts/regressions/gpt-image-2-6.regression.ts` (+636 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. ## Linked issue Closes #8871. Part of #8870: the features that use this come as their own PRs, and the last one closes #8870. ## Why this change OpenAI's GPT Image 2.6 (Flare and Sunburst, 2026-11-04) makes animated GIFs from a prompt through the Images API. Marinara didn't recognize the 2.6 model ids, so they took the old DALL-E path. Nothing could request a GIF. This PR adds the models and one shared, guarded way to ask for a GIF. Animated expressions, Conversation GIFs, Illustrator GIFs and Otome Hearth's GIF stickers build on it. ## What changed - **Models:** GPT Image 2.6 Flare and Sunburst are in the image model list. For stills they work like 2.5: custom sizes, the 2.5 pixel floor, quality up to Max, and transparent backgrounds. - **One GIF option:** `ImageGenRequest.animation` (`frameCount`, `frameDurationMs`). Frames are clamped to 2–12, at 20–2000 ms each in 10 ms steps, with defaults of 9 frames at 200 ms. Each frame is the smallest valid size, since OpenAI doesn't publish its total GIF pixel budget. - **One check:** `imageConnectionMakesAnimatedGif`, now in `@marinara-engine/shared` so client and server agree, and enforced once in `generateImage`, before any paid call: - Only an unprefixed `gpt-image-2.6-*` model on the native OpenAI backend may make GIFs. - Refused: ChatGPT (Codex login), OpenRouter `openai/…`, NanoGPT, ToAPIs, 2.5, and a request that carries a picture (OpenAI's GIF output can't animate one). - A fallback connection that can't animate is skipped. - A provider that answers with a still counts as a failed attempt; the result's bytes decide, not its label. - **OpenAI request:** a GIF is `output_format: "gif"` with `frame_count` and `frame_duration_ms` on `/v1/images/generations` only, with a loop line added to the prompt. - It never sends streaming, partial images or `output_compression`. - The connection's custom parameters can't override the size, format or frames. - Quality is sent only when it isn't "auto". - The final payload is logged in debug mode. - **Saving:** GIF results keep `image/gif` through gallery, thumbnails and avatar saves. Backgrounds and video first frames stay stills. - **Chat image records** can remember a GIF. Nothing writes one yet: the Conversation GIFs PR makes Regenerate forward it, with its own proof. - **Agents:** Capability API 1.816. `animation` is available to packages through `images.generate`. The server runtime host now reports `capabilityApi`, so a server package can tell an older Engine apart before paying. Older Engines refuse a package that requires 1.816. - **Avatar generation route:** accepts `animation`. A refusal is a 400 with `code: "animation-unsupported"`. - **Docs:** `docs/media/image-providers.md` covers 2.6 and its GIF limits, and `docs/development/optional-agent-packages.md` covers Capability API 1.816. English UI keys for the feature PRs are added to `en.json`; the canonical catalog only. ## Validation <!-- These are human tasks. Never tick a box for a check that was not actually performed. --> - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Manually verify with a real OpenAI API key that a GPT Image 2.6 Flare still image generates at the expected size and quality. - Manually verify with a real OpenAI API key that a GIF request on 2.6 returns a playing GIF. All agent checks used fake servers, and no real GIF call has been made. - Manually verify that a 2.6 model on OpenRouter or ChatGPT (Codex login) refuses a GIF before spending anything. Agent-run checks: - New `scripts/regressions/gpt-image-2-6.regression.ts`, with a fake OpenAI server, covers: - 2.6 stills; - the GIF body, clamps and per-frame size; - custom-parameter overrides; - every refusal, made before any HTTP call; - the fallback skip; - the still-answer failure; - the avatar route's GIF, its 400, and its debug logging. A mutation pass showed it fails when any guard is removed or moved. - `node ./scripts/run-regressions.mjs` with the `image` (30/30), `gpt-image` (3/3), `avatar` (27/27), `capability-package-lifecycle`, `capability-runtime-host-services` and `chat-image` filters: all pass. - `pnpm check`: passed on the branch. After merging current staging: server and client `tsc --noEmit` and `pnpm localization:check` pass. - `e2e/gpt-image-2-6.e2e.ts`: passed on desktop-chromium. - Independent review from four angles (contract, OpenAI bodies, save paths, tests): 7 findings, all fixed in the second commit. - Already broken before this branch, out of scope: `e2e/gpt-image-2-5.e2e.ts` looks for `.mari-editor-panel`, which the connection editor no longer has. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:40:13 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8854
No description provided.