> ## 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.

# 聊天创作图

> 基于 2026-03-23 Crazyrouter 生产环境验证的 Chat 创图现状与稳定替代方案

> 更新日期：2026-06-06

# 聊天创作图

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

截至 2026 年 3 月 23 日，Crazyrouter 生产环境对 Chat 创图的实测结果如下：

* `gpt-4o` 可正常返回 `200`，但回复里的 `message.content` 是普通字符串，不是标准的图片多段内容
* `gpt-image-2` 也可正常返回 `200`，但当前返回形态仍然是文本或 Markdown，其中包含参数块、任务 ID 和预览链接，而不是标准 OpenAI `image_url` 多部分结构
* 如果你需要稳定、机器可解析的图片结果，当前应优先使用 [`/v1/images/generations`](/images/gpt-image) + `gpt-image-2`；如需 Grok 图片模型，请看 [`Grok 图片模型`](/images/grok)
* 如果你需要 Gemini / Nano Banana 图片生成、参考图编辑或多图融合，请使用统一 Images API，并优先看 [`Nano Banana 2`](/images/nano-banana-2) 或 [`Nano Banana Pro`](/images/nano-banana-pro)

<Warning>
  不要再把 Crazyrouter 当前的 Chat 创图响应当成标准 OpenAI `content: [{type: "image_url", ...}]` 结构来解析。
</Warning>

***

## 当前可复现的 Chat 行为

下面的请求在生产环境命中了 `gpt-image-2`，返回 `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
  }'
```

生产环境实际观测到的 `message.content` 是一个字符串，内容类似：

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

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

这说明当前 Chat 路径更像“文本包装后的图片任务结果”，而不是标准化的多段图片消息对象。

***

## 稳定路径：Images API

如果你的目标是程序化取图，当前更稳定的方式是：

```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"
  }'
```

当前 `gpt-image-2` 稳定路径使用主承接线路 `https://api.crazyrouter.com/v1`。响应通常返回：

* `data[0].url`

`gpt-image-2` 不支持 `response_format`，不要传 `response_format="url"` 或 `response_format="b64_json"`。如需控制图片文件格式，请使用 `output_format="png"`、`"jpeg"` 或 `"webp"`。

也就是说，当前稳定的自动化消费方式仍然是 Images API，而不是 Chat Completions 的图片兼容路径。

<Note>
  如果你只是手工试用，`gpt-image-2` 的 Chat 路径仍然可以观察结果；如果你要做前后端自动化、结果存储或图片后处理，请直接用 [`GPT Image 文档`](/images/gpt-image)、[`Grok 图片模型`](/images/grok) 或 [`Nano Banana 2`](/images/nano-banana-2)。图片类长耗时请求优先使用 `https://api.crazyrouter.com/v1`。
</Note>
