- サードパーティ
FLUX.2 [flex] は、Black Forest Labs の FLUX.2 の細かい制御向けバリアントです。推論ステップ、guidance、プロンプトアップサンプリングを調整でき、タイポグラフィ重視や本番ワークフローに適しています。
| モデル情報 | |
|---|---|
| 利用規約とライセンス | リンク ↗ |
| 詳細情報 | リンク ↗ |
| 料金 | Cloudflare ダッシュボードで料金を見る ↗ |
const response = await env.AI.run(
'black-forest-labs/flux-2-flex',
{
prompt:
"Samsung Galaxy S25 Ultra product advertisement, 'Ultra-strong titanium' headline, close-up of phone edge showing titanium frame, dark gradient background, clean minimalist tech aesthetic",
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "black-forest-labs/flux-2-flex",
"input": {
"prompt": "Samsung Galaxy S25 Ultra product advertisement, '\''Ultra-strong titanium'\'' headline, close-up of phone edge showing titanium frame, dark gradient background, clean minimalist tech aesthetic"
}
}'
{
"state": "Completed",
"result": {
"image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-2-flex/typography-design.jpeg"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}高詳細の生成 — レイテンシより詳細を優先し、ステップとガイダンスを最大にします
const response = await env.AI.run(
'black-forest-labs/flux-2-flex',
{
prompt: 'A detailed oil painting portrait of a Renaissance nobleman with intricate lace collar',
guidance: 7.5,
steps: 50,
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "black-forest-labs/flux-2-flex",
"input": {
"prompt": "A detailed oil painting portrait of a Renaissance nobleman with intricate lace collar",
"guidance": 7.5,
"steps": 50
}
}'
{
"state": "Completed",
"result": {
"image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-2-flex/high-detail-generation.jpeg"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}高速下書き — プロンプトのアップサンプリングを無効にした高速下書きです。プロンプトの文言をそのまま保ちます
const response = await env.AI.run(
'black-forest-labs/flux-2-flex',
{ prompt: 'A simple line sketch of a mountain landscape', prompt_upsampling: false, steps: 10 },
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "black-forest-labs/flux-2-flex",
"input": {
"prompt": "A simple line sketch of a mountain landscape",
"prompt_upsampling": false,
"steps": 10
}
}'
{
"state": "Completed",
"result": {
"image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-2-flex/fast-draft.jpeg"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}prompt
string必須画像の生成または編集用のテキストプロンプトです。seed
integerminimum: -9007199254740991maximum: 9007199254740991生成結果を再現するための任意のシードです。width
integerminimum: 64maximum: 9007199254740991生成画像の幅(ピクセル、最小 64)です。省略すると BFL が選びます。height
integerminimum: 64maximum: 9007199254740991生成画像の高さ(ピクセル、最小 64)です。省略すると BFL が選びます。safety_tolerance
integerminimum: 0maximum: 5入力/出力モデレーションの許容度です。0 が最も厳しく、5 が最も緩いです。デフォルトは 2 です。output_format
stringenum: jpeg, png, webp出力画像の形式です。デフォルトは jpeg です。▶input_images[]
arraymaxItems: 8編集や複数画像の合成に使う参照画像です。最大 8 枚です。各要素は HTTPS URL、または `data:image/...;base64,...` URI です。prompt_upsampling
boolean生成前に BFL が短いプロンプトを展開するかどうかです。flex ではデフォルトは true です。guidance
numberminimum: 1.5maximum: 10Classifier-free guidance のスケールです(1.5〜10)。値が高いほどプロンプトに厳密に従いますが、リアリティは下がります。steps
integerminimum: 1maximum: 50デノイズのステップ数です(1〜50)。多いほど詳細は増えますが、レイテンシも増えます。image
stringformat: uri生成された画像の URL です