Skip to content

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

Black Forest Labs のロゴ

FLUX.2 [pro]

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

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

FLUX.2 [pro] Preview は、本番の画像生成・編集向けに Black Forest Labs が推奨するデフォルトモデルです。最新の [pro] 重みに追従し、複数参照にも強く対応します。

モデル情報
利用規約とライセンスリンク
詳細情報リンク
料金Cloudflare ダッシュボードで料金を見る

使い方

const response = await env.AI.run(
  'black-forest-labs/flux-2-pro-preview',
  {
    prompt:
      'A serene mountain landscape at golden hour, soft diffused light filtering through clouds',
    height: 1024,
    width: 1024,
  },
)
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-pro-preview",
  "input": {
    "prompt": "A serene mountain landscape at golden hour, soft diffused light filtering through clouds",
    "height": 1024,
    "width": 1024
  }
}'
簡単なプロンプト
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-2-pro-preview/simple-prompt.jpeg"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

複数参照の編集 — 複数参照の編集です。2 枚の参照画像を 1 つの構図に組み合わせます
const response = await env.AI.run(
  'black-forest-labs/flux-2-pro-preview',
  {
    prompt: 'Combine the subjects of these images into a single editorial fashion scene',
    input_images: [
      'https://replicate.delivery/xezq/jCypj4MeXYUiRyq7nfgm8z1OvFZF81wh4FznutDsZOuJz0YWA/tmp1iukn307.jpg',
      'https://replicate.delivery/xezq/0lxxNQSg3NabCZrDiQVAPGVmjP1Q2dd7TgYCOTfI9LpyZaMLA/tmp89gopylq.jpg',
    ],
  },
)
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-pro-preview",
  "input": {
    "prompt": "Combine the subjects of these images into a single editorial fashion scene",
    "input_images": [
      "https://replicate.delivery/xezq/jCypj4MeXYUiRyq7nfgm8z1OvFZF81wh4FznutDsZOuJz0YWA/tmp1iukn307.jpg",
      "https://replicate.delivery/xezq/0lxxNQSg3NabCZrDiQVAPGVmjP1Q2dd7TgYCOTfI9LpyZaMLA/tmp89gopylq.jpg"
    ]
  }
}'
複数参照の編集
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-2-pro-preview/multi-reference-editing.jpeg"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}
再現可能な PNG 出力 — 後段の編集パイプライン向けに、シード付きで PNG 出力します
const response = await env.AI.run(
  'black-forest-labs/flux-2-pro-preview',
  { prompt: 'A pastel watercolor of a koi pond at sunrise', output_format: 'png', seed: 1337 },
)
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-pro-preview",
  "input": {
    "prompt": "A pastel watercolor of a koi pond at sunrise",
    "output_format": "png",
    "seed": 1337
  }
}'
再現可能な PNG 出力
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-2-pro-preview/reproducible-png-output.png"
  },
  "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 です。
image
stringformat: uri生成された画像の URL です

API スキーマ(Raw)

Input
Output

役に立ちましたか?