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

# Imagine(文生图)

> POST /mj/submit/imagine —— 提交 Midjourney 文生图任务

提交一个 Midjourney 文生图任务(等价于 Discord 的 `/imagine`)。

## 请求

```bash theme={null}
curl https://openp.ai/mj/submit/imagine \
  -H "Authorization: Bearer $OPENPAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A futuristic cyberpunk city at night, neon lights, --ar 16:9 --v 6",
    "notifyHook": "https://your-server.com/mj-callback"
  }'
```

### 参数

| 字段            | 类型     |  必填 | 说明                                   |
| ------------- | ------ | :-: | ------------------------------------ |
| `prompt`      | string |  ✅  | 生成提示词,可包含 `--ar`、`--v`、`--style` 等参数 |
| `base64Array` | array  |     | 参考图 base64 数组(`/imagine` 附带垫图)       |
| `notifyHook`  | string |     | 回调 URL,任务完成时 OpenPAI 会 POST 任务结果     |
| `state`       | string |     | 自定义透传字段,会原样回传到回调                     |
| `botType`     | string |     | `MID_JOURNEY`(默认)或 `NIJI_JOURNEY`    |

## 响应

```json theme={null}
{
  "code": 1,
  "description": "Submitted",
  "result": "1737200000000000",
  "properties": {}
}
```

`result` 即任务 ID,后续用它查询进度或提交 U/V 操作。

| code | 含义                   |
| ---- | -------------------- |
| `1`  | 提交成功                 |
| `21` | 已存在相同任务(将复用)         |
| `22` | 任务进入队列等待             |
| `-1` | 提交失败,见 `description` |

## 查询任务

详见 [Fetch](/api-reference/midjourney/fetch)。

## 后续操作(U/V/Reroll)

详见 [Change](/api-reference/midjourney/change)。

## 计费

按 **任务次数 + 操作类型** 一笔固定扣费,与上游 Midjourney 订阅价格挂钩。
任务失败(无回调或上游返回错误)不扣费。
