跳转至

文本生图片

公共信息

参数 描述 示例
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

MaaS-midjourney

创建生图任务

生图任务是异步完成

请求方法

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"]
}

MaaS-Stable-Diffusion-3.5-Large

创建生图任务

生图任务是异步完成

请求方法

POST

请求路径

{basePath}/v2/ai/{endpointPath}/images/generations

请求header

参数 描述 示例
Authorization AccessKey
Bearer ${AccessKey}
Bearer RWxxxxxxxx0Gd

请求body

字段名 类型 是否必填 描述 示例值
prompts string 正向提示词 A fruit basket containing dragon fruit, mango, guava, apple, and banana
neg-prompts string 负向提示词 Peach
batchsize int 出图数量 限制范围:1-8 default:1 1
aspect_ratio String 宽高比 支持的值:1:1、2:3、3:2、3:4、4:3、16:9、9:16 1:1 对应 1024:1024
2:3 对应 512:768
3:2 对应 768:512
3:4 对应 768:1024
4:3 对应 1024:768
16:9 对应 1280:720
9:16 对应 720:1280
step int 步数 限制范围:20-40 4
seed int 随机种子
default:0
0

返回值

字段名 类型 描述 示例值
status String 状态值 success
error
taskId String 任务id

示例

请求

使用客户端点方式调用

curl --request POST \
  --url https://genaiapi.cloudsway.net/v2/ai/HotklGMehD/images/generations \
  --header 'Accept: */*' \
  --header 'Accept-Encoding: gzip, deflate, br' \
  --header 'Authorization: Bearer ${AccessKey}' \
  --header 'Connection: keep-alive' \
  --header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
  --header 'content-type: application/json' \
  --data '{
    "prompts": "A fruit basket containing dragon fruit, mango, guava, apple, and banana",
    "neg-prompts":"peach",
    "aspect_ratio": "1:1",
    "step": 25
}'

使用统一域名方式调用

curl --request POST \
  --url https://genaiapi.cloudsway.net/v2/images/generations \
  --header 'Accept: */*' \
  --header 'Accept-Encoding: gzip, deflate, br' \
  --header 'Authorization: Bearer ${AccessKey}' \
  --header 'Connection: keep-alive' \
  --header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
  --header 'content-type: application/json' \
  --data '{
    "prompts": "A fruit basket containing dragon fruit, mango, guava, apple, and banana",
    "neg-prompts":"peach",
    "aspect_ratio": "1:1",
    "step": 25,
    "model":"MaaS-Stable-Diffusion-3.5-Large"
}'

返回值

{
  "status": "success",
  "taskId": "3374b3b0-d069-4831-a76b-ebab4df14457"
}

查看任务信息

请求方法

GET

请求路径

{basePath}/v2/ai/{endpointPath}/images/tasks/{taskId}

请求header

参数 描述 示例
Authorization AccessKey
Bearer ${AccessKey}
Bearer RWxxxxxxxx0Gd

请求参数

字段名 类型 是否必填 描述 示例值
taskId String 任务id 3374b3b0-d069-4831-a76b-ebab4df14457

返回值

字段名 类型 描述 示例值
status String 任务状态信息 completed
Current task is in progress, please try again later
completed boolean 是否完成 true
false
imageUrls list 图片地址集合

示例

请求

使用客户端点方式调用

curl --location --request GET 'https://genaiapi.cloudsway.net/v2/ai/lXynAhfbOiD/images/tasks/3374b3b0-d069-4831-a76b-ebab4df14457 ' \
--header 'Authorization: Bearer ${AccessKey}' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'content-type: application/json' \
--header 'Accept: */*' \
--header 'Connection: keep-alive' \
--data-raw ''

使用统一域名方式调用

curl --request GET \
  --url https://genaiapi.cloudsway.net/v2/images/tasks/MaaS-Stable-Diffusion-3.5-Large/bd03bf13-f480-4ca2-b686-b3ea26c969ef \
  --header 'Accept: */*' \
  --header 'Accept-Encoding: gzip, deflate, br' \
  --header 'Authorization: Bearer ${AccessKey}' \
  --header 'Connection: keep-alive' \
  --header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
  --header 'content-type: application/json'

返回值

{
  "status": "completed",
  "completed": true,
  "imageUrls": [
    "http://xxxx.png"
  ]
}

MaaS-Flux-1-schnell

创建生图任务

生图任务是异步完成

请求方法

POST

请求路径

{basePath}/v2/ai/{endpointPath}/images/generations

请求header

参数 描述 示例
Authorization AccessKey
Bearer ${AccessKey}
Bearer RWxxxxxxxx0Gd

请求body

字段名 类型 是否必填 描述 示例值
prompts string 正向提示词 A fruit basket containing dragon fruit, mango, guava, apple, and banana.
batchsize int 出图数量 限制范围:1-8 default:1 1
aspect_ratio String 宽高比 支持的值:1:1、2:3、3:2、3:4、4:3、16:9、9:16 1:1 对应 1024:1024
2:3 对应 512:768
3:2 对应 768:512
3:4 对应 768:1024
4:3 对应 1024:768
16:9 对应 1280:720
9:16 对应 720:1280
step int 步数 限制范围:4-10 4
seed int 随机种子
default:0
0

返回值

字段名 类型 描述 示例值
status String 状态值 success
taskId String 任务id

示例

请求

curl --request POST \
--url https://genaiapi.cloudsway.net/v2/ai/lXynAhfbAiD/images/generations \
--header 'Authorization: Bearer ${AccessKey}' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'content-type: application/json' \
--header 'Accept: */*' \
--header 'Connection: keep-alive' \
--data-raw '{
"prompts": "A fruit basket containing dragon fruit, mango, guava, apple, and banana.",
"aspect_ratio": "2:3",
"batchsize": "2",
"step": 10
}'

返回值

{
  "status": "success",
  "taskId": "3374b3b0-d069-4831-a76b-ebab4df14457"
}

查看任务信息

请求方法

GET

请求路径

{basePath}/v2/ai/{endpointPath}/images/tasks/{taskId}

请求header

参数 描述 示例
Authorization AccessKey
Bearer ${AccessKey}
Bearer RWxxxxxxxx0Gd

请求参数

字段名 类型 是否必填 描述 示例值
taskId String 任务id 3374b3b0-d069-4831-a76b-ebab4df14457

返回值

字段名 类型 描述 示例值
status String 任务状态信息
completed boolean 是否完成
imageUrls list 图片地址集合

示例

请求

curl --location --request GET 'https://genaiapi.cloudsway.net/v2/ai/lXynAhfbOiD/images/tasks/3374b3b0-d069-4831-a76b-ebab4df14457 ' \
--header 'Authorization: Bearer ${AccessKey}' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'content-type: application/json' \
--header 'Accept: */*' \
--header 'Connection: keep-alive' \
--data-raw ''

返回值

{
  "status": "completed",
  "completed": true,
  "imageUrls": [
    "http://xxxx.png"
  ]
}