FLUX.2 [Klein] 4B: 文生圖
BFL 蒸餾模型。亞秒級速度下的卓越畫質,非常適合實時產生且保證品質。市場推廣將聚焦該模型。
下載工作流程在 Cloud 中試用 API 文件
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
Loading the graph
Open full-size workflow preview從您的程式碼呼叫此模型
以下請求使用與 Playground 相同的已準備節點圖和設定。每次提交都可能啟動付費執行;若提交結果不明,請勿自動重試提交。
1 取得 API 金鑰 ↗
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
需要付費 Cloud 方案與點數。
下載 API JSONAPI 文件 ↗
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"9": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Flux2-Klein",
"images": [
"75:65",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"76": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "An expansive, sun-drenched conservatory perched high within a mist-shrouded redwood canopy during early dawn. In the center, a solitary hedgehog botanist wearing tiny brass spectacles meticulously trims glowing celestial orchids from a weathered wooden stepladder. Warm, dramatic morning sunbeams pierce diagonally through towering arched glass panes, casting sharp volumetric light across polished timber floorboards, scattered botanical parchment charts, and antique brass microscopes. Floating golden pollen and gentle morning haze drift through the air, creating a tranquil, reverent mood. Low-angle distant wide shot captured with a crisp 24mm prime lens, revealing the vast scale of the sunlit greenhouse surrounding the tiny diligent caretaker, with rich ambient warmth and soft atmospheric falloff."
},
"_meta": {
"title": "Prompt"
}
},
"75:61": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"75:62": {
"class_type": "Flux2Scheduler",
"inputs": {
"height": [
"75:69",
0
],
"steps": 20,
"width": [
"75:68",
0
]
},
"_meta": {
"title": "Flux2Scheduler"
}
},
"75:63": {
"class_type": "CFGGuider",
"inputs": {
"cfg": 5,
"model": [
"75:70",
0
],
"negative": [
"75:67",
0
],
"positive": [
"75:74",
0
]
},
"_meta": {
"title": "CFG Guider"
}
},
"75:64": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"75:63",
0
],
"latent_image": [
"75:66",
0
],
"noise": [
"75:73",
0
],
"sampler": [
"75:61",
0
],
"sigmas": [
"75:62",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"75:65": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"75:64",
0
],
"vae": [
"75:72",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"75:66": {
"class_type": "EmptyFlux2LatentImage",
"inputs": {
"batch_size": 1,
"height": [
"75:69",
0
],
"width": [
"75:68",
0
]
},
"_meta": {
"title": "Empty Flux 2 Latent"
}
},
"75:67": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"75:71",
0
],
"text": ""
},
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"75:68": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 1344
},
"_meta": {
"title": "Width"
}
},
"75:69": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 768
},
"_meta": {
"title": "Height"
}
},
"75:70": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "flux-2-klein-base-4b.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"75:71": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_3_4b.safetensors",
"device": "default",
"type": "flux2"
},
"_meta": {
"title": "Load CLIP"
}
},
"75:72": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "flux2-vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"75:73": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 0
},
"_meta": {
"title": "RandomNoise"
}
},
"75:74": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"75:71",
0
],
"text": [
"76",
0
]
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)
for output in job.get_outputs("9"):
output.to_file(output.name)試試範例
關於此工作流程
這個 ComfyUI 工作流程「FLUX.2 [Klein] 4B:文字轉圖像」運用 BFL 精煉模型,能以極快速度將文字提示轉換為高品質圖像。流程設計可在亞秒級時間內產生優異畫質,非常適合需要即時圖像生成的應用。核心採用 Flux 與 FLUX.2 Klein 模型,以高效率與精準度著稱。
技術上,流程包含 SaveImage 節點(輸出生成圖像)、PrimitiveStringMultiline 節點(處理文字輸入)、MarkdownNote 節點(嵌入說明與備註)。ID 為 '7b34ab90-36f9-45ba-a665-71d418f0df18' 的節點負責將文字輸入經 Qwen 3.4B 編碼器處理,這對於理解與轉譯文字描述為視覺內容至關重要。此流程特別適合需要快速產生圖像又不想犧牲品質的使用者,例如行銷或動態內容創作場景。
問答
此模型設計高效,能在亞秒級時間內產生高品質圖像,非常適合即時應用。
雖然流程已最佳化速度,建議使用現代 GPU 以獲得最佳效能與即時體驗。
可以,PrimitiveStringMultiline 節點允許你輸入自訂提示,產生多樣風格與主題的圖像。
請輸入清楚且具體的文字提示,並確認已正確載入與設定所需模型,以獲得最佳效果。
相關工作流程
- Flux.2 Dev, Flux
Create a product mockup
- Flux, Flux.2
BFL FLUX.2 [max]: 物體替換
- CChroma, Flux
Chroma: 文生圖
- Flux
FLUX 3 Image Klein Distilled: Image Edit
- Flux
FLUX 3 Image Klein Distilled: Text to Image
- Flux
FLUX 3 Image Klein: Image Edit
- Flux
FLUX 3 Image Klein: Text to Image
- Flux
FLUX 3 影片:文字轉影片
- Flux
FLUX 3 影片:文字轉影片
- Flux.1 Kontext, Flux
Flux Kontext Dev 圖像編輯
- Flux
FLUX 虛擬試穿
- Flux, Flux.1
Flux.1 [專業版]:文生圖