Skip to content

非公式本サイトは非公式の日本語ドキュメントであり、Cloudflare 公式サイトではありません。最新情報はdevelopers.cloudflare.comをご確認ください。

Black Forest Labs のロゴ

FLUX.2 [flex]

テキストから画像 • Black Forest Labs

Markdown で表示Agent セットアップ
  • サードパーティ

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 です。
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 です

API スキーマ(Raw)

Input
Output

役に立ちましたか?