跳转至

MaaS-MJ

公共信息

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

创建生图任务

生图任务是异步完成

请求方法

POST

请求路径

{basePath}/{endpointPath}/tob/diffusion

参数 描述 示例
Authorization 控制台里创建的AK
AccessKey
Bearer ${AccessKey}
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.cloudsway.net/v1/ai/eljciTfuqTxBSjXl/tob/diffusion \
  --header 'Authorization: Bearer ${AccessKey}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "text": "一辆炫酷的赛车,在山路上飞驰"
  }'

返回值

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

区域重绘

请求方法

POST

请求路径

{basePath}/{endpointPath}/tob/inpaint

请求header

参数 描述 示例
Authorization 控制台里创建的AK
AccessKey
Bearer ${AccessKey}
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.cloudsway.net/v1/ai/eljciTfuqTxBSjXl/tob/inpaint' \
--header 'Authorization: Bearer ${AccessKey}' \
--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

请求路径

{basePath}/{endpointPath}/tob/upscale

请求header

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

请求body

字段名 类型 是否必填 描述 示例值
imageNo int 图片编号(0/1/2/3) 0
jobId string 任务ID 1234567890
type int 高清类型 0
type 参数说明
  • Default: "0"
  • Enum: "0" "1" "2" "3"
  • 0: v6/niji6/v6.1 subtle高清
  • 1: v6/niji6/v6.1 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.cloudsway.net/v1/ai/eljciTfuqTxBSjXl/tob/upscale' \
--header 'Authorization: Bearer ${AccessKey}' \
--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": []
}

查询任务信息

请求方法

GET

请求路径

{basePath}/{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.cloudsway.net/v1/ai/eljciTfuqTxBSjXl/tob/job/67a99aa1f674346b1d1c010f' \
--header 'Authorization: Bearer ${AccessKey}' \
--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"]
}