OpenRouter image-only generators should not request text output
Summary
OpenRouter-backed image generators can fail for image-only model families such
as Flux even when GPT-image works through the same provider. The local Flux slot
used black-forest-labs/flux.2-max; the GPT slot used openai/gpt-5-image.
OpenRouter reports Flux as image-only output, while GPT-image supports both
image and text output.
Impact
- Flux/other image-only OpenRouter generators can return provider errors, seen
locally as a 404, while GPT-image continues to succeed.
- This makes the Image Generation settings look healthy because both generator
slots use OpenRouter and valid API credentials, but one request shape is not
valid for the selected model family.
Root Cause
generateViaOpenRouter() always sent:
"modalities": ["image", "text"]
That is correct for text-capable image models such as openai/gpt-5-image, but
not for image-only families such as Flux. Those should request only:
Local Patch
- Added OpenRouter model-family detection for known image-only families:
Flux/Black Forest Labs, Sourceful, Recraft, Microsoft MAI Image, Grok Imagine,
and Seedream.
- OpenRouter image-only families now send
modalities: ["image"].
- Text-capable models such as GPT-image continue to send
modalities: ["image", "text"].
- Normalized an accidentally pasted full
https://openrouter.ai/api/v1/chat/completions URL back to the API base URL
before appending /chat/completions, preventing a related doubled-path 404.
- Added
generate_image_test.ts coverage for Flux, GPT-image, and full endpoint
URL normalization.
Verification
deno fmt --check packages/psycheros/src/tools/generate-image.ts packages/psycheros/tests/generate_image_test.ts
passed.
deno test -A --no-check packages/psycheros/tests/generate_image_test.ts
passed (3 passed).
- Plain
deno test -A packages/psycheros/tests/generate_image_test.ts is still
blocked by pre-existing Windows timer type errors in unrelated modules:
src/mcp-client/mod.ts and src/scheduler/scheduler.ts.
OpenRouter image-only generators should not request text output
Summary
OpenRouter-backed image generators can fail for image-only model families such
as Flux even when GPT-image works through the same provider. The local Flux slot
used
black-forest-labs/flux.2-max; the GPT slot usedopenai/gpt-5-image.OpenRouter reports Flux as image-only output, while GPT-image supports both
image and text output.
Impact
locally as a 404, while GPT-image continues to succeed.
slots use OpenRouter and valid API credentials, but one request shape is not
valid for the selected model family.
Root Cause
generateViaOpenRouter()always sent:That is correct for text-capable image models such as
openai/gpt-5-image, butnot for image-only families such as Flux. Those should request only:
Local Patch
Flux/Black Forest Labs, Sourceful, Recraft, Microsoft MAI Image, Grok Imagine,
and Seedream.
modalities: ["image"].modalities: ["image", "text"].https://openrouter.ai/api/v1/chat/completionsURL back to the API base URLbefore appending
/chat/completions, preventing a related doubled-path 404.generate_image_test.tscoverage for Flux, GPT-image, and full endpointURL normalization.
Verification
deno fmt --check packages/psycheros/src/tools/generate-image.ts packages/psycheros/tests/generate_image_test.tspassed.
deno test -A --no-check packages/psycheros/tests/generate_image_test.tspassed (
3 passed).deno test -A packages/psycheros/tests/generate_image_test.tsis stillblocked by pre-existing Windows timer type errors in unrelated modules:
src/mcp-client/mod.tsandsrc/scheduler/scheduler.ts.