Host:maas-api.ml-platform-cn-beijing.volces.com
Region: cn-beijing
目前请求体传入上限需要控制在4M以内
字段 | 类型 | 描述 |
---|---|---|
prompt | string | 正向提示词,生成的图与输入内容正相关 |
negative_prompt | string | 负向提示词,生成的图与输入内容负相关 |
init_image | bytes | 传入会启用img2img并增加latency,生成的图与传入图片会有正相关性 |
control_image_list | List of bytes | config内使用controlnet后才会起效,图片会通过controlnet控制生成内容。 |
seed | int | 随机数种子 |
strength | float | denoise强度,输入范围须在(0, 1.0] |
height | int | 生图的height,会向下取整到8的倍数,例如500->496。输入范围须在(0, 1024] |
width | int | 生图的width,会向下取整到8的倍数,例如500->496。输入范围须在(0, 1024] |
num_inference_steps | int | 去噪步长 |
sampler_name | string | 可选为:
|
scheduler | string | 可选为:
|
cfg_scale | float | The classifier free guidance(cfg) scale,控制与提示词的相关性,数值越大与提示词相关性越强,过大会导致失真。 |
字段 | 类型 | 描述 |
---|---|---|
data | list | 目前开放出的内容为
其中url的返回值是data:image/jpeg;base64,{encoded_string},encoded_string为一个编码为base64的PNG格式图片 |
go
https://github.com/volcengine/volc-sdk-golang/tree/main/example/maas/v2/images
Python
https://github.com/volcengine/volc-sdk-python/blob/main/volcengine/example/maas/v2/image
// Request // quick-gen: https://maas-api.ml-platform-cn-beijing.volces.com/api/v2/endpoint/${YOUR_ENDPOINT_ID}/images/quick-gen // flex-gen: https://maas-api.ml-platform-cn-beijing.volces.com/api/v2/endpoint/${YOUR_ENDPOINT_ID}/images/flex-gen curl --request POST \ --url https://maas-api.ml-platform-cn-beijing.volces.com/api/v2/endpoint/${YOUR_ENDPOINT_ID}/images/flex-gen \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "prompt": "(sfw:1.0),", "parameters": { "seed": 38, "strength": 0.88, "num_inference_steps": 10, "cfg_scale": 1.0 }, "control_image_list":["/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCAAWABQDAREAAhEBAxEB/8QAFgABAQEAAAAAAAAAAAAAAAAAAAUJ/8QAGRAAAQUAAAAAAAAAAAAAAAAAAAEEFFOi/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAL/xAAVEQEBAAAAAAAAAAAAAAAAAAAAEf/aAAwDAQACEQMRAD8A1TAAAAAABPkObsoVE0kObsoIUkObsoIV/9k="] }' // Response { "data": [ { "url": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCAAWABQDAREAAhEBAxEB/8QAFgABAQEAAAAAAAAAAAAAAAAAAAUJ/8QAGRAAAQUAAAAAAAAAAAAAAAAAAAEEFFOi/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAL/xAAVEQEBAAAAAAAAAAAAAAAAAAAAEf/aAAwDAQACEQMRAD8A1TAAAAAABPkObsoVE0kObsoIUkObsoIV/9k=", }, ] }