- 无界AI企业服务
- 无界AI企业智能客服
- 更新日志
- 公告
- API接入指南
- 作画指南
- AI专业版作画
- AI普通版作画
- AI视频生视频
- AI咒语解析
- 付费开通API
- AI化身&个性相机
- 提升作画效率
- 自定义镜像
- 用户账户
- LLM对话聊天
- OpenAI Image
发起透明图作画
POST
https://gate.wujieai.net/wj-open/v1/ai/create/layerDiffusion
AI普通版作画作画流程
请求参数
Body 参数application/json
layer_diffusion
object (LayerDiffusionParam_request)
必需
注:
1.需使用透明图所支持的模型。[700-通用XL,701-MJXL,702-产品美学,703-人像XL]。
可通过
/ai/default_resource
接口查询具体如何设值。(object)method
integer <int32>
可选
模式
可通过`获取作画模型的预设资源(/ai/default_resource)`接口查询,字段路径:`data`->`support_patterns`->`layer_diffusion_pattern_methods`->`method_code` *
示例值:
2
weight
number <float>
可选
示例值:
1.0
ending_step
number <float>
可选
示例值:
1.0
model
integer <int32>
必需
示例值:
700
prompt
string <string>
可选
可选平台资源接口预设的prompt来查看效果。
注:
1.若未传底图(即
init_image_url
为空)时,作画描述不能为空。2.若传了底图,且作画描述为空,会自动获取图片的tag填充为prompt来进行图生图。
Validate[max: 1500; ]
示例值:
夜幕下的赛博朋克城市
uc_prompt
string <string>
可选
注:
1.
2.
Validate[max: 1000; ]
示例值:
低分辨率,不良解剖结构,文本,低质量,(突变,绘制不良:1.2),肥胖,不良比例
fully_custom_uc_prompt
boolean
可选
true:仅客户上定义的负面描述词会生效。
false:使用官方模型定义的负向描述。
示例值:
true
num
integer <int32>
必需
示例值:
1
width
integer <int32>
可选
注:
支持自定义尺寸,尺寸要求为64的倍数,最小尺寸为64,尺寸不为64的倍数的,会向64对齐, 例96对齐64, 97对齐到128。
默认尺寸最长边限制在1344以内。
若使用精绘,长边需限制在1024以内,分辨率限制在1024*576以内。
使用controlnet或者createSource=1时可不传,其余情况下必填。
示例值:
512
height
integer <int32>
可选
示例值:
512
init_image_url
string <string>
可选
注:
1.
2.
3.
4.
5.
示例值:
https://cdn.wujiebantu.com/ai/C837D53F842A48AEDFA7DA2976D834FE-01.png
init_width
integer <int32>
可选
建议和输入底图的宽度保持一致,不一致时平台按此值计算。
注:使用ControlNet或createSource=1时必填。
示例值:
512
init_height
integer <int32>
可选
建议和输入底图的高度保持一致,不一致时平台按此值计算。
注:使用ControlNet时或createSource=1时必填。
示例值:
512
creativity_degree
integer <int32>
可选
创意度越低,生成的图片越接近参考图。
注:
1.
init_image_url
有值)时才会生效。2.
示例值:
50
image_type
array[string]
可选
可通过
获取作画模型的预设资源(ai/default_resource)
接口查询,获取返回列表中的画面类型(image_type
-name
)字段。示例值:
[超现实照片]
style
array[string]
可选
可通过
获取作画模型的预设资源(ai/default_resource)
接口查询,获取返回列表中的风格(style
-name
)字段。示例值:
[赛博朋克]
artists
array[string]
可选
可通过
获取作画模型的预设资源(ai/default_resource)
接口查询,获取返回列表中的艺术家(artist
-name
)字段。示例值:
[鸟山明]
element_magic
array[string]
可选
可通过
获取作画模型的预设资源(ai/default_resource)
接口查询,获取返回列表中的元素魔法(element_magic
-key
)字段。示例值:
[星空法]
style_decoration
array[string]
可选
可通过
获取作画模型的预设资源(ai/default_resource)
接口查询,获取返回列表中的元素魔法(style_decoration
-key
)字段。imageType,style,artist,elementMagic本质上也都属于styleDecoration。
示例值:
[星空法]
accelerate_times
integer <int32>
必需
默认0,每加1就是往队列前面多插1位,一次对应2积分(批量作画的积分消耗则还要算上对应作画数量)。
示例值:
2
model_fusion
array[object (AiArtworkModelFusionVO_request) {2}]
可选
可通过
获取作画模型的预设资源(ai/default_resource)
接口查询,获取返回列表中的的融合模型(model_fusion
-key
)字段。key
string <string>
融合模型key
示例值:
mf-可爱的线条平涂风
weight
number <float>
权重
示例值:
0.6
steps
integer <int32>
可选
注:
1.
2.
示例值:
20
cfg
number <float>
可选
表示AI对描述参数的倾向程度,数值越大会越专注于提示词的内容,生成更加符合描述的图像。
示例值:
7
sampler_index
integer <int32>
可选
不同model支持的采样模式不同,可通过
获取作画模型的预设资源(/ai/default_resource)
接口查询,获取返回信息列表中的采样模型(sampler_models
-sampler_index
)字段。示例值:
16
seed
string <string>
可选
通过随机种子确定扩散的初始状态,进而控制生成的样本的多样性。
相同的种子值可以保持图像的一致性,若设置相同的种子编号、模型,可以重新生成类似的图像。
注:目前不支持字母,传字母会导致作画超时或失败。
示例值:
-1
create_source
integer <int32>
可选
0 - 自定义尺寸,需要自定义出图宽高、 超分、精绘(width height superSizeMultiple prefineMultiple)。
1 - 自动尺寸,需要指定底图宽高(initWidth initHeight),系统会忽略上述自定义参数,根据底图自动计算出图宽高(如果底图长边小于2048,会保证出图长边为2048,短边则按底图比例求得;反之,则出图尺寸与底图相同)。
两种模式下均可以不传prompt,此时会自动获取图片的tag作为prompt。
示例值:
0
clip_skip
integer <int32>
可选
描述画面的准确程度与数值大小成反比,数值越小表示对图像的控制度越高,最佳使用区间为1-2。
示例值:
5
notify_url
string <string>
可选
回调重试规则:
1.
2.
回调报文:
{
"artwork_url": "https://cdn.wujiebantu.com/ai/530FFE6722D2A2B4A9504166221AAB40-01.jpg",
"audit_info": {
"check_fail": false,
"hit": false,
"data_id": "245959",
"total_suggestion": "PASS",
"scan_scene_d_t_o_s": [{
"rate": 0.9944,
"suggestion": "pass",
"label": "politics",
"label_desc": "涉政",
"scene": "TERRORISM"
},
{
"rate": 1,
"suggestion": "pass",
"label": "terrorism",
"label_desc": "暴恐",
"scene": "TERRORISM"
},
{
"rate": 0.9993,
"suggestion": "pass",
"label": "porn",
"label_desc": "色情",
"scene": "PORN"
},
{
"rate": 1,
"suggestion": "pass",
"label": "prohibition",
"label_desc": "违禁",
"scene": "TERRORISM"
},
{
"rate": 0.9986,
"suggestion": "pass",
"label": "sexy",
"label_desc": "性感",
"scene": "PORN"
}
],
"url": "https://cdn.wujiebantu.com/ai/810F1750EFF2EC416ED6682DFFCFBF2C-01.jpg-v800"
},
"batch_task_key": "14DBBD0743C8715D92183756E3FB398C",
"code": 0,
"complete_time": 1681109462,
"integral_cost": 2,
"integral_cost_message": "积分已扣除",
"involve_yellow": 0,
"key": "EF8DF2DCF18D0D69F7F836A100C857AF",
"success": true
}
success - 作画是否成功
code - 作画是否成功code,0=成功 1=失败
key - 对应作画任务的key
artwork_url - 作画生成结果图url
complete_time - 作画完成时间
integral_cost - 积分花费
integral_cost_message - 积分花费说明
示例值:
www.tobias-wiegand.biz
示例
{
"layer_diffusion": {
"method": 2,
"weight": 1,
"ending_step": 1
},
"model": 700,
"prompt": "夜幕下的赛博朋克城市",
"uc_prompt": "低分辨率,不良解剖结构,文本,低质量,(突变,绘制不良:1.2),肥胖,不良比例",
"fully_custom_uc_prompt": true,
"num": 1,
"width": 512,
"height": 512,
"init_image_url": "https://cdn.wujiebantu.com/ai/C837D53F842A48AEDFA7DA2976D834FE-01.png",
"init_width": 512,
"init_height": 512,
"creativity_degree": 50,
"image_type": [
"超现实照片"
],
"style": [
"赛博朋克"
],
"artists": [
"鸟山明"
],
"element_magic": [
"星空法"
],
"style_decoration": [
"星空法"
],
"accelerate_times": 2,
"model_fusion": [
{
"key": "mf-可爱的线条平涂风",
"weight": 0.6
}
],
"steps": 20,
"cfg": 7,
"sampler_index": 16,
"seed": "-1",
"create_source": 0,
"clip_skip": 5,
"notify_url": "www.tobias-wiegand.biz"
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://gate.wujieai.net/wj-open/v1/ai/create/layerDiffusion' \
--header 'Content-Type: application/json' \
--data-raw '{
"layer_diffusion": {
"method": 2,
"weight": 1.0,
"ending_step": 1.0
},
"model": 700,
"prompt": "夜幕下的赛博朋克城市",
"uc_prompt": "低分辨率,不良解剖结构,文本,低质量,(突变,绘制不良:1.2),肥胖,不良比例",
"fully_custom_uc_prompt": true,
"num": 1,
"width": 512,
"height": 512,
"init_image_url": "https://cdn.wujiebantu.com/ai/C837D53F842A48AEDFA7DA2976D834FE-01.png",
"init_width": 512,
"init_height": 512,
"creativity_degree": 50,
"image_type": [
"超现实照片"
],
"style": [
"赛博朋克"
],
"artists": [
"鸟山明"
],
"element_magic": [
"星空法"
],
"style_decoration": [
"星空法"
],
"accelerate_times": 2,
"model_fusion": [
{
"key": "mf-可爱的线条平涂风",
"weight": 0.6
}
],
"steps": 20,
"cfg": 7,
"sampler_index": 16,
"seed": "-1",
"create_source": 0,
"clip_skip": 5,
"notify_url": "www.tobias-wiegand.biz"
}'
返回响应
🟢200成功
*/*
Body
code
string <string>
响应code
示例值:
200
message
string <string>
失败信息
示例值:
success
data
object (AiArtworkKeysVo_response)
可选
keys
array[string]
作画结果Key列表
示例值:
C5B5FE8DBF3679D9049342C130341BD9
results
array[object (CrAiArtworkCreateResult_response) {3}]
可选
expected_integral_cost
integer <int32>
预计总消耗积分数
示例值:
2
示例
{
"code": "200",
"message": "success",
"data": {
"keys": "C5B5FE8DBF3679D9049342C130341BD9",
"results": [
{
"key": "C5B5FE8DBF3679D9049342C130341BD9",
"expected_second": 12,
"batch_task_key": "14DBBD0743C8715D92183756E3FB398C"
}
],
"expected_integral_cost": 2
}
}