[GH-ISSUE #6884] [Feature]: ChatGPT - Codex OAuth as an Image Generation connection #3862

Closed
opened 2026-10-21 06:08:15 +07:00 by bsakaguchi · 9 comments
Owner

Originally created by @prisoner310 on GitHub (Sep 30, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6884

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

Marinara Engine already supports many image generation providers, but ChatGPT subscribers who already use Codex currently cannot reuse their existing codex login session for image generation inside Marinara.

This means a user may already have access to both ChatGPT/Codex models and high-quality image generation through their subscription, but still needs to configure a separate image provider or an OpenAI Platform API key and billing account for Marinara.

For roleplay workflows in particular, being able to use the existing ChatGPT/Codex subscription for both lightweight agent tasks and image generation would make it much easier to set up a capable LLM + image generation environment.

Proposed solution

Add ChatGPT / Codex Image as a dedicated Image Generation connection.

The connection would reuse the existing local ChatGPT OAuth session created by:

codex login

instead of requiring an OpenAI Platform API key or separate API billing.

I have a working prototype in a personal fork that currently supports the standard Marinara image workflows, including:

  • Text-to-image generation
  • Reference image editing
  • Selfies and Illustrations
  • Character Avatar / Character Sheet generation
  • Game / Storyboard images
  • Sprite generation with transparent backgrounds
  • Prompt Review
  • Existing queue, timeout, abort, fallback, and Gallery flows

The prototype currently uses the Codex GPT Image model exposed through the ChatGPT OAuth image endpoint.

I also verified with a real ChatGPT account that the current OAuth image endpoint accepts at least 16 distinct reference images in a single edit request. Marinara workflows can still retain their own smaller reference limits where appropriate.

The implementation is intentionally kept separate from the existing OpenAI Platform image provider and from the normal ChatGPT text connection, so the different authentication and billing paths remain explicit.

Alternatives considered

OpenAI Platform Image API

Marinara already supports OpenAI image generation through the Platform API.

That works well, but it requires a separate API key and usage-based Platform billing. It does not reuse an existing ChatGPT/Codex subscription.

Calling Codex as an external process

Another possibility would be launching Codex itself for every image request.

The prototype does not do this. It reuses Marinara's existing Codex ChatGPT authentication handling and talks to the image endpoint directly, which avoids spawning a separate Codex process for each generation.

Additional context

Issue #6453 previously included a broader prototype feature named E22 — ChatGPT image generation and provider-aware references. That umbrella issue was closed after the discussion moved toward reviewing features individually, with an invitation to open focused Issues/PRs for each feature.

I could not find a dedicated follow-up Issue for ChatGPT image generation, so I am opening this as a focused proposal rather than treating #6453 as an accepted or rejected design.

My prototype takes a somewhat narrower approach than the E22 description: it exposes ChatGPT/Codex image generation as a dedicated Image Generation connection and reuses Marinara's existing Codex OAuth helper, while leaving the existing ChatGPT text connection and OpenAI Platform image provider separate.

Relevant prototype links:

I have tested the prototype on Windows with a real ChatGPT/Codex account. It includes regression coverage for the provider adapter and related Marinara image workflows, and I have manually tested generation, reference editing, transparent sprites, Character Sheets, aspect-ratio handling, and multi-reference requests.

One important caveat is that the ChatGPT/Codex image route is tied to current Codex/ChatGPT backend behavior rather than the normal public OpenAI Platform Image API. I therefore wanted to open a Feature Request before preparing an upstream PR, to check whether this integration approach is something the project would be interested in supporting and maintaining.

If this direction is of interest, I'm happy for the prototype to be reused or adapted as part of an upstream implementation, and I can help with cleanup, testing, or further details as useful. I'm not attached to the exact implementation in my fork.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @prisoner310 on GitHub (Sep 30, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6884 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? Marinara Engine already supports many image generation providers, but ChatGPT subscribers who already use Codex currently cannot reuse their existing `codex login` session for image generation inside Marinara. This means a user may already have access to both ChatGPT/Codex models and high-quality image generation through their subscription, but still needs to configure a separate image provider or an OpenAI Platform API key and billing account for Marinara. For roleplay workflows in particular, being able to use the existing ChatGPT/Codex subscription for both lightweight agent tasks and image generation would make it much easier to set up a capable LLM + image generation environment. ## Proposed solution Add **ChatGPT / Codex Image** as a dedicated Image Generation connection. The connection would reuse the existing local ChatGPT OAuth session created by: ```text codex login ``` instead of requiring an OpenAI Platform API key or separate API billing. I have a working prototype in a personal fork that currently supports the standard Marinara image workflows, including: - Text-to-image generation - Reference image editing - Selfies and Illustrations - Character Avatar / Character Sheet generation - Game / Storyboard images - Sprite generation with transparent backgrounds - Prompt Review - Existing queue, timeout, abort, fallback, and Gallery flows The prototype currently uses the Codex GPT Image model exposed through the ChatGPT OAuth image endpoint. I also verified with a real ChatGPT account that the current OAuth image endpoint accepts at least 16 distinct reference images in a single edit request. Marinara workflows can still retain their own smaller reference limits where appropriate. The implementation is intentionally kept separate from the existing OpenAI Platform image provider and from the normal ChatGPT text connection, so the different authentication and billing paths remain explicit. ## Alternatives considered ### OpenAI Platform Image API Marinara already supports OpenAI image generation through the Platform API. That works well, but it requires a separate API key and usage-based Platform billing. It does not reuse an existing ChatGPT/Codex subscription. ### Calling Codex as an external process Another possibility would be launching Codex itself for every image request. The prototype does not do this. It reuses Marinara's existing Codex ChatGPT authentication handling and talks to the image endpoint directly, which avoids spawning a separate Codex process for each generation. ## Additional context Issue #6453 previously included a broader prototype feature named **E22 — ChatGPT image generation and provider-aware references**. That umbrella issue was closed after the discussion moved toward reviewing features individually, with an invitation to open focused Issues/PRs for each feature. I could not find a dedicated follow-up Issue for ChatGPT image generation, so I am opening this as a focused proposal rather than treating #6453 as an accepted or rejected design. My prototype takes a somewhat narrower approach than the E22 description: it exposes ChatGPT/Codex image generation as a dedicated Image Generation connection and reuses Marinara's existing Codex OAuth helper, while leaving the existing ChatGPT text connection and OpenAI Platform image provider separate. Relevant prototype links: - [Prototype branch (`personal/codex-image`)](https://github.com/prisoner310/Marinara-Engine-Personal-Fork/tree/personal/codex-image) - [Phase 2A.12 implementation commit — verified 16-reference support](https://github.com/prisoner310/Marinara-Engine-Personal-Fork/commit/e4ad2ede479b21a87e72374f7496312a72b46a64) - [Image provider documentation from the prototype](https://github.com/prisoner310/Marinara-Engine-Personal-Fork/blob/personal/codex-image/docs/media/image-providers.md#chatgpt--codex-image) I have tested the prototype on Windows with a real ChatGPT/Codex account. It includes regression coverage for the provider adapter and related Marinara image workflows, and I have manually tested generation, reference editing, transparent sprites, Character Sheets, aspect-ratio handling, and multi-reference requests. One important caveat is that the ChatGPT/Codex image route is tied to current Codex/ChatGPT backend behavior rather than the normal public OpenAI Platform Image API. I therefore wanted to open a Feature Request before preparing an upstream PR, to check whether this integration approach is something the project would be interested in supporting and maintaining. If this direction is of interest, I'm happy for the prototype to be reused or adapted as part of an upstream implementation, and I can help with cleanup, testing, or further details as useful. I'm not attached to the exact implementation in my fork. ## Template check - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 30, 2026):

Wait, that is not true. I've been using my Codex sub for image generation this entire time, lmao. You just create an API key like you normally would, and it automatically detects that you have an active Codex connected to your account and doesn't charge you for generations.

<!-- gh-comment-id:5910061497 --> @SpicyMarinara commented on GitHub (Sep 30, 2026): Wait, that is not true. I've been using my Codex sub for image generation this entire time, lmao. You just create an API key like you normally would, and it automatically detects that you have an active Codex connected to your account and doesn't charge you for generations.
Author
Owner

@prisoner310 commented on GitHub (Sep 30, 2026):

Thanks for the reply! I tested this just to make sure I wasn't misunderstanding the current behavior.

I created a normal OpenAI API key on the same account without adding any Platform credits, configured it as the regular OpenAI image connection in Marinara, and ran Test Image.

The request failed with:

OpenAI image generation failed (429):
{
  "error": {
    "message": "You have no credits remaining. Add credits to continue using the API at https://platform.openai.com/settings/organization/billing/.",
    "type": "insufficient_quota",
    "param": null,
    "code": "credit_balance_exhausted"
  }
}

So at least on my account, the normal API-key image route does not appear to use my ChatGPT/Codex subscription allowance automatically.

The codex login OAuth route in my prototype does work without Platform credits, which is why I treated the two paths separately.

If your API-key connection is genuinely using the subscription allowance without Platform credits, I'd be very interested in knowing which provider/model/connection setup you're using, because I may be missing a different supported path.

<!-- gh-comment-id:5912682703 --> @prisoner310 commented on GitHub (Sep 30, 2026): Thanks for the reply! I tested this just to make sure I wasn't misunderstanding the current behavior. I created a normal OpenAI API key on the same account without adding any Platform credits, configured it as the regular OpenAI image connection in Marinara, and ran **Test Image**. The request failed with: ```text OpenAI image generation failed (429): { "error": { "message": "You have no credits remaining. Add credits to continue using the API at https://platform.openai.com/settings/organization/billing/.", "type": "insufficient_quota", "param": null, "code": "credit_balance_exhausted" } } ``` So at least on my account, the normal API-key image route does not appear to use my ChatGPT/Codex subscription allowance automatically. The `codex login` OAuth route in my prototype does work without Platform credits, which is why I treated the two paths separately. If your API-key connection is genuinely using the subscription allowance without Platform credits, I'd be very interested in knowing which provider/model/connection setup you're using, because I may be missing a different supported path.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 30, 2026):

My Connection setup is:

Provider -> Image Generation
API Key -> API Key from https://platform.openai.com/home
Base URL -> https://api.openai.com/v1
Service -> OpenAI (DALL-E)
Model -> gpt-image-2.5-sunburst
Image quality -> Max

And that's it. I only pay for occasional Astra usage via API, but not for any generated images.

<!-- gh-comment-id:5913300788 --> @SpicyMarinara commented on GitHub (Sep 30, 2026): My Connection setup is: ``` Provider -> Image Generation API Key -> API Key from https://platform.openai.com/home Base URL -> https://api.openai.com/v1 Service -> OpenAI (DALL-E) Model -> gpt-image-2.5-sunburst Image quality -> Max ``` And that's it. I only pay for occasional Astra usage via API, but not for any generated images.
Author
Owner

@prisoner310 commented on GitHub (Sep 30, 2026):

Thanks again for sharing the exact setup!

I tried the same configuration on my side. Test Connection succeeds, Marinara can also load the model list normally, so the API key itself appears to be valid.

However, when I run Test Image, the actual generation request reaches OpenAI and then fails with:

429
type: insufficient_quota
code: credit_balance_exhausted

So in my case, authentication and model discovery work, but image generation is still being checked against the Platform API credit balance rather than my ChatGPT/Codex subscription.

There may simply be some difference between our OpenAI account or billing setups. I haven't used the Platform API before and currently have no API credits on the account.

No need to spend time digging into it on my behalf — I mainly wanted to report what I'm seeing, since it seems the behavior isn't identical across our accounts.

<!-- gh-comment-id:5915265911 --> @prisoner310 commented on GitHub (Sep 30, 2026): Thanks again for sharing the exact setup! I tried the same configuration on my side. **Test Connection succeeds**, Marinara can also load the model list normally, so the API key itself appears to be valid. However, when I run **Test Image**, the actual generation request reaches OpenAI and then fails with: ```text 429 type: insufficient_quota code: credit_balance_exhausted ``` So in my case, authentication and model discovery work, but image generation is still being checked against the Platform API credit balance rather than my ChatGPT/Codex subscription. There may simply be some difference between our OpenAI account or billing setups. I haven't used the Platform API before and currently have no API credits on the account. No need to spend time digging into it on my behalf — I mainly wanted to report what I'm seeing, since it seems the behavior isn't identical across our accounts.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 30, 2026):

Hm, I'll look into it.

<!-- gh-comment-id:5919001839 --> @SpicyMarinara commented on GitHub (Sep 30, 2026): Hm, I'll look into it.
Author
Owner

@SpicyMarinara commented on GitHub (Oct 2, 2026):

This is now on staging (#6952) as the ChatGPT (Codex login) image service, built from your prototype with the same endpoint and request shape. Thank you for the thorough testing and write-up, @prisoner310! It'll reach main with the next release.

<!-- gh-comment-id:5947073212 --> @SpicyMarinara commented on GitHub (Oct 2, 2026): This is now on `staging` (#6952) as the **ChatGPT (Codex login)** image service, built from your prototype with the same endpoint and request shape. Thank you for the thorough testing and write-up, @prisoner310! It'll reach `main` with the next release.
Author
Owner

@prisoner310 commented on GitHub (Oct 2, 2026):

Thank you so much for taking the time to look into this and for adapting it for upstream!

I'm really glad the prototype and testing were useful. I appreciate you turning it into something that fits Marinara properly, and I'm looking forward to using the official version in the next release.

Thanks again!

<!-- gh-comment-id:5952439918 --> @prisoner310 commented on GitHub (Oct 2, 2026): Thank you so much for taking the time to look into this and for adapting it for upstream! I'm really glad the prototype and testing were useful. I appreciate you turning it into something that fits Marinara properly, and I'm looking forward to using the official version in the next release. Thanks again!
Author
Owner

@prisoner310 commented on GitHub (Oct 3, 2026):

One small thing I noticed while testing the staging implementation:

When the ChatGPT / Codex Image connection has gpt-image-2 explicitly set as the model, Transparent sprite background takes Marinara's chroma-key fallback path instead of requesting native transparency.

Interestingly, leaving the model field blank avoids that behavior and native transparency works correctly. Image generation still succeeds, since the ChatGPT/Codex image path falls back to its default model internally.

I also tested arbitrary model strings such as chatgpt-image-latest, and the image request still succeeds, so the model field does not appear to control the actual backend model in the way a normal provider model selector would.

This may be related to the behavior reported on the Codex side here:

https://github.com/openai/codex/issues/28723

That issue reports the OAuth-backed Codex image path normalizing explicit image settings to gpt-image-2-codex / auto.

So this doesn't seem urgent from a usability standpoint — leaving the model field blank appears to be a simple workaround — but I wanted to document the behavior I found while testing staging.

<!-- gh-comment-id:5968662609 --> @prisoner310 commented on GitHub (Oct 3, 2026): One small thing I noticed while testing the staging implementation: When the ChatGPT / Codex Image connection has `gpt-image-2` explicitly set as the model, **Transparent sprite background** takes Marinara's chroma-key fallback path instead of requesting native transparency. Interestingly, leaving the model field blank avoids that behavior and native transparency works correctly. Image generation still succeeds, since the ChatGPT/Codex image path falls back to its default model internally. I also tested arbitrary model strings such as `chatgpt-image-latest`, and the image request still succeeds, so the model field does not appear to control the actual backend model in the way a normal provider model selector would. This may be related to the behavior reported on the Codex side here: https://github.com/openai/codex/issues/28723 That issue reports the OAuth-backed Codex image path normalizing explicit image settings to `gpt-image-2-codex` / `auto`. So this doesn't seem urgent from a usability standpoint — leaving the model field blank appears to be a simple workaround — but I wanted to document the behavior I found while testing staging.
Author
Owner

@SpicyMarinara commented on GitHub (Oct 4, 2026):

Native transparent sprite background is a hoax, I have no idea why they claim to support it when all the images returned that way don't actually have transparent backgrounds. That's why we're generating them on bright backgrounds that our cleanup automatically removes later on.

<!-- gh-comment-id:5977714425 --> @SpicyMarinara commented on GitHub (Oct 4, 2026): Native transparent sprite background is a hoax, I have no idea why they claim to support it when all the images returned that way don't actually have transparent backgrounds. That's why we're generating them on bright backgrounds that our cleanup automatically removes later on.
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#3862
No description provided.