[PR #6952] [MERGED] feat(image): add ChatGPT (Codex login) image generation #7399

Closed
opened 2026-10-23 04:19:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6952
Author: @SpicyMarinara
Created: 10/1/2026
Status: ✅ Merged
Merged: 10/2/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/codex-image-connection


📝 Commits (5)

  • 8032686 feat(image): add ChatGPT (Codex login) image generation service
  • f77fde9 docs(image): note that not every cloud image service needs an API key
  • a560ac8 Merge remote-tracking branch 'origin/staging' into feat/codex-image-connection
  • ac13d56 fix(connections): forget the image service when the provider changes
  • 5059c97 Merge remote-tracking branch 'origin/staging' into feat/codex-image-connection

📊 Changes

9 files changed (+311 additions, -9 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 docs/media/image-providers.md (+11 -1)
📝 packages/client/src/components/connections/ConnectionEditor.tsx (+27 -5)
📝 packages/client/src/localization/locales/en.json (+4 -0)
📝 packages/server/src/routes/connections.routes.ts (+14 -0)
📝 packages/server/src/services/image/image-generation.ts (+91 -3)
📝 packages/server/src/services/mari-db/mari-images.service.ts (+4 -0)
📝 packages/shared/src/constants/model-lists.ts (+13 -0)
➕ scripts/regressions/codex-chatgpt-image.regression.ts (+143 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #6884

Why this change

People who pay for ChatGPT and already use Codex still needed OpenAI Platform credits to make images in Marinara. @prisoner310 built a working prototype that reuses the codex login session and offered it for reuse. This is a smaller version of it that fits the existing image code.

What changed

  • New service: Image Generation connections get a ChatGPT (Codex login) service. It reuses the ChatGPT login helper the text connection already has (openai-chatgpt-auth.ts), so there's no second login implementation.
  • Endpoint: it calls the same ChatGPT image endpoint Codex's own image tool uses: /images/generations, or /images/edits when there are reference images, with up to 16 references like the OpenAI provider.
  • Works everywhere: it goes through the normal image dispatch, so selfies, illustrations, avatars, sprites, the gallery, fallbacks, the queue, timeouts and stopping a generation all work without special cases.
  • Token safety:
    • The login token only goes to https://chatgpt.com, which is checked on every redirect.
    • It stays on the server and isn't logged.
    • The connection's API key and base URL aren't used.
  • Test Connection only checks that the login exists, so it doesn't spend image allowance. Fetch Models returns gpt-image-2.
  • Editor: picking the service hides API Key and Base URL and shows a one-line hint instead.
  • Aspect ratio: the endpoint doesn't reliably keep the requested size, so the shape is also stated in the prompt. That's from the prototype and marked as a workaround in the code.
  • Docs, changelog, credit: docs (docs/media/image-providers.md), a CHANGELOG entry, and credit to prisoner310 as co-author.
  • Not taken from the prototype:
    • Prompt Review additions and per-feature reference limits
    • sprite and background-remover special cases
    • extra diagnostics and the model lock
      These can come later if they turn out to be needed.

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

Not tested against a real ChatGPT account. Everything below used a throwaway Codex login and a fake server. Whether the endpoint accepts these sizes, honors the aspect hint, takes 16 references and returns transparency rests on prisoner310's real-account testing and Codex's own source.

What I ran (not a replacement for the checklist):

  • Checks: pnpm check, pnpm version:check and pnpm smoke:ui (7/7) pass.
  • New regression codex-chatgpt-image.regression.ts covers:
    • request URL, headers and body
    • origin pinning
    • edits with 16 references and transparency
    • empty, 429 and 401 responses
    • missing or expired logins
    • debug logs that show the prompt but never the token or image data
    • It fails when the new service isn't wired in.
  • Existing tests: 42 image, gallery, sprite, avatar and connection regressions pass, plus the existing fal, GPT Image 2.5, custom-parameters and RunPod browser tests.
  • Local CodeRabbit: 1 finding, fixed. The docs overview said every cloud service needs an API key, which isn't true for this one.

To check by hand (needs a ChatGPT plan and codex login on the server machine):

  • Create an Image Generation connection with ChatGPT (Codex login), press Test Connection, then Test Image.
  • Generate a selfie, a landscape background and a sprite, and check the shapes and the transparent sprite.
  • Generate with a reference image.
  • Log out of Codex and check the error tells you to run codex login.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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)

docs/media/image-providers.md gains a ChatGPT (Codex login) section. The translated packs will be updated in one docs-i18n PR together with the other docs from this sweep.

UI evidence (if applicable)

A temporary Playwright check (since deleted) passed on desktop Chromium, mobile Chromium and mobile WebKit. It covered the hidden fields, the hint, the login found and missing messages, and switching back to another service.

Summary by CodeRabbit

  • New Features
    • Added ChatGPT image generation using an existing Codex CLI login, with no API key required.
    • Supports image generation and editing with up to 16 reference images.
    • Added connection testing to check login status; use Test Image to verify image generation.
  • Documentation
    • Updated the image-provider guide with setup details, supported workflows, and testing guidance.

🔄 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/6952 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/1/2026 **Status:** ✅ Merged **Merged:** 10/2/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/codex-image-connection` --- ### 📝 Commits (5) - [`8032686`](https://github.com/Pasta-Devs/Marinara-Engine/commit/80326860e8c674d7bf5d4f764686e24f9347589a) feat(image): add ChatGPT (Codex login) image generation service - [`f77fde9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f77fde9898bbba9a998b0df11455d83d154b02a0) docs(image): note that not every cloud image service needs an API key - [`a560ac8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a560ac8fbbda76195f993c317483daeeef685b1e) Merge remote-tracking branch 'origin/staging' into feat/codex-image-connection - [`ac13d56`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ac13d56896f059e9d544802147d3c1d8c56e0a37) fix(connections): forget the image service when the provider changes - [`5059c97`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5059c97358193d90c557f6744ca1e06135f09009) Merge remote-tracking branch 'origin/staging' into feat/codex-image-connection ### 📊 Changes **9 files changed** (+311 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `docs/media/image-providers.md` (+11 -1) 📝 `packages/client/src/components/connections/ConnectionEditor.tsx` (+27 -5) 📝 `packages/client/src/localization/locales/en.json` (+4 -0) 📝 `packages/server/src/routes/connections.routes.ts` (+14 -0) 📝 `packages/server/src/services/image/image-generation.ts` (+91 -3) 📝 `packages/server/src/services/mari-db/mari-images.service.ts` (+4 -0) 📝 `packages/shared/src/constants/model-lists.ts` (+13 -0) ➕ `scripts/regressions/codex-chatgpt-image.regression.ts` (+143 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #6884 ## Why this change People who pay for ChatGPT and already use Codex still needed OpenAI Platform credits to make images in Marinara. @prisoner310 built a working prototype that reuses the `codex login` session and offered it for reuse. This is a smaller version of it that fits the existing image code. ## What changed - **New service:** Image Generation connections get a **ChatGPT (Codex login)** service. It reuses the ChatGPT login helper the text connection already has (`openai-chatgpt-auth.ts`), so there's no second login implementation. - **Endpoint:** it calls the same ChatGPT image endpoint Codex's own image tool uses: `/images/generations`, or `/images/edits` when there are reference images, with up to 16 references like the OpenAI provider. - **Works everywhere:** it goes through the normal image dispatch, so selfies, illustrations, avatars, sprites, the gallery, fallbacks, the queue, timeouts and stopping a generation all work without special cases. - **Token safety:** - The login token only goes to `https://chatgpt.com`, which is checked on every redirect. - It stays on the server and isn't logged. - The connection's API key and base URL aren't used. - **Test Connection** only checks that the login exists, so it doesn't spend image allowance. **Fetch Models** returns `gpt-image-2`. - **Editor:** picking the service hides API Key and Base URL and shows a one-line hint instead. - **Aspect ratio:** the endpoint doesn't reliably keep the requested size, so the shape is also stated in the prompt. That's from the prototype and marked as a workaround in the code. - **Docs, changelog, credit:** docs (`docs/media/image-providers.md`), a CHANGELOG entry, and credit to prisoner310 as co-author. - **Not taken from the prototype:** - Prompt Review additions and per-feature reference limits - sprite and background-remover special cases - extra diagnostics and the model lock These can come later if they turn out to be needed. ## 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 **Not tested against a real ChatGPT account.** Everything below used a throwaway Codex login and a fake server. Whether the endpoint accepts these sizes, honors the aspect hint, takes 16 references and returns transparency rests on prisoner310's real-account testing and Codex's own source. What I ran (not a replacement for the checklist): - **Checks:** `pnpm check`, `pnpm version:check` and `pnpm smoke:ui` (7/7) pass. - **New regression** `codex-chatgpt-image.regression.ts` covers: - request URL, headers and body - origin pinning - edits with 16 references and transparency - empty, 429 and 401 responses - missing or expired logins - debug logs that show the prompt but never the token or image data - It fails when the new service isn't wired in. - **Existing tests:** 42 image, gallery, sprite, avatar and connection regressions pass, plus the existing fal, GPT Image 2.5, custom-parameters and RunPod browser tests. - **Local CodeRabbit:** 1 finding, fixed. The docs overview said every cloud service needs an API key, which isn't true for this one. To check by hand (needs a ChatGPT plan and `codex login` on the server machine): - Create an Image Generation connection with **ChatGPT (Codex login)**, press **Test Connection**, then **Test Image**. - Generate a selfie, a landscape background and a sprite, and check the shapes and the transparent sprite. - Generate with a reference image. - Log out of Codex and check the error tells you to run `codex login`. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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) `docs/media/image-providers.md` gains a ChatGPT (Codex login) section. The translated packs will be updated in one `docs-i18n` PR together with the other docs from this sweep. ## UI evidence (if applicable) A temporary Playwright check (since deleted) passed on desktop Chromium, mobile Chromium and mobile WebKit. It covered the hidden fields, the hint, the login found and missing messages, and switching back to another service. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added ChatGPT image generation using an existing Codex CLI login, with no API key required. * Supports image generation and editing with up to 16 reference images. * Added connection testing to check login status; use Test Image to verify image generation. * **Documentation** * Updated the image-provider guide with setup details, supported workflows, and testing guidance. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:19:24 +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#7399
No description provided.