跳转至

MaaS-MJ

公共信息

参数 描述 示例
basePath 调用mass api的基础路径,包含/v1/ai固定路径 https://genaiapi-m2.cloudsway.net/v1/ai
endpointPath 调用mass api的生成的一段随机路径
AK 调用mass api的AK {your_AK}
taskId The task ID for asynchronous video processing tasks 1234abcd

参数列表

参数 取值范围 默认值 说明
--ar 正整数比值 1:1 宽高比
--raw — — 原始模式,不采用MJ 的默认美化
--hd — — 原生 2K 高清渲染
--chaos 0-100 0 结果多样性
--seed 0-4294967295 随机 随机种子
--stylize 0-1000 100 艺术风格强度
--quality v8.1: {1, 4}
v8.2: {1, 2, 3, 4}
1 图像细节程度。4 为高质量模式
--iw 0-3 1 图像提示权重(详见「图片提示词」文档)
--no 文本 — 否定提示
--sref URL(最多 20 个) — 风格参考
--sw 0-1000 100 风格参考权重
--sv 6 6 风格算法版本(仅支持 6)
--exp 0-100 0 实验参数,增加画面动态感
--personalize — — 个性化配置
--draft — — v8系列下,一次性生成24张图片,计费与标准生图任务一致(不享受减半优惠)
--fast — — 快速模式(默认)
--turbo ❌ — 不支持极速模式(2 倍费用)
--weird 0-3000 0 引入超现实元素
--tile — — 无缝平铺图案

目前不支持 repeat、personalize、{} 排列提示词、public/stealth。

创建生图任务

生图任务是异步完成

请求方法

POST

请求路径

https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/tob/diffusion

参数 描述 示例
Authorization 控制台里创建的AK
AccessKey
Bearer ${your AK}
Bearer RWxxxxxxxx0Gd

请求body

字段名 类型 是否必填 描述 示例值
text string 是 文本信息,长度[1-8192] A beautiful and youthful...

返回值

字段名 类型 描述 示例值
audits Array of strings 图片审核结果,空代表审核通过 ["approved"]
comment string 任务状态详细描述 Task completed successfully.
id string 任务ID 3374b3b0-d069-4831-a76b-ebab4df14457
seed integer 种子值 123456
status integer 任务状态
Default:"0"
Enum:
0:新创建
1:执行中
2:执行成功
3:失败
0
text string 文本,长度[1-8192] A beautiful and youthful...
urls Array of strings 图片URL或空 ["http://example.com/image1.jpg"]

示例

请求

curl --request POST \
  --url https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/tob/diffusion \
  --header 'Authorization: Bearer ${your AK}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "text": "一辆炫酷的赛车,在山路上飞驰"
  }'

返回值

{
  "audits": [],
  "comment": "执行中",
  "id": "67a99aa1f674346b1d1c010f",
  "seed": 0,
  "status": 1,
  "text": "一辆炫酷的赛车,在山路上飞驰",
  "urls": []
}

区域重绘

请求方法

POST

请求路径

https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/tob/inpaint

请求header

参数 描述 示例
Authorization 控制台里创建的AK
AccessKey
Bearer ${your AK}
Bearer RWxxxxxxxx0Gd

请求body

字段名 类型 是否必填 描述 示例值
imageNo int 是 图片编号(0/1/2/3) 0
jobId string 是 任务ID 1234567890
mask object 是 轻量区域蒙板,支持多区域重绘 {...}
remixPrompt string 否 重绘关键词提示,长度[1-8192] A new artistic style

area 对象

字段名 类型 是否必填 描述 示例值
height int 是 图片像素高(500-4096) 1024
points Array 是 多边形区域坐标点 [169,673,561,687,607,847,186,847]
width int 是 图片像素宽(500-4096) 1024

返回值

字段名 类型 描述 示例值
audits Array of strings 图片审核结果
comment string 任务状态详细描述 执行中
id string 任务ID 3374b3b0-d069-4831-a76b-ebab4df14457
seed integer 种子值 123456
status integer 任务状态
Default:"0"
Enum:
0:新创建
1:执行中
2:执行成功
3:失败
0
text string 文本 A beautiful and youthful...
urls Array of strings 图片URL或空 ["http://example.com/image1.jpg"]

示例

请求

curl --request POST 'https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/tob/inpaint' \
--header 'Authorization: Bearer ${your AK}' \
--header 'content-type: application/json' \
--header 'Accept: */*' \
--data-raw '{
  "imageNo": 0,
  "jobId": "67a96a41fc0b6392b58e4285",
  "mask": {
    "areas": [
      {
        "height": 500,
        "points": [
          169,673,561,687,607,847,186,847
        ],
        "width": 500
      }
    ]
  }
}''

返回值

{
  "audits": [],
  "comment": "执行中",
  "id": "67a99bbff674346b1d1c015c",
  "seed": 0,
  "status": 1,
  "text": "一辆炫酷的赛车,在山路上飞驰",
  "urls": []
}

高清生图

请求方法

POST

请求路径

https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/tob/upscale

请求header

参数 描述 示例
Authorization 控制台里创建的AK
AccessKey
Bearer ${your AK}
Bearer RWxxxxxxxx0Gd

请求body

字段名 类型 是否必填 描述 示例值
imageNo int 是 图片编号(0/1/2/3) 0
jobId string 是 任务ID 1234567890
type int 是 高清类型 0
type 参数说明
  • Default: "0"
  • Enum: "0" "1"
  • 0: v6/niji6/v6.1/v7 subtle高清
  • 1: v6/niji6/v6.1/v7 creative高清

返回值

字段名 类型 描述 示例值
audits Array of strings 图片审核结果
comment string 任务状态详细描述 执行中
id string 任务ID 3374b3b0-d069-4831-a76b-ebab4df14457
seed integer 种子值 123456
status integer 任务状态 2
text string 文本 A beautiful and youthful...
urls Array of strings 图片URL或空 ["http://example.com/image1.jpg"]

示例

请求

curl --request POST 'https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/tob/upscale' \
--header 'Authorization: Bearer ${your AK}' \
--header 'content-type: application/json' \
--header 'Accept: */*' \
--data-raw '{
  "imageNo": 0,
  "jobId": "67a99bbff674346b1d1c015c",
  "type": 1
}'

返回值

{
  "audits": [],
  "comment": "执行中",
  "id": "67a9ae7cfc0b6392b58e4ff6",
  "seed": 0,
  "status": 1,
  "text": "一辆炫酷的赛车,在山路上飞驰",
  "urls": []
}

变化(Variation)

请求 URL

POST 
https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/tob/variation

请求参数

字段 类型 必填 说明
jobId string 是 原始任务 ID
imageNo integer 是 原始图像编号,取值 0-3
type integer 是 变化程度:0=轻微变化,1=强烈变化
remixPrompt string 否 重塑提示词,用于在变化基础上调整方向

请求示例

curl 'https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/tob/variation' \
-H 'Authorization:  Bearer {Your AK}' \
-H 'Content-Type:  application/json' \
-d '{
    "jobId": "6a13efcec6b99f3fdfec4914",
    "imageNo": 1,
    "type": 0,
    "remixPrompt": "Make the hat blue"
}'

查询任务信息

请求方法

GET

请求路径

https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/tob/job/{jobId}

路径参数

参数 类型 是否必填 描述
jobId string 是 任务ID

返回值

字段名 类型 描述
audits Array of strings 图片审核结果;与urls数组中的下标对应,空代表审核通过
comment string 任务状态详细描述
id string 任务ID
seed integer 种子值
status integer 任务状态
text string 文本,长度[1-8192]
urls Array of strings 图片URL数组, 空单个url为代表审核未通过

status 参数说明

  • 0: 任务创建
  • 1: 执行中
  • 2: 执行成功
  • 3: 失败

示例

请求

curl --request GET 'https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/tob/job/67a99aa1f674346b1d1c010f' \
--header 'Authorization: Bearer ${your AK}' \
--header 'content-type: application/json' \

返回值

{
  "audits": ["approved"],
  "comment": "成功",
  "id": "3374b3b0-d069-4831-a76b-ebab4df14457",
  "seed": 123456,
  "status": 2,
  "text": "A beautiful and youthful high school girl is sitting in the classroom, with a bright smile on her face.",
  "urls": ["http://example.com/image1.jpg"]
}

请求示例

curl 'https://genaiapi-m2.cloudsway.net/v1/ai/{{endpointPath}}/tob/diffusion' \
-H 'Authorization:  Bearer {Your AK}' \
-H 'Content-Type:  application/json' \
-d '{
    "text": "一辆炫酷的赛车,在山路上飞驰 --v 7 --aspect 2:1 --draft --turbo"
}'

附表(生图模型参数对比)

参数 v6* niji 6 niji 7 v7 v8.1
原始模式 raw raw raw raw raw
平铺 ✅ ✅ ❌ ✅ ❌
混沌 0-100 0-100 0-100 0-100 0-100
种子 0-4294967295 0-4294967295 0-4294967295 0-4294967295 0-4294967295
停止 10-100 10-100 ❌ ❌ ❌
怪异 0-3000 0-3000 0-3000 0-3000 ❌
风格化 0-1000 0-1000 0-1000 0-1000 0-1000
质量 (0.5, 1, 2) (0.5, 1, 2) ❌ (1, 2, 4) (1, 4)
高分辨率 ❌ ❌ ❌ ❌ ✅
快速模式 ✅ ✅ ✅ ✅ ✅
极速模式 ✅ ✅ ✅ ✅ ❌
慢速模式 ❌ ❌ ❌ ❌ ❌
图像提示词 ✅ ✅ ✅ ✅ ✅
图像权重 0-3 0-3 0-2 0-3 0-3
否定提示 >= 6.1支持 ❌ ❌ ✅ ❌
风格参考 ✅ ✅ ✅ ✅ ✅
角色参考 ✅ ✅ ❌ ❌ ❌
角色权重 0-100 0-100 ❌ ❌ ❌
风格版本 (1, 2, 3, 4) (1, 2, 3, 4) (1, 2, 3, 4) (1, 2, 3, 4, 5, 6) (6)
风格权重 0-1000 0-1000 0-1000 0-1000 0-1000
重复参数 ❌ ❌ ❌ ❌ ❌
草图 ❌ ❌ ❌ ✅ ❌
万物引用 ❌ ❌ ❌ ✅ ❌
万物引用权重 ❌ ❌ ❌ 1-1000 ❌
实验参数 ❌ ❌ ❌ 0-100 0-100
个性化 ✅ ❌ ✅ ✅ ✅