[GH-ISSUE #5749] [Issue]: OpenRouter GPT Image 2 is routed through chat completions with unsupported image,text modalities #3178

Closed
opened 2026-10-21 06:00:16 +07:00 by bsakaguchi · 0 comments
Owner

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

Originally assigned to: @Gunterlie on GitHub.

Summary

OpenRouter image generation fails for GPT Image 2 with:

OpenRouter image generation failed (404):
{"error":{"message":"No endpoints found that support the requested output modalities: image, text","code":404}}

The connection is correctly configured as Image Generation → OpenRouter. Marinara routes both gpt-image-2 and the canonical openai/gpt-image-2 through /chat/completions with modalities: ["image", "text"].

OpenRouter exposes GPT Image 2 as openai/gpt-image-2 through its dedicated POST /api/v1/images endpoint, with image-only output. OpenRouter image-generation documentation
(https://openrouter.ai/docs/guides/overview/multimodal/image-generation), GPT Image 2 model page (https://openrouter.ai/openai/gpt-image-2).

Expected behavior

Marinara should:

  1. Normalize a bare gpt-image-* model ID to openai/gpt-image-* for OpenRouter connections.
  2. Route GPT Image models through /api/v1/images.
  3. Send only parameters supported by the selected Images API model.
  4. Return the generated image normally.

Actual behavior

usesOpenRouterImagesApi() currently recognizes only:

  • krea/*
  • bytedance-seed/seedream-*

GPT Image therefore falls through to the chat-completions path. openRouterModalities() defaults that request to:

["image", "text"]

No GPT Image 2 endpoint supports that output combination, resulting in the 404.

Additionally, buildOpenRouterImagesRequest() always sends resolution: "1K". GPT Image 2’s current capability record supports fields such as aspect_ratio and quality, but not resolution. OpenRouter Image Models API
(https://openrouter.ai/api/v1/images/models).

Steps to reproduce

  1. Install Marinara Engine using the native Node.js Windows installation.
  2. Create an Image Generation connection.
  3. Select OpenRouter and enter a valid OpenRouter API key.
  4. Set the model to either gpt-image-2 or openai/gpt-image-2.
  5. Save the connection.
  6. Attempt to generate an image.
  7. Observe the 404 error above.

Environment

  • Marinara Engine: 2.4.4, build 2.4.4+1a299369ac70
  • Also present on staging commit 479dcf7788
  • Install type: Native Node.js/source installation
  • OS: Windows 11 Home 10.0.22000
  • Browser/app shell: Local web UI

Apply provider-specific normalization without changing the shared bare OpenAI model IDs used by direct OpenAI connections:

function normalizeOpenRouterImagesApiModel(model?: string): string | undefined {
const trimmed = model?.trim();
if (!trimmed) return undefined;
return /^gpt-image-/i.test(trimmed)
? openai/${trimmed.toLowerCase()}
: trimmed;
}

export function usesOpenRouterImagesApi(model?: string): boolean {
const lower = normalizeOpenRouterImagesApiModel(model)?.toLowerCase() ?? "";
return (
lower.startsWith("krea/") ||
lower.startsWith("bytedance-seed/seedream-") ||
lower.startsWith("openai/gpt-image-")
);
}

When building the Images API request:

const model =
normalizeOpenRouterImagesApiModel(request.model) ??
"krea/krea-2-medium";

const body: Record<string, unknown> = {
model,
prompt,
};

if (!model.toLowerCase().startsWith("openai/gpt-image-")) {
body.resolution = "1K";
}

Longer term, model routing could use /api/v1/images/models capability metadata instead of maintaining provider-prefix allowlists.

Suggested regression coverage

  • gpt-image-2 selects the Images API.
  • openai/gpt-image-2 selects the Images API.
  • A bare GPT Image model is normalized to the canonical OpenRouter slug.
  • GPT Image requests omit resolution.
  • Krea and Seedream retain their existing Images API behavior.
  • Gemini image models retain their existing chat-completions behavior.
  • Manually verify a GPT Image 2 generation using OpenRouter.

Additional context

The API key is valid and the OpenRouter model catalog loads successfully. This is a request-routing issue rather than an authentication failure.

Originally created by @CDitfort on GitHub (Sep 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5749 Originally assigned to: @Gunterlie on GitHub. ## Summary OpenRouter image generation fails for GPT Image 2 with: OpenRouter image generation failed (404): {"error":{"message":"No endpoints found that support the requested output modalities: image, text","code":404}} The connection is correctly configured as Image Generation → OpenRouter. Marinara routes both gpt-image-2 and the canonical openai/gpt-image-2 through /chat/completions with modalities: ["image", "text"]. OpenRouter exposes GPT Image 2 as openai/gpt-image-2 through its dedicated POST /api/v1/images endpoint, with image-only output. OpenRouter image-generation documentation (https://openrouter.ai/docs/guides/overview/multimodal/image-generation), GPT Image 2 model page (https://openrouter.ai/openai/gpt-image-2). ## Expected behavior Marinara should: 1. Normalize a bare gpt-image-* model ID to openai/gpt-image-* for OpenRouter connections. 2. Route GPT Image models through /api/v1/images. 3. Send only parameters supported by the selected Images API model. 4. Return the generated image normally. ## Actual behavior usesOpenRouterImagesApi() currently recognizes only: - krea/* - bytedance-seed/seedream-* GPT Image therefore falls through to the chat-completions path. openRouterModalities() defaults that request to: ["image", "text"] No GPT Image 2 endpoint supports that output combination, resulting in the 404. Additionally, buildOpenRouterImagesRequest() always sends resolution: "1K". GPT Image 2’s current capability record supports fields such as aspect_ratio and quality, but not resolution. OpenRouter Image Models API (https://openrouter.ai/api/v1/images/models). ## Steps to reproduce 1. Install Marinara Engine using the native Node.js Windows installation. 2. Create an Image Generation connection. 3. Select OpenRouter and enter a valid OpenRouter API key. 4. Set the model to either gpt-image-2 or openai/gpt-image-2. 5. Save the connection. 6. Attempt to generate an image. 7. Observe the 404 error above. ## Environment - Marinara Engine: 2.4.4, build 2.4.4+1a299369ac70 - Also present on staging commit 479dcf77886d - Install type: Native Node.js/source installation - OS: Windows 11 Home 10.0.22000 - Browser/app shell: Local web UI ## Recommended fix Apply provider-specific normalization without changing the shared bare OpenAI model IDs used by direct OpenAI connections: function normalizeOpenRouterImagesApiModel(model?: string): string | undefined { const trimmed = model?.trim(); if (!trimmed) return undefined; return /^gpt-image-/i.test(trimmed) ? `openai/${trimmed.toLowerCase()}` : trimmed; } export function usesOpenRouterImagesApi(model?: string): boolean { const lower = normalizeOpenRouterImagesApiModel(model)?.toLowerCase() ?? ""; return ( lower.startsWith("krea/") || lower.startsWith("bytedance-seed/seedream-") || lower.startsWith("openai/gpt-image-") ); } When building the Images API request: const model = normalizeOpenRouterImagesApiModel(request.model) ?? "krea/krea-2-medium"; const body: Record<string, unknown> = { model, prompt, }; if (!model.toLowerCase().startsWith("openai/gpt-image-")) { body.resolution = "1K"; } Longer term, model routing could use /api/v1/images/models capability metadata instead of maintaining provider-prefix allowlists. ## Suggested regression coverage - [ ] gpt-image-2 selects the Images API. - [ ] openai/gpt-image-2 selects the Images API. - [ ] A bare GPT Image model is normalized to the canonical OpenRouter slug. - [ ] GPT Image requests omit resolution. - [ ] Krea and Seedream retain their existing Images API behavior. - [ ] Gemini image models retain their existing chat-completions behavior. - [ ] Manually verify a GPT Image 2 generation using OpenRouter. ## Additional context The API key is valid and the OpenRouter model catalog loads successfully. This is a request-routing issue rather than an authentication failure.
bsakaguchi 2026-10-21 06:00:16 +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#3178
No description provided.