Flux 2 Klein API
Black Forest Labs FLUX.2 [klein]——高质量的 4B 和 9B 文生图及编辑模型,真实感更强、文字生成更清晰,并支持 LoRA 以便快速定制。生成和编辑均提供基础版和 LoRA 变体。
文生图和编辑均提供 4B 和 9B 参数档位。支持 LoRA 的变体(text-to-image-lora、edit-lora)可实现快速定制。编辑端点接受自然语言指令,进行精确修改。
/filters:quality(82)/examples/171cf1aac2374b34dc5104be9b274f5c/1783683809472857164_TpbltDLU.webp)
概览
关于 Flux 2 Klein API
Flux 2 Klein 能做什么、它在 Black Forest Labs 模型阵容中的定位,以及团队选择它的原因。
Flux 2 Klein 是 Black Forest Labs 推出的图像生成与编辑模型,可通过 WaveSpeedAI REST API 使用。Black Forest Labs FLUX.2 [klein]——高质量的 4B 和 9B 文生图及编辑模型,真实感更强、文字生成更清晰,并支持 LoRA 以便快速定制。生成和编辑均提供基础版和 LoRA 变体。
文生图和编辑均提供 4B 和 9B 参数档位。支持 LoRA 的变体(text-to-image-lora、edit-lora)可实现快速定制。编辑端点接受自然语言指令,进行精确修改。
WaveSpeedAI 上的 Flux 2 Klein 系列提供 16 个 REST 端点,涵盖 Image-To-Image, Text-To-Image 个工作流。每个变体都有各自的定价、参数选项和示例输出——请选择与你的输入模态和生产约束相匹配的那一个,或使用同一个 API 密钥调用多个变体,组合成多步骤流水线。
使用与 WaveSpeedAI 上其他 1,000 多个 AI 模型相同的 API 密钥、账单账户和速率限制来运行 Flux 2 Klein。无需单独对接供应商,无需各家 SDK,也无需应对各家不同的速率限制——一次集成即可覆盖从文生图、文生视频到音频合成、3D 生成、放大和编辑的全部能力。
端点
全部 Flux 2 Klein API 端点
WaveSpeedAI 现已提供 16 个 Flux 2 Klein 端点——请选择适合你工作流的变体。
/filters:quality(82)/media/images/1782719270072146594_r4sCKT3c.webp)
Flux 2 Klein Base 4b Edit Lora
FLUX.2 [klein] Base 4B Edit with LoRA support enables precise image-to-image editing with natural language instructions, multi-reference support, and LoRA customization. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/1782719335346716016_SFOX7gpy.webp)
Flux 2 Klein Base 4b Text To Image Lora
FLUX.2 [klein] Base 4B with LoRA support is a compact 4-billion-parameter text-to-image model that delivers fast generation with quality results and LoRA customization. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/1782719395763490557_HkV4envE.webp)
Flux 2 Klein Base 4b Edit
FLUX.2 [klein] Base 4B Edit enables precise image-to-image editing with natural language instructions and multi-reference support. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/1782719439857315177_L5f7hrBK.webp)
Flux 2 Klein Base 4b Text To Image
FLUX.2 [klein] Base 4B is a compact 4-billion-parameter text-to-image model that delivers fast generation with quality results. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/1778817893253269754_jtSluDMW.webp)
Flux 2 Klein Base 9b Edit Lora
FLUX.2 [klein] Base 9B Edit with LoRA support is a high-quality image editing model with 9B parameters, offering precise modifications using natural language instructions and personalized styles via custom LoRA adapters. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/1778817876606439425_xAlRlNgH.webp)
Flux 2 Klein Base 9b Text To Image Lora
FLUX.2 [klein] Base 9B with LoRA support is a high-quality text-to-image model with 9B parameters, offering enhanced realism, crisper text generation, and fast LoRA customization. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/1778817863672548628_rWNW8fpz.webp)
Flux 2 Klein Base 9b Edit
FLUX.2 [klein] Base 9B Edit is a high-quality image editing model with 9B parameters, offering precise modifications using natural language instructions. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/1778817841762781102_9SipyHR0.webp)
Flux 2 Klein Base 9b Text To Image
FLUX.2 [klein] Base 9B is a high-quality text-to-image model with 9B parameters, offering enhanced realism and crisper text generation. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/20260408105759_4m08lxjt.webp)
Flux 2 Klein 4b Edit Lora
FLUX.2 [klein] 4B Edit with LoRA support enables precise image-to-image editing with natural language instructions, multi-reference support, and LoRA customization. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/20260408105752_entzjhk3.webp)
Flux 2 Klein 4b Text To Image Lora
FLUX.2 [klein] 4B with LoRA support is a compact 4-billion-parameter text-to-image model that delivers fast generation with quality results and LoRA customization. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/20260408110447_b1nzgxbj.webp)
Flux 2 Klein 9b Text To Image Lora
FLUX.2 [klein] 9B with LoRA support is a high-quality text-to-image model with 9B parameters, offering enhanced realism, crisper text generation, and fast LoRA customization. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/20260408110457_1sq5no86.webp)
Flux 2 Klein 9b Edit Lora
FLUX.2 [klein] 9B Edit with LoRA support is a high-quality image editing model with 9B parameters, offering precise modifications using natural language instructions and personalized styles via custom LoRA adapters. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/20260408105808_3tz63pqc.webp)
Flux 2 Klein 4b Edit
FLUX.2 [klein] 4B Edit enables precise image-to-image editing with natural language instructions and multi-reference support. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/20260408110505_n00qc1zm.webp)
Flux 2 Klein 9b Edit
FLUX.2 [klein] 9B Edit is a high-quality image editing model with 9B parameters, offering precise modifications using natural language instructions. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/20260408110512_kl8lhm6d.webp)
Flux 2 Klein 9b Text To Image
FLUX.2 [klein] 9B is a high-quality text-to-image model with 9B parameters, offering enhanced realism and crisper text generation. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
/filters:quality(82)/media/images/20260408105817_vfnx9s7f.webp)
Flux 2 Klein 4b Text To Image
FLUX.2 [klein] 4B is a compact 4-billion-parameter text-to-image model that delivers fast generation with quality results. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.
示例
看看 Flux 2 Klein 的实际效果
由 Flux 2 Klein API 生成的真实输出。悬停在任意视频上即可预览,点击可打开全尺寸查看器。
使用方法
如何使用 Flux 2 Klein API
从注册到完成一次生成,只需四步。完整的 Python、Node.js 和 cURL 示例见下方的 API 部分。
- 01
获取 API 密钥
注册 WaveSpeedAI 账号,并从控制台复制你的 API 密钥。新账号附带免费体验额度——足够在开始计费前把 Playground 运行几十次。
- 02
提交预测
把你的输入以 JSON 形式 POST 到 https://api.wavespeed.ai/api/v3/wavespeed-ai/flux-2-klein-9b/text-to-image。端点会立即返回预测 ID——生成是异步的,因此推理期间你无需保持连接。
- 03
轮询完成状态
GET https://api.wavespeed.ai/api/v3/predictions/{request_id}/result。状态为 completed 时返回输出;状态为 failed、cancelled、timeout 或 deleted 时以错误终止;其他任何状态都继续轮询。
- 04
读取输出 URL
状态变为 "completed" 后,从 data.outputs[0] 读取 URL。该 URL 指向 WaveSpeedAI CDN 上你生成的媒体——具体是图片、视频、音频还是 3D 文件,取决于你调用的 Flux 2 Klein 变体。
应用场景
用 Flux 2 Klein 可以构建什么
开发者和创作者使用 Flux 2 Klein API 的常见工作流。
文字清晰的 9B 文生图
wavespeed-ai/flux-2-klein-9b/text-to-image 是高质量的 9B 文生图模型,真实感增强、文字生成更清晰——是面向交付工作的高保真 Klein 档位。
4B 档位,兼顾速度与成本
wavespeed-ai/flux-2-klein-4b/text-to-image 以 4B 参数提供相同的 Klein 架构——适合不需要 9B 保真度的提示词迭代和大批量流水线。
自然语言图像编辑
wavespeed-ai/flux-2-klein-9b/edit 使用自然语言指令进行精确修改——先生成基础图像,再通过编辑来精修,而不是整体重新生成。
LoRA 定制
text-to-image-lora 和 edit-lora 变体支持快速的 LoRA 定制,保持风格、角色或品牌一致——无需微调基础模型,直接应用训练好的 LoRA 检查点。
增强的真实感
目录宣称:Klein 各变体的真实感均有增强。请在提示词中使用具体的光线、材质和镜头语言,以调用 FLUX 写实的训练成果。
4B 与 9B 档位的选择
4B 和 9B 端点使用相同的提示词格式——先在 4B 上迭代确定方向,再切换到 9B 用于交付。编辑变体也采用相同的档位结构。
技巧
Flux 2 Klein 提示词技巧
让 Flux 2 Klein 输出更好结果的实用建议——总结自生产流水线中各类图像模型都适用的做法。
- 01
用 4B 迭代,用 9B 交付
4B 和 9B 档位的提示词格式相同。用 flux-2-klein-4b 确定提示词方向和做 A/B 测试;需要更清晰的文字和真实感时,切换到 9b 交付。
- 02
精修时使用 edit
先用文生图生成,再用 edit 通过自然语言指令精修——比反复重新生成整张图收敛更快。
- 03
用 LoRA 保持生产一致性
当整个制作流程需要保持固定的风格、角色或品牌身份时,请通过 text-to-image-lora 和 edit-lora 训练或应用 LoRA 检查点。
- 04
提示词中的排版
目录宣称:文字生成更清晰。请把要渲染的确切文字用引号写进提示词——Klein 针对营销创意中的可读排版做了调优。
- 05
结构化提示词胜过套话
主体 + 场景 + 光线 + 镜头语言,最能调用 FLUX 的训练成果。避免笼统的画质修饰词——越具体越有效。
定价
Flux 2 Klein API 定价
按输出计费。最终费用会随你在各变体 Playground 中设置的参数(分辨率、时长、输出数量、参考素材)而变化。
| 端点 | 类型 | 起步价 |
|---|---|---|
| wavespeed-ai/ | image-to-image | $0.02 |
| wavespeed-ai/ | text-to-image | $0.015 |
| wavespeed-ai/ | image-to-image | $0.015 |
| wavespeed-ai/ | text-to-image | $0.01 |
| wavespeed-ai/ | image-to-image | $0.026 |
| wavespeed-ai/ | text-to-image | $0.02 |
| wavespeed-ai/ | image-to-image | $0.021 |
| wavespeed-ai/ | text-to-image | $0.015 |
| wavespeed-ai/ | image-to-image | $0.017 |
| wavespeed-ai/ | text-to-image | $0.013 |
| wavespeed-ai/ | text-to-image | $0.015 |
| wavespeed-ai/ | image-to-image | $0.021 |
| wavespeed-ai/ | image-to-image | $0.012 |
| wavespeed-ai/ | image-to-image | $0.016 |
| wavespeed-ai/ | text-to-image | $0.01 |
| wavespeed-ai/ | text-to-image | $0.008 |
API
调用 Flux 2 Klein API
在 wavespeed.ai/accesskey 注册并获取 API 密钥,然后通过 REST 提交预测。Playground 可以为任意输入组合生成可直接粘贴的示例代码。
POSThttps://api.wavespeed.ai/api/v3/wavespeed-ai/flux-2-klein-9b/text-to-image
# 1. Submit the prediction.
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
-X POST "https://api.wavespeed.ai/api/v3/wavespeed-ai/flux-2-klein-9b/text-to-image" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $WAVESPEED_API_KEY" \
-d '{
"prompt": "A cinematic shot of a city at sunset, soft golden light",
"size": "1024*1024"
}')
TASK=$(printf '%s' "$SUBMIT_RESPONSE" | jq 'if has("data") then .data else . end')
PREDICTION_ID=$(printf '%s' "$TASK" | jq -r '.id')
if [ -z "$PREDICTION_ID" ] || [ "$PREDICTION_ID" = "null" ]; then
printf 'Submission response did not contain a prediction id
' >&2
exit 1
fi
RESULT_URL="https://api.wavespeed.ai/api/v3/predictions/$PREDICTION_ID/result"
# 2. Poll until the prediction finishes.
while true; do
RESPONSE=$(curl --silent --show-error --fail-with-body "$RESULT_URL" \
-H "Authorization: Bearer $WAVESPEED_API_KEY")
RESULT=$(printf '%s' "$RESPONSE" | jq 'if has("data") then .data else . end')
STATUS=$(printf '%s' "$RESULT" | jq -r '.status')
case "$STATUS" in
completed) printf '%s\n' "$RESULT" | jq '.outputs'; break ;;
failed|cancelled|timeout|deleted) printf '%s\n' "$RESULT" | jq . >&2; exit 1 ;;
*) sleep 2 ;;
esac
doneconst submitUrl = "https://api.wavespeed.ai/api/v3/wavespeed-ai/flux-2-klein-9b/text-to-image";
const apiKey = process.env.WAVESPEED_API_KEY;
if (!apiKey) throw new Error('Set WAVESPEED_API_KEY');
async function requestJson(url, options = {}) {
const response = await fetch(url, options);
if (!response.ok) throw new Error(await response.text());
return response.json();
}
// 1. Submit the prediction.
const body = await requestJson(submitUrl, {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"prompt": "A cinematic shot of a city at sunset, soft golden light",
"size": "1024*1024"
}),
});
const task = body.data ?? body;
const resultUrl = `https://api.wavespeed.ai/api/v3/predictions/${task.id}/result`;
// 2. Poll until the prediction finishes.
while (true) {
const resultBody = await requestJson(resultUrl, {
headers: { "Authorization": `Bearer ${apiKey}` },
});
const result = resultBody.data ?? resultBody;
if (result.status === "completed") {
console.log(result.outputs);
break;
}
if (["failed", "cancelled", "timeout", "deleted"].includes(result.status)) throw new Error(JSON.stringify(result));
await new Promise(resolve => setTimeout(resolve, 2000));
}import json
import os
import time
from urllib.request import Request, urlopen
api_key = os.environ["WAVESPEED_API_KEY"]
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
payload = {
"prompt": "A cinematic shot of a city at sunset, soft golden light",
"size": "1024*1024"
}
def request_json(url, data=None):
request = Request(url, data=data, headers=headers, method="POST" if data else "GET")
with urlopen(request) as response:
return json.load(response)
# 1. Submit the prediction.
body = request_json("https://api.wavespeed.ai/api/v3/wavespeed-ai/flux-2-klein-9b/text-to-image", json.dumps(payload).encode())
task = body.get("data", body)
result_url = f"https://api.wavespeed.ai/api/v3/predictions/{task['id']}/result"
# 2. Poll until the prediction finishes.
while True:
result_body = request_json(result_url)
result = result_body.get("data", result_body)
status = result.get("status")
if status == "completed":
print(result.get("outputs", []))
break
if status in {"failed", "cancelled", "timeout", "deleted"}:
raise RuntimeError(result)
time.sleep(2)对比
Flux 2 Klein 与其他方案对比
在 WaveSpeedAI 上,何时应选择 Flux 2 Klein 而不是同类模型。
Flux 2 Klein 对比 Seedream 5 Lite
Seedream 5 Lite 强调排版,并提供用于多图一致性的 Sequential 变体。Flux 2 Klein 原生支持 LoRA 定制,在 FLUX 架构中提供更清晰的文字生成,单次调用成本具有竞争力。
Flux 2 Klein 对比 GPT Image 2
GPT Image 2 有明确的质量档位(low/medium/high)和参考图像编辑。Flux 2 Klein 提供专用的 LoRA 端点以及 4B/9B 规模档位,用于在成本与质量之间取舍。
Flux 2 Klein 对比 Qwen Image
Qwen Image 涵盖多图 Edit-Plus、镜头角度和分层合成。Flux 2 Klein 则专注于高质量文生图和支持 LoRA 的自然语言编辑——范围更简洁,真实感出色。
常见问题
Flux 2 Klein API — 常见问题
定价、许可、集成——关于在 WaveSpeedAI 上运行 Flux 2 Klein 的常见问题。
Flux 2 Klein API 是什么?
Flux 2 Klein 是 Black Forest Labs 的图像生成模型,在 WaveSpeedAI 上以 REST API 形式提供。Black Forest Labs FLUX.2 [klein]——高质量的 4B 和 9B 文生图及编辑模型,真实感更强、文字生成更清晰,并支持 LoRA 以便快速定制。生成和编辑均提供基础版和 LoRA 变体。你可以通过编程方式调用它,也可以在上方链接的 Playground 中试用。
如何调用 Flux 2 Klein API?
注册 WaveSpeedAI 账号,从 /accesskey 复制你的 API 密钥,然后把输入以 JSON 形式 POST 到 https://api.wavespeed.ai/api/v3/wavespeed-ai/flux-2-klein-9b/text-to-image。端点会返回预测 ID。从大约每 2 秒一次开始轮询结果端点,长耗时任务可适当拉长间隔,并在任何终止状态时停止。上方有面向生产环境的 Python / Node.js / cURL 示例。
Flux 2 Klein API 的费用是多少?
Flux 2 Klein 每次调用 $0.008 起。实际费用会随你设置的参数(分辨率、时长、输出数量、参考素材)而变化。Playground 中“生成”按钮旁的实时费用预览会显示你当前输入对应的准确价格。
有哪些 Flux 2 Klein 变体可用?
WaveSpeedAI 托管了 16 个已上线的 Flux 2 Klein 端点:wavespeed-ai/flux-2-klein-base-4b/edit-lora, wavespeed-ai/flux-2-klein-base-4b/text-to-image-lora, wavespeed-ai/flux-2-klein-base-4b/edit, wavespeed-ai/flux-2-klein-base-4b/text-to-image, wavespeed-ai/flux-2-klein-base-9b/edit-lora, wavespeed-ai/flux-2-klein-base-9b/text-to-image-lora, wavespeed-ai/flux-2-klein-base-9b/edit, wavespeed-ai/flux-2-klein-base-9b/text-to-image等。每个变体都有自己的 Playground 页面和定价。
Flux 2 Klein 的输出可以商用吗?
商用权利遵循 Black Forest Labs 的模型许可。大多数 Black Forest Labs 模型允许商用输出;具体许可摘要请查看各模型的 Playground 页面,平台层面的条件请参阅 WaveSpeedAI 的服务条款。
为什么要在 WaveSpeedAI 上使用 Flux 2 Klein,而不是直接对接?
一个 API 密钥、一个账单账户,即可使用 Flux 2 Klein 以及来自其他提供方的 1,000 多个 AI 模型。无需逐家配置 SDK,无需应对各自独立的速率限制,也无需为每家重写集成代码。价格通常与 Black Forest Labs 直接提供的 API 持平或更低。
提供方
关于 Black Forest Labs
Flux 2 Klein 及 WaveSpeedAI 上 Black Forest Labs 更多模型背后的团队。
Black Forest Labs 创造了 FLUX 系列开放权重图像模型。FLUX.2 [klein] 提供 4B 和 9B 的文生图及编辑端点,真实感增强、文字渲染更清晰,并原生支持 LoRA——是大批量图像流水线中较大 FLUX 变体的高性价比替代方案。
在 WaveSpeedAI 上用 Flux 2 Klein 开始构建
注册即送免费体验额度。一个 API 密钥,即可使用来自 Black Forest Labs 及其他所有提供方的 1,000 多个 AI 模型。
/filters:quality(82)/examples/5c90a7890cbd39ca11d17dc1216ff484/1783683875315920517_jTDMV4dn.webp)
/filters:quality(82)/examples/6d616d34f5de1126c1a1fa4d75c28c92/1783683876694736715_B5GQZ8hr.webp)
/filters:quality(82)/examples/749de35a5d58f586fa821a9646a601d2/1783683879735484148_hpocZ7VJ.webp)
/filters:quality(82)/examples/3026f17d8160ff37791c6fe203407579/1783683883679666545_jXENW6fo.webp)