> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crazyrouter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat Image Generation

> Chat-image behavior and stable alternatives verified against Crazyrouter production on 2026-03-23

> Дата обновления: 2026-06-06

# Chat Image Generation

```
POST /v1/chat/completions
```

As of March 23, 2026, production checks against Crazyrouter showed:

* `gpt-4o` returns `200`, but `message.content` is plain text, not standard multipart image content
* `gpt-image-2` also returns `200`, but the current response shape is still text or Markdown containing a parameter block, an ID, and a preview link, not the standard OpenAI `image_url` multipart structure
* If you need stable, machine-readable image output, the current recommended path is [`/v1/images/generations`](/ru/images/gpt-image) with `gpt-image-2`; for Grok image models, see [`Grok Image Models`](/ru/images/grok)
* If you need reference-image editing or multi-image input, do not keep treating the Nano Banana family as a stable `/v1/images/generations` entry point. Start with the native Gemini path documented on [`Nano Banana 2`](/ru/images/nano-banana-2); [`Nano Banana`](/ru/images/nano-banana) is currently controlled-testing only

<Warning>
  Do not parse the current Crazyrouter chat-image response as if it were standard OpenAI `content: [{type: "image_url", ...}]`.
</Warning>

***

## Currently Reproducible Chat Behavior

The following request hit `gpt-image-2` in production and returned `200`:

```bash theme={null}
curl https://api.crazyrouter.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-image-2",
    "messages": [
      {
        "role": "user",
        "content": "Generate an image of a red square on a white background."
      }
    ],
    "max_tokens": 512
  }'
```

The observed `message.content` was a string shaped roughly like:

```text theme={null}
{
  "prompt": "Generate an image of a red square on a white background.",
  "ratio": "1:1",
  "n": 1
}

ID: ...
Data Preview: https://...
```

That means the current chat path behaves more like text-wrapped image-task output than a standardized multipart image message object.

***

## Stable Path: Images API

If you need programmatic image retrieval, use:

```bash theme={null}
curl -X POST https://api.crazyrouter.com/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "A red square on a white background",
    "size": "1024x1024",
    "quality": "low",
    "output_format": "png"
  }'
```

The current `gpt-image-2` stable path uses the primary image route `https://api.crazyrouter.com/v1`. Responses usually include:

* `data[0].url`

`gpt-image-2` does not support `response_format`; do not send `response_format="url"` or `response_format="b64_json"`. To choose the image file format, use `output_format="png"`, `"jpeg"`, or `"webp"`.

So the stable automation path is still the Images API, not the chat-image compatibility path.

<Note>
  If you are only testing manually, the `gpt-image-2` chat path is still useful for observation. If you need backend automation, storage, or post-processing, use the [`GPT Image docs`](/ru/images/gpt-image) or [`Grok Image Models`](/ru/images/grok). If your workload depends on reference-image editing or multi-image input, start with the native Gemini route documented on [`Nano Banana 2`](/ru/images/nano-banana-2). Do not keep treating Nano Banana-family `/v1/images/generations` as the stable recommendation.
</Note>
