跳转到内容

FLUX.1 [dev] with Controlnets and Loras

集成

模型 id flux-general
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://vit.doitong.com/api/v1/run/flux-general?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://vit.doitong.com/api/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

此请求: ≈$0.30 300 API 积分 在此页面运行

获取 API 密钥
Black Forest Labs 文生图 参考输入 #lora#controlnet#ip-adapter

支持 LoRA、ControlNet、IP-Adapter、EasyControl 和参考图引导的 FLUX.1 [dev] 文生图

Black Forest Labs · 图像

你的第一个结果将在此显示

在下方构建请求,并使用你的 API 密钥运行。输出会复制到我们的存储中,可永久保存或免费保存 7 天。

构建请求

控件根据模型架构生成。更改控件时,代码和价格会同步更新。

•必填

指导图像生成的提示词。

image_size

生成图像的尺寸。

num_images 默认 1

设置要生成的图像数量;输出以流式传输时固定为 1。

高级 negative_prompt · reference_image_url · output_format · scheduler · sigma_schedule · num_inference_steps · guidance_scale · real_cfg_scale · reference_strength · reference_start · reference_end · base_shift · max_shift · nag_scale · nag_tau · nag_alpha · nag_end · seed · use_real_cfg · use_cfg_zero · enable_safety_checker · use_beta_schedule · loras · control_loras · controlnets · controlnet_unions · ip_adapters · easycontrols · fill_image
默认

默认使用 NAG 处理的负面提示词,用于抑制生成图像中的指定不需要特征。

拖放文件,或

用于 Reference-Only 引导的图像 URL。

output_format 默认 png

结果图像的文件格式。

scheduler 默认 euler

去噪期间使用的调度器。

去噪期间使用的 sigma 调度。

默认 28

要执行的推理步数。

默认 3.5

图像选择对提示词的遵循强度,以 CFG(Classifier Free Guidance)表示。

默认 3.5

图像选择对提示词的遵循强度,以 CFG(Classifier Free Guidance)表示。

默认 0.65

reference_only 生成期间参考图像的影响程度;未提供参考图像时,此强度设置无效。

默认 0

参考引导起点,占全部时间步的百分比。

默认 1

参考引导终点,占全部时间步的百分比。

默认 0.5

应用于调度时间步的基线偏移。

默认 1.15

应用于调度时间步的最大偏移。

默认 3

由 NAG scale 控制的负面提示词规避程度:提高该值会使生成图像不那么接近负面描述。

默认 2.5

用于隐藏状态归一化的 NAG tau 设置;建议保持不变。提高该值会削弱归一化,并可能导致图像意外偏离原图。

默认 0.25

NAG alpha 设置正面提示词重新引导归一化引导的程度,该引导结合了正面和负面提示词。最终权重在较低设置下使正面提示词影响更大,在较高设置下减少重新引导。

默认 0.25

NAG 截止点,占生成步数的比例。NAG 按该初始比例运行后,FLUX 原始注意力处理器接管。

用于生成可复现图像的种子:模型版本不变时,相同的提示词和种子会生成相同图像。

默认 []

其组合效果用于生成图像的 LoRA,数量不限。

默认 []

合并为组合配置、用于生成最终图像的控制图像 LoRA;数量不限。

默认 []

用于图像生成的 ControlNet 配置,目前仅限单个 ControlNet。

默认 []

用于图像生成的 ControlNet union 配置,受当前单个 ControlNet 限制。

默认 []

图像生成期间应用的 IP-Adapter。

默认 []

图像生成期间应用的 EasyControl 输入。

引导生成并可为遮罩区域提供内容的输入图像。

POST /run/flux-general?wait=20 报价 → $0.30
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://vit.doitong.com/api/v1/run/flux-general?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://vit.doitong.com/api/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

运行此请求

你的密钥会保留在此浏览器中:仅发送到 Doitong API;只有勾选“记住”后才会保存到 localStorage。 获取 API 密钥

关于 FLUX.1 [dev] with Controlnets and Loras

根据 `prompt` 生成图像,并支持多种条件控制方式:`loras`、`control_loras`、`controlnets`、`controlnet_unions`、`ip_adapters` 和 `easycontrols`,以及用于蒙版区域的 `fill_image`。还支持 `reference_image_url`、负面提示词,以及 euler 或 dpmpp_2m 调度器选择。每次调用最多生成 10 张图像,格式为 png 或 jpeg。

参数

发送规范名称或原生名称之一,不要同时发送两者。 规范名称

名称类型 默认值允许值 描述
prompt必填
类型string
指导图像生成的提示词。
image_size可选
类型object
square_hdsquareportrait_4_3portrait_16_9landscape_4_3landscape_16_9
生成图像的尺寸。
num_inference_steps可选
类型integer
默认值28
1 – 50
要执行的推理步数。
seed可选
类型integer | null
用于生成可复现图像的种子:模型版本不变时,相同的提示词和种子会生成相同图像。
loras可选
类型object[]
默认值[]
其组合效果用于生成图像的 LoRA,数量不限。
loras[].path必填
类型string
LoRA 权重的位置,以 URL 或路径指定。
loras[].scale可选
类型object | number
默认值1
合并到基础模型前应用于 LoRA 权重的缩放。提供形如 {"layer_name":layer_scale} 的字典可设置单独的层缩放;未指定的层使用 1.0。
control_loras可选
类型object[]
默认值[]
合并为组合配置、用于生成最终图像的控制图像 LoRA;数量不限。
control_loras[].path必填
类型string
LoRA 权重的位置,以 URL 或路径指定。
control_loras[].scale可选
类型object | number
默认值1
合并到基础模型前应用于 LoRA 权重的缩放。提供形如 {"layer_name":layer_scale} 的字典可设置单独的层缩放;未指定的层使用 1.0。
control_loras[].control_image_url必填
类型url · image
提供控制图像的图像 URL。
control_loras[].preprocess可选
类型enum
默认值None
cannydepthNone
应用于所提供图像的预处理方法。
controlnets可选
类型object[]
默认值[]
用于图像生成的 ControlNet 配置,目前仅限单个 ControlNet。
controlnets[].path必填
类型string
ControlNet 权重位置,可指定为 URL 或路径。
controlnets[].config_url可选
类型string | null
可选的 URL,指向 ControlNet 的 config.json 文件。
controlnets[].variant可选
类型string | null
与 Hugging Face 仓库键配合使用的可选变体。
controlnets[].control_image_url必填
类型url · image
提供控制图像的图像 URL。
controlnets[].mask_image_url可选
类型url · image
与控制图像关联的遮罩 URL。
controlnets[].mask_threshold可选
类型number
默认值0.5
0.01 – 0.99
遮罩阈值。
controlnets[].conditioning_scale可选
类型number
默认值1
0 – 2
合并到基础模型前应用于 ControlNet 权重的缩放。
controlnets[].start_percentage可选
类型number
默认值0
0 – 1
ControlNet 开始影响图像生成时所处的总时间步百分比。
controlnets[].end_percentage可选
类型number
默认值1
0 – 1
ControlNet 停止影响图像生成时所处的总时间步百分比。
controlnet_unions可选
类型object[]
默认值[]
用于图像生成的 ControlNet union 配置,受当前单个 ControlNet 限制。
controlnet_unions[].path必填
类型string
ControlNet 权重位置,可指定为 URL 或路径。
controlnet_unions[].config_url可选
类型string | null
可选的 URL,指向 ControlNet 的 config.json 文件。
controlnet_unions[].variant可选
类型string | null
与 Hugging Face 仓库键配合使用的可选变体。
controlnet_unions[].controls必填
类型object[]
提供给 ControlNet 的控制图像及其关联模式。
controlnet_unions[].controls[].control_image_url必填
类型url · image
提供控制图像的图像 URL。
controlnet_unions[].controls[].mask_image_url可选
类型url · image
与控制图像关联的遮罩 URL。
controlnet_unions[].controls[].control_mode必填
类型enum
cannytiledepthblurposegraylow-quality
Flux Controlnet Union 使用的控制模式。选项:canny 使用边缘引导生成;tile 使用图块引导;depth 使用灰度深度图引导;blur 模糊图像;pose 使用图像姿态引导生成;gray 将图像转为灰度;low-quality 生成低质量版本的图像。
controlnet_unions[].controls[].conditioning_scale可选
类型number
默认值1
0 – 2
合并到基础模型前应用于 ControlNet 权重的缩放。
controlnet_unions[].controls[].mask_threshold可选
类型number
默认值0.5
0.01 – 0.99
遮罩阈值。
controlnet_unions[].controls[].start_percentage可选
类型number
默认值0
0 – 1
ControlNet 开始影响图像生成时所处的总时间步百分比。
controlnet_unions[].controls[].end_percentage可选
类型number
默认值1
0 – 1
ControlNet 停止影响图像生成时所处的总时间步百分比。
ip_adapters可选
类型object[]
默认值[]
图像生成期间应用的 IP-Adapter。
ip_adapters[].path必填
类型string
IP-Adapter 在 Hugging Face 上的位置。
ip_adapters[].subfolder可选
类型string | null
包含 ip_adapter 权重的子文件夹。
ip_adapters[].weight_name可选
类型string | null
IP-Adapter 权重的 Safetensors 文件名。
ip_adapters[].image_encoder_path必填
类型string
IP-Adapter 图像编码器的位置,例如 'openai/clip-vit-large-patch14'。
ip_adapters[].image_encoder_subfolder可选
类型string | null
包含图像编码器权重的子文件夹。
ip_adapters[].image_encoder_weight_name可选
类型string | null
图像编码器名称。
ip_adapters[].image_url必填
类型url · image
提供给 IP-Adapter 的条件图像 URL。
ip_adapters[].mask_image_url可选
类型url · image
与控制图像关联的遮罩 URL。
ip_adapters[].mask_threshold可选
类型number
默认值0.5
0.01 – 0.99
遮罩阈值。
ip_adapters[].scale必填
类型number
IP-Adapter 缩放因子。
easycontrols可选
类型object[]
默认值[]
图像生成期间应用的 EasyControl 输入。
easycontrols[].control_method_url必填
类型string
控制方法的 safetensor 权重 URL,或受支持的标识符:`canny`、`depth`、`hedsketch`、`inpainting`、`pose`、`seg`、`subject`、`ghibli`。
easycontrols[].scale可选
类型number
默认值1
0 – 2
控制方法缩放因子。
easycontrols[].image_url必填
类型url · image
提供控制输入的图像 URL。
easycontrols[].image_control_type必填
类型enum
subjectspatial
图像控制模式;接受 `spatial` 或 `subject`。
fill_image可选
类型object
引导生成并可为遮罩区域提供内容的输入图像。
fill_image.fill_image_url可选
类型url · image
默认值[]
用于通过 redux 提示词填充的图像 URL。
guidance_scale可选
类型number
默认值3.5
0 – 20
图像选择对提示词的遵循强度,以 CFG(Classifier Free Guidance)表示。
real_cfg_scale可选
类型number
默认值3.5
0 – 5
图像选择对提示词的遵循强度,以 CFG(Classifier Free Guidance)表示。
use_real_cfg可选
类型boolean
默认值false
经典 CFG 开关,与 XLabs IP-Adapter v1 一起使用时自动启用。引导行为与 SD1.5 和 SDXL 等模型一致。
use_cfg_zero可选
类型boolean
默认值false
启用 CFG-zero 初始化采样,说明见 https://arxiv.org/abs/2503.18886。
num_images可选 num_outputs
类型integer
默认值1
1 – 10
设置要生成的图像数量;输出以流式传输时固定为 1。
enable_safety_checker可选
类型boolean
默认值true
安全检查;对于被标记为不安全的图像,返回黑色图像替代。true 启用检查;false 仅对获授权账户禁用检查,未获授权的请求无论如何都会检查。
reference_image_url可选
类型url · image
用于 Reference-Only 引导的图像 URL。
reference_strength可选
类型number
默认值0.65
-3 – 3
reference_only 生成期间参考图像的影响程度;未提供参考图像时,此强度设置无效。
reference_start可选
类型number
默认值0
0 – 1
参考引导起点,占全部时间步的百分比。
reference_end可选
类型number
默认值1
0 – 1
参考引导终点,占全部时间步的百分比。
base_shift可选
类型number
默认值0.5
0.01 – 5
应用于调度时间步的基线偏移。
max_shift可选
类型number
默认值1.15
0.01 – 5
应用于调度时间步的最大偏移。
output_format可选
类型enum
默认值png
jpegpng
结果图像的文件格式。
use_beta_schedule可选
类型boolean
默认值false
控制是否使用 beta sigmas。
sigma_schedule可选
类型string | null
去噪期间使用的 sigma 调度。
scheduler可选
类型enum
默认值euler
eulerdpmpp_2m
去噪期间使用的调度器。
negative_prompt可选
类型string
默认值
默认使用 NAG 处理的负面提示词,用于抑制生成图像中的指定不需要特征。
nag_scale可选
类型number
默认值3
≤ 10> 1
由 NAG scale 控制的负面提示词规避程度:提高该值会使生成图像不那么接近负面描述。
nag_tau可选
类型number
默认值2.5
> 0
用于隐藏状态归一化的 NAG tau 设置;建议保持不变。提高该值会削弱归一化,并可能导致图像意外偏离原图。
nag_alpha可选
类型number
默认值0.25
≤ 1> 0
NAG alpha 设置正面提示词重新引导归一化引导的程度,该引导结合了正面和负面提示词。最终权重在较低设置下使正面提示词影响更大,在较高设置下减少重新引导。
nag_end可选
类型number
默认值0.25
≤ 1> 0
NAG 截止点,占生成步数的比例。NAG 按该初始比例运行后,FLUX 原始注意力处理器接管。
必填 规范名称,也可接受

文件参数接受公开的 https:// URL、最大 10 MB 的 data: URI,或上传文件的 file_url。 文件

输出

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "flux-general",
  "status": "succeeded",
  "created_at": "2026-10-20T12:00:00Z",
  "started_at": "2026-10-20T12:00:02Z",
  "completed_at": "2026-10-20T12:00:09Z",
  "queue_position": null,
  "cost": {
    "credits": 300,
    "usd": "0.30",
    "charged": 300,
    "refunded": 0
  },
  "input": {
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
  },
  "output": {
    "images": [
      {
        "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
        "width": 1024,
        "height": 768,
        "content_type": "image/jpeg"
      }
    ],
    "timings": {},
    "seed": 42,
    "has_nsfw_concepts": [
      false
    ],
    "prompt": "string"
  },
  "outputs": [
    {
      "type": "image",
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
      "content_type": "image/jpeg",
      "file_size": 1843200,
      "width": 1024,
      "height": 768,
      "stored": true
    }
  ],
  "error": null,
  "metrics": {
    "inference_seconds": 6.8
  },
  "urls": {
    "self": "https://vit.doitong.com/api/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://vit.doitong.com/api/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
  }
}
你的文件,由你选择每个 outputs[].url 都是存储中的副本:可永久保存(按 GB-月付费),也可免费保存 7 天,由账户设置或 ?storage= 决定。
每个模型的结构相同图像、视频和音频均包含 type、url、content_type、width、height 和 duration。output 是模型自身的结果对象。
输出字段
images
array of object {url, width, height, content_type}生成图像的文件信息。
timings
object
seed
integer图像生成种子;如果输入未提供种子,则包含随机选择的值,否则重复使用所提供的值。
has_nsfw_concepts
array of boolean指示生成的图像中是否出现 NSFW 概念。
prompt
string图像生成期间使用的提示词。

更多模型:文生图

对于 AI 代理:此页面的 Markdown 版本位于 https://doitong.com/zh/developers/models/flux-general.md. 所有模型和指南: https://doitong.com/developers/llms.txt