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

# 图像生成

> 使用 AGICTO API 生成图片和创意视觉素材

图像生成适合头像、海报、商品图、插画、营销素材和产品视觉。你可以使用 OpenAI 兼容图片接口，也可以使用 Midjourney 等专用接口。

## 选择接口

| 场景                  | 推荐接口                      |
| ------------------- | ------------------------- |
| 统一 OpenAI 兼容格式      | `/v1/images/generations`  |
| 高质量创意图像             | `/v1/mj/submit/imagine`   |
| Midjourney 变体、放大、重绘 | `/v1/mj/submit/action`    |
| 查询 Midjourney 任务    | `/mj/task/{result}/fetch` |

## OpenAI 兼容图片

```bash theme={null}
curl https://api.agicto.cn/v1/images/generations \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_NAME",
    "prompt": "A clean product illustration for an API dashboard",
    "size": "1024x1024"
  }'
```

## Midjourney 图片

```bash theme={null}
curl https://api.agicto.cn/v1/mj/submit/imagine \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A futuristic API control center, clean UI, premium product render"
  }'
```

## Prompt 建议

* 写清主体、风格、用途和画幅。
* 商品图要说明背景、光线和构图。
* UI 插画要说明品牌色和使用位置。
* 需要稳定产出时保留固定模板。

<CardGroup cols={2}>
  <Card title="OpenAI 图片生成" icon="image" href="/api-reference/images/openai/generate">
    查看 OpenAI 兼容图片接口。
  </Card>

  <Card title="Midjourney Imagine" icon="wand-magic-sparkles" href="/api-reference/images/midjourney/imagine">
    查看 Midjourney 任务创建接口。
  </Card>
</CardGroup>
