OmwAIOmwAI
API GuideAPI ReferenceProgramming Tools
Midjourney

Image Generation

Midjourney image generation (IMAGINE) endpoint

Submits a Midjourney image generation (IMAGINE) task asynchronously from a prompt. The submission is async: on success it returns a task ID (result), then you poll the Query Task Result endpoint for progress.

Billing model

This endpoint is billed under the mj_imagine model. Configure a group price for it on the channel, and your token must be allowed to use that model's group.

Speed & parameters

The system automatically detects and removes the trailing speed suffix in the prompt (--fast / --relax / --turbo) and maps it to the upstream speed mode; other Midjourney parameters such as --ar are passed through unchanged.

POST
/mj/submit/imagine

Authorization

BearerAuth

AuthorizationBearer <token>

使用你在 OmwAI 中创建的 API 令牌认证。 格式: Authorization: Bearer sk-xxxxxx 令牌需开通对应 Midjourney 模型的调用权限。

In: header

Request Body

application/json

prompt*string

提示词。可附带 Midjourney 参数(--ar 等)与速度后缀(--fast / --relax / --turbo)

state?string

自定义状态字段,查询结果时原样返回,可用于关联业务

notifyHook?string

任务完成后的回调通知地址(若系统启用回调通知)

Response Body

application/json

curl -X POST "https://www.omwai.xyz/mj/submit/imagine" \  -H "Content-Type: application/json" \  -d '{    "prompt": "a cute cat --ar 1:1 --fast"  }'
{
  "code": 1,
  "description": "success",
  "result": "24e93809-e443-46c5-9ecc-06fdadd8c09b",
  "properties": {}
}

Note

A successful submission (code of 1) does not mean the image is ready. Poll the Query Task Result endpoint with the returned result (jobId) until status becomes SUCCESS. Result images are retained for 2 hours only — download them in time.

How is this guide?

Last updated on