promptstring必須
The prompt to generate an image from.
bfl/flux-3.1/text-to-imageFLUX 3.1 by Black Forest Labs generates images from a text prompt, with optional bounding boxes for layout control, at 1K to 4K resolution tiers. Quality mode is best for typography and fine detail.
モデルを試す
例を選択すると、その入力と結果がプレイグラウンドに読み込まれます。
{
"aspect_ratio": "16:9",
"bounding_boxes": [
{
"box": {
"x_max": 0.75,
"x_min": 0.3,
"y_max": 0.55,
"y_min": 0.05
},
"description": "a large red umbrella",
"label": "umbrella"
},
{
"box": {
"x_max": 0.66,
"x_min": 0.42,
"y_max": 0.95,
"y_min": 0.45
},
"description": "a red fox sitting, looking at the camera",
"label": "fox"
}
],
"prompt": "A red fox <fox> sits under a red umbrella <umbrella> on a rainy cobblestone street at dusk, cinematic photograph"
}{
"aspect_ratio": "16:9",
"prompt": "A minimalist poster for a jazz night: the words \"BLUE NOTE FRIDAYS\" in bold cream letters above a saxophone silhouette, deep navy background, risograph texture"
}{
"aspect_ratio": "16:9",
"prompt": "A red fox leaping over a stream in a pine forest at dawn, low-angle wildlife photograph"
}FLUX 3.1 by Black Forest Labs generates images from a text prompt, with optional bounding boxes for layout control, at 1K to 4K resolution tiers. Quality mode is best for typography and fine detail.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Text instruction. |
resolution | 1k2k4k | 1k | Size tier; sets the per-image rate. |
aspect_ratio | 21:916:93:24:35:41:14:53:42:39:16 | — | Output shape. |
output_format | jpeg / png | jpeg | Output file format. |
bounding_boxes | object[] | — | Optional layout boxes, with (0, 0) at the top-left. Place objects in given regions. Each box has a description, an optional label, and edges {x_min, y_min, x_max, y_max} as 0-1 fractions; Write <label> in the prompt to tie it to a box. |
BFL's official per-image price for FLUX 3.1 Image Quality: $0.03 at 1K, $0.06 at 2K, $0.28 at 4K.
| Request | 1k | 2k | 4k |
|---|---|---|---|
| One image | $0.03 | $0.06 | $0.28 |
Failed runs are not charged.
Other FLUX 3.1 endpoints: bfl/, bfl/, bfl/. Previous generation: bfl/, bfl/.
開発を始める
このモデルを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-3.1/text-to-image",
"prompt": "A red fox leaping over a stream in a pine forest, low-angle wildlife photograph.",
"resolution": "1k",
"output_format": "jpeg"
}
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してください。上のリクエスト例には送信とポーリングが含まれています。
返されたrun 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の対応する画像フィールドでアップロードまたは置換を使用してください。video URLフィールドはホストされたドライビング動画を受け付けますが、動画アップロード対応を意味するものではありません。
promptstring必須The prompt to generate an image from.
resolutionstringOutput resolution tier.
デフォルト: "1k"
指定可能な値: "1k", "2k", "4k"
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.
デフォルト: "jpeg"
指定可能な値: "jpeg", "png"
bounding_boxesarrayOptional layout: draw each described object inside its box. Box edges are fractions of the image size, with (0, 0) at the top-left. Name boxes in the prompt by label, e.g. `A red fox <fox> sits under a red umbrella <umbrella>`.
{
"model": "bfl/flux-3.1/text-to-image",
"prompt": "A red fox leaping over a stream in a pine forest, low-angle wildlife photograph.",
"resolution": "1k",
"output_format": "jpeg"
}完了したrunの結果は出力に表示されます。以下はモデルに保存されたサンプルであり、新規生成ではありません。
[
{
"url": "https://static.sandbase.ai/examples/4f65adff-fc1c-4ab4-88c8-a54b0b4b9e83/output/335fcc25-593f-4c89-8df0-0d134647eb6d.jpg"
}
]