seedinteger
The seed to use for the generation. If not provided, a random seed will be used.
bfl/flux-2/flash/editFlux 2 Flash Edit is BFL's intelligent image editing model. Transform, retouch, and reimagine existing images using text prompts - from background replacement to artistic style conversion.
试用该模型
PNG, JPEG, WebP, or GIF · 20 MiB maximum each
选择一个示例,将其输入和结果加载到 playground 中。
{
"prompt": "Remove the meat from the hamburger"
}人类偏好
基于盲测两两对比投票的 Elo 评分,与其他图像和视频模型进行比较。
图像编辑 arena:在不看到模型名称的情况下,用户从同一图像和指令的两种编辑结果中选出更优的一种。
FLUX.2 Flash, the fastest, lowest-cost FLUX.2 variant. Edit or combine images with an instruction.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Text instruction. |
images | image URL[] | — | Images to edit or combine, Image 1, Image 2, … |
guidance_scale | number 0–20 | 2.5 | How strictly to follow the prompt. |
output_format | jpeg / png | png | Output file format. |
aspect_ratio | 21:9 / 16:9 / 3:2 / 4:3 / 5:4 / 1:1 / 4:5 / 3:4 / 2:3 / 9:16 | — | Output shape. |
seed | integer | random | Fix it to compare prompt changes. |
$0.03 per output image, plus $0.005 for each input image after the first.
| Inputs | Price |
|---|---|
| 1 input image | $0.03 |
| 2 input images | $0.035 |
| 4 input images | $0.045 |
Failed runs are not charged.
Other FLUX.2 endpoints: bfl/flux-2/max/edit, bfl/flux-2/pro/edit, bfl/flux-2/flex/edit, bfl/flux-2/dev/edit, bfl/flux-2/flash.
开始构建
通过 SandBase Unified Run API 提交此模型。
# The quoted heredoc keeps Unicode and shell metacharacters unchanged.
result=$(curl --fail-with-body --silent \
-X POST "https://api.sandbase.ai/v1/run" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'SANDBASE_JSON'
{
"model": "bfl/flux-2/flash/edit",
"images": [
"https://static.sandbase.ai/examples/bfl/flux-2/flash/edit/output_url_0.png"
],
"prompt": "Remove the meat from the hamburger",
"output_format": "png",
"guidance_scale": 2.5
}
SANDBASE_JSON
)
run_id=$(printf '%s' "$result" | jq -r .id)
for attempt in $(seq 1 120); do
status=$(printf '%s' "$result" | jq -r .status)
case "$status" in completed|failed|timeout) break ;; esac
sleep 2
result=$(curl --fail-with-body --silent \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
"https://api.sandbase.ai/v1/run/$run_id")
done
status=$(printf '%s' "$result" | jq -r .status)
[ "$status" = completed ] || { echo "Generation ended: $status" >&2; exit 1; }
printf '%s\n' "$result"创建一个 SandBase API 密钥,并将其设置到服务器环境中。所有请求都使用 Bearer 身份验证。
export SANDBASE_API_KEY="YOUR_API_KEY"请将密钥保存在服务器端。不要在浏览器代码中暴露它,也不要提交到仓库。
使用此模型 ID 及其输入向 /v1/run 发送 POST 请求。上方的请求示例包含提交和轮询。
使用返回的运行 ID 轮询,直到状态为 completed、failed 或 timeout。仅在 completed 后读取输出。
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"在模型的 image、video 或 audio 字段中传入一个可公开访问的文件 URL。支持的格式和限制显示在每个 Playground 输入项旁边。
在 Playground 中支持的图片字段上使用上传或替换控件。视频 URL 字段接受托管的 driving video;这并不表示支持视频上传。
seedintegerThe seed to use for the generation. If not provided, a random seed will be used.
imagesarrayThe URLs of the images for editing. A maximum of 4 images are allowed, if more are provided, only the first 4 will be used.
promptstring必填The prompt to edit the image.
aspect_ratiostringThe aspect ratio of the generated image.
可选值:"21:9", "16:9", "3:2", "4:3", "5:4", "1:1", "4:5", "3:4", "2:3", "9:16"
output_formatstringThe format of the generated image.
默认值:"png"
可选值:"jpeg", "png"
guidance_scalenumberGuidance Scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
默认值:2.5
最小值:0
最大值:20
{
"model": "bfl/flux-2/flash/edit",
"images": [
"https://static.sandbase.ai/examples/bfl/flux-2/flash/edit/output_url_0.png"
],
"prompt": "Remove the meat from the hamburger",
"output_format": "png",
"guidance_scale": 2.5
}已完成的运行会在输出中展示结果。以下内容是该模型保存的示例,而不是新的生成结果。
[
{
"source": "BFL/FLUX schema mirror",
"source_url": "https://docs.bfl.ai/flux_2/flux2_overview",
"url": "https://static.sandbase.ai/examples/cd008e59-0aab-4dc0-985d-24d220d7579d/output/af4eb736-e4b2-403b-8e66-9e30533ab4cf.png"
}
]