文字转图像
POST
/v3/async/txt2img文本到图像端点,只会返回一个task_id。您应该使用task_id调用https://docs.novita.ai/task-api/get-async-task-result端点来检索图像生成结果。
请求参数
Header 参数
Authorization
string
必需
Content-Type
string
必需
Body 参数application/json
extra
object
必需
response_image_type
string
必需
enable_nsfw_detection
boolean
必需
custom_storage
object
必需
enterprise_plan
object
必需
request
object
必需
model_name
string
必需
检查点的名称,您可以调用 /v2/models 端点来检索 sd_name 字段作为 model_name。
prompt
string
必需
肯定提示词,用“,”分隔。
negative_prompt
string
必需
否定提示词,用“,”分隔
sd_vae
string
可选
VAE(Variational Auto Encoder),sd_vae 可以在 api /v2/models 中通过查询参数 type=vae 访问,如 'sd_name': 'customVAE.safetensors'
loras
array [object {2}]
可选
Lora选项,目前最多支持5个Lora
embeddings
array [object {1}]
可选
文本反转选项,当前支持最多 5 个嵌入
hires_fix
object
可选
refiner
object
SD精炼机。
width
integer
图像的宽度。
height
integer
图像的高度。
image_num
integer
必需
一代人生成的图像数量。
steps
integer
必需
将步骤视为图像创建过程的迭代。
seed
integer
必需
种子是稳定扩散产生噪声的数字。
clip_skip
integer
必需
剪辑跳过,必须大于 0。
guidance_scale
number
必需
此设置表示稳定扩散将听取您的提示的程度。
sampler_name
string
必需
这个去噪过程称为采样,因为稳定扩散在每个步骤中都会生成一个新的样本图像。
示例
{
"extra": {
"response_image_type": "jpeg",
"enable_nsfw_detection": true,
"custom_storage": {
"aws_s3": {
"region": "us-east-2",
"bucket": "test_bucket",
"path": "/"
}
},
"enterprise_plan": {
"enabled": true
}
},
"request": {
"model_name": "anyhentai_20_31826.safetensors",
"prompt": "nsfw, 1girl, (solo:1.1), small breasts, topless, nipples, thongs, thigh, slicked back short hair, half body in pool, outdoor, pool side, very sexy, wet body, modern villa, southern france, soft light, realistic, intricate details, (light freckles:0.5), lightly tanned, professional photography, depth of field, amazing eyes, (smooth hands:1.1), photoshoot, detailed background, professional model, ultra 4k, photorealist, lace panties",
"negative_prompt": "(badhandv4:1.2),(worst quality:2),(low quality:2),(normal quality:2),lowres,bad anatomy,bad hands,((monochrome)),((grayscale)) watermark,moles, easynegative ng_deepnegative_v1_75t, (oversized head:2), (big head:2), (deformed face:1.5),( blurry face:2), bad eyes, irregular eyes, asymmetric eyes, ugly, teeth, (navel:0.9), artefact, jpg artefact, blurry face, blurry, blurred, pixelated, bad eyes, crossed eyes, blurry eyes, nipple",
"sd_vae": "",
"loras": [
{
"model_name": "",
"strength": null
}
],
"embeddings": [
{
"model_name": ""
}
],
"hires_fix": {
"target_width": null,
"target_height": null,
"strength": null
},
"refiner": {
"switch_at": null
},
"width": 512,
"height": 512,
"image_num": 1,
"steps": 20,
"seed": 123,
"clip_skip": 1,
"guidance_scale": 7.5,
"sampler_name": "Euler a"
}
}
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
task_id
string
必需
示例
{
"task_id": "b49df8dc-4a72-474b-a863-d1e11b007109"
}
最后修改时间: 1 年前