Skip to content

OpenRouter image-only generators should not request text output #11

Description

@lyrishark

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:

"modalities": ["image"]

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions