OPENCLAW + FLUX KONTEXT

在 OpenClaw 中使用 Flux Kontext。

Black Forest Labs 的 Flux Kontext 支援文字引導的圖像編輯與生成,並具備角色一致性。OpenClaw agent 透過 RunAPI 使用與聊天相同的 API key 呼叫它——發送 prompt,取回圖像 URL。

一個 API key · 文字轉圖片端點 · 非同步任務輪詢
Use RunAPI to generate an image with Flux Kontext Pro.

Requirements:
- Call the RunAPI text_to_image endpoint at https://runapi.ai/v1/text_to_image
- Set model to "flux-kontext-pro"
- Use the RUNAPI_API_KEY environment variable for authorization
- 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-kontext-pro",
    "prompt": "a matte-black water bottle on a beige stone surface, soft side light, studio photography"
  }'
{
  "task_id": "tsk_abc123",
  "status": "pending",
  "model": "flux-kontext-pro"
}
複製 curl 指令測試 flux-kontext
操作步驟

三步驟在 OpenClaw 中使用 Flux Kontext

1

設定 RunAPI

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

export RUNAPI_API_KEY=runapi_xxx
2

呼叫 Flux Kontext

向 text_to_image 端點發送 POST 請求,將 model 設為 flux-kontext-pro,並附上描述所需圖像的文字 prompt。如需上下文編輯,可選擇性傳入 image_url。

text_to_image
3

取得結果

端點返回 task ID。輪詢 task status 端點直到狀態變為 completed,然後從回應中取得生成的圖像 URL。

task_id: tsk_abc123
參數

Flux Kontext API 參數

參數 類型 說明
model string 必填。flux-kontext-pro 或 flux-kontext-max。
prompt string 用於生成或編輯的文字指令。
image_url string 用於上下文編輯的來源圖像 URL。
aspect_ratio string 可選。輸出長寬比。

OpenClaw 上的 Flux Kontext 是什麼?

Flux Kontext 由 Black Forest Labs 出品,是一個連續圖像編輯模型,用户稱其在精準修改方面優於 ChatGPT 和 Gemini。用文字描述需要改動的部分,它只修改那部分,其餘保持不變——換裝時人臉不變,換背景時產品位置不變。OpenClaw agent 通過 RunAPI 的 text_to_image 端點呼叫它。

Flux Kontext 使用場景

保留主體的背景替換

在保持被攝對象完全相同位置的同時替換產品或肖像背景——無需遮罩,無需修復,只需一條文字指令。

服裝與外觀修改

在保留角色面部特徵的前提下更換服裝、髮色或配飾,適用於時尚效果圖和角色設計迭代。

標牌與標籤文字替換

替換現有圖像中標牌、產品標籤或店面上的文字——在提示詞中輸入新文字,Flux Kontext 即可原位渲染。

FAQ

Flux Kontext + OpenClaw 常見問題

OpenClaw 一般設定

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

OpenClaw 設定指南 →

Flux Kontext 模型目錄

查看所有 Flux Kontext 版本、收費及 API 文件。

Flux Kontext 模型 →

立即在 OpenClaw 中試用 Flux Kontext。

取得免費 RunAPI key,將 prompt 貼入 OpenClaw,開始使用 Flux Kontext 生成圖像。