Skip to content

[Feature] OpenRouter Image Generation #1640

@Magolor

Description

@Magolor

What Would You Like to See with the Gateway?

Support Image Generation via the OpenRouter endpoint.

Context for your Request

OpenRouter supports image-generation-capable models such as openai/gpt-5-image-mini. Portkey Gateway supports OpenRouter as a provider, and Portkey documentation indicates OpenAI-compatible image generation support. However, when sending an OpenAI-compatible chat completion request for OpenRouter image generation through Portkey Gateway, the request succeeds but the returned message has no usable image payload. Please confirm whether OpenRouter image generation through Portkey Gateway is intended to be supported. If it is supported, the gateway appears to drop or fail to map the image output payload for models like openai/gpt-5-image-mini.

x-portkey-api-key: <PORTKEY_API_KEY>
x-portkey-provider: openrouter
x-portkey-strict-open-ai-compliance: false
Authorization: Bearer <OPENROUTER_API_KEY>

Request shape:

client.chat.completions.create(
    model="openai/gpt-5-image-mini",
    messages=[{"role": "user", "content": [{"type": "text", "text": "Simple black letters HB on a white background."}]}],
    modalities=["image", "text"],
    stream=False,
    max_tokens=1024,
)

The request returns successfully, but the image payload is empty. The reproducer reports:

{
  "provider": "openrouter",
  "model": "openai/gpt-5-image-mini",
  "image_count": 0,
  "empty_image_payload": true
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions