文字转图像
开发环境
https://stablediffusionapi.com/v1
开发环境
https://stablediffusionapi.com/v1
POST
https://stablediffusionapi.com/api/v1/enterprise/text2img
提示 **您可以在此处**找到可用的公共模型及其 ID 的列表。
POST
向 https://stablediffusionapi.com/api/v1/enterprise/text2img 接口发出请求,并将所需参数作为请求正文传递。INFO
要使用负载均衡器,您需要拥有多个服务器。请传入第一个服务器的 API 密钥,它会和其他服务器一起处理负载均衡。
提示
您也可以使用多个 Lora 模型。只需确保在请求体中以逗号分隔的形式传递 lora_model_id,例如:"more_details,animie"。
多语言支持
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://stablediffusionapi.com/api/v1/enterprise/text2img' \
--header 'Content-Type: application/json' \
--data-raw '{
"key": "enterprise_api_key",
"model_id": "model_id",
"prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner)), blue eyes, shaved side haircut, hyper detail, cinematic lighting, magic neon, dark red city, Canon EOS R3, nikon, f/1.4, ISO 200, 1/160s, 8K, RAW, unedited, symmetrical balance, in-frame, 8K",
"negative_prompt": "painting, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, deformed, ugly, blurry, bad anatomy, bad proportions, extra limbs, cloned face, skinny, glitchy, double torso, extra arms, extra hands, mangled fingers, missing lips, ugly face, distorted face, extra legs, anime",
"width": "512",
"height": "512",
"samples": "1",
"num_inference_steps": "20",
"safety_checker": "no",
"enhance_prompt": "yes",
"seed": null,
"guidance_scale": 7.5,
"multi_lingual": "no",
"panorama": "no",
"self_attention": "no",
"upscale": "no",
"embeddings_model": null,
"lora_model": null,
"clip_skip": "2",
"tomesd": "yes",
"use_karras_sigmas": "yes",
"vae": null,
"lora_strength": null,
"scheduler": "UniPCMultistepScheduler",
"webhook": null,
"track_id": null
}'
响应示例响应示例
{
"status": "string",
"generationTime": 0,
"id": 0,
"output": [
"string"
],
"meta": {
"prompt": "string",
"model_id": "string",
"negative_prompt": "string",
"scheduler": "string",
"revision": "string",
"safetychecker": "string",
"W": 0,
"H": 0,
"enable_attention_slicing": "string",
"file_prefix": "string",
"guidance_scale": 0,
"seed": 0,
"steps": 0,
"n_samples": 0,
"upscale": "string",
"multi_lingual": "string",
"panorama": "string",
"self_attention": "string",
"embeddings": null,
"lora": null,
"outdir": "string",
"vae": "string"
}
}
请求参数
Body 参数application/json