OPENCLAW + FLUX 2

在 OpenClaw 中使用 Flux 2。

Black Forest Labs 的 Flux 2 提供兩種品質層級 — Pro 以每張 5 美分快速生成,Flex 產出更高保真度的輸出。兩者都支援文生圖和多來源 remix,可選 1k 或 2k 解析度。OpenClaw agent 透過與聊天相同的 RunAPI key 呼叫。

一個 API key · 文生圖 + remix 端點 · 1k / 2k 解析度
Use RunAPI to generate an image with Flux 2 Pro.

Requirements:
- Call the RunAPI text_to_image endpoint at https://runapi.ai/v1/text_to_image
- Set model to "flux-2-pro-text-to-image"
- Use the RUNAPI_API_KEY environment variable for authorization
- Optionally set output_resolution to "1k" or "2k" and aspect_ratio to control dimensions
- The response is async — poll the task status endpoint until the task completes, then retrieve the image URL
curl -X POST https://runapi.ai/v1/text_to_image \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-2-pro-text-to-image",
    "prompt": "a ceramic vase with dried flowers on a linen tablecloth, natural window light, 35mm film grain",
    "aspect_ratio": "3:4",
    "output_resolution": "2k"
  }'
{
  "task_id": "tsk_abc123",
  "status": "pending",
  "model": "flux-2-pro-text-to-image"
}
複製 curl 指令進行測試 flux-2
運作原理

三步驟在 OpenClaw 中使用 Flux 2

1

設定 RunAPI

設定 RUNAPI_API_KEY 環境變數。如果您已在 OpenClaw 中將 RunAPI 設定為聊天用的 provider,同一個 key 也適用於 Flux 2 圖片生成 — 無需額外設定。

export RUNAPI_API_KEY=runapi_xxx
2

呼叫 Flux 2

向 text_to_image 端點發送 POST 請求,model 設為 flux-2-pro-text-to-image。加入 prompt,並可選擇性設定 aspect_ratio(1:1、4:3、16:9 等)和 output_resolution(1k 或 2k)。若要進行多來源 remix,改用 remix_image 端點搭配 source_image_urls。

text_to_image
3

取得結果

端點會回傳一個任務 ID。輪詢任務狀態端點,直到狀態變為 completed,然後從回應中取得生成的圖片 URL。RunAPI SDK 和 CLI 會自動處理輪詢。

task_id: tsk_abc123
參數

Flux 2 API 參數

參數 類型 說明
model string 必填。flux-2-pro-text-to-image、flux-2-flex-text-to-image、flux-2-pro-remix-image 或 flux-2-flex-remix-image。
prompt string 要生成的圖片文字描述。
aspect_ratio string 選填。輸出長寬比:1:1、4:3、3:4、16:9、9:16、3:2 或 2:3。Remix 端點還接受 auto。
output_resolution string 選填。1k(預設)或 2k。較高解析度的每張圖片費用較高。
source_image_urls array remix_image 必填。要混合或轉換的來源圖片 URL 陣列。
callback_url string 選填。用於非同步完成通知的 Webhook URL。

OpenClaw 上的 Flux 2 是什麼?

Flux 2 由 Black Forest Labs 出品,是生產級圖像模型,其材質保真度真的可以以假亂真。它支持多參考條件和 400 萬像素輸出,無需微調即可獲得品牌一致的效果。OpenClaw agent 通過 RunAPI 的 text_to_image 端點呼叫它,使用與聊天相同的 API key。

Flux 2 使用場景

照片級產品攝影

生成以假亂真的產品攝影圖用於電商目錄、廣告或品牌內容,無需實體拍攝,材質保真度表現出色。

一致角色與人物生成

使用多參考條件在一系列圖像中生成保持相同外觀的品牌代言人或角色,無需對每個輸出進行手工調整。

高分辨率背景與場景

以 400 萬像素輸出生成電影感背景、建築場景和環境圖像,細節精度足以用於大幅印刷或影片製作。

FAQ

Flux 2 + OpenClaw 常見問題

OpenClaw 通用設定

尚未設定?請從 OpenClaw 的 RunAPI 設定指南開始。

OpenClaw 設定指南 →

Flux 2 模型目錄

查看所有 Flux 2 變體、定價與 API 文件。

Flux 2 模型 →

立即在 OpenClaw 中試用 Flux 2。

取得免費的 RunAPI key,將 prompt 貼入 OpenClaw,即可開始使用 Flux 2 Pro 或 Flex 生成圖片。