Felo API PlatformFelo API Platform
返回模型列表

FLUX 3.1 Image API

免費試用 API 限時

Black Forest Labs 的 FLUX3.1 Image 專為精準影像修訂與迭代製作而設,支援參考圖、遮罩編輯及最高16MP 輸出。

FLUX3.1 Image 是 Black Forest Labs 的託管 API影像模型,支援影像輸入與輸出,最高可輸出16MP,也支援4K。公司表示,生成1-megapixel (MP)影像約需3 秒,生成16MP 輸出則少於15 秒;實際使用者感受到的延遲也會受到網路傳輸、排隊、輪詢及下載結果影響。

模型為反覆製作與精準修圖而設,能以遮罩針對指定區域編輯,同時保留周邊畫面;也可使用最多10 張參考圖,在不同場景維持構圖或角色一致性。可指定1 至32 個標準化邊界框來設定物件或編輯位置,並能在提示中使用十六進位色碼指定顏色。

適合電商商品目錄、虛擬試穿、概念藝術、分鏡、主視覺及在地化廣告等工作。可用於替換招牌、包裝、看板與介面示意圖中的文案,同時保留周邊設計;選用網頁 grounding 時,也可參照真實世界的地標、物種與物件。

更新時間:

模型 ID

flux-3-1-image
發佈日期
上下文
46.864K
最大輸出
42.177K
輸入
文字 / 圖像
輸出
圖像

核心要點

  • 最高16MP 輸出
  • 支援4K
  • 遮罩指定區域編輯
  • 最多10 張參考圖
  • 標準化邊界框定位
  • 支援十六進位色碼

供應商

1 個供應商

比較不同供應商的呼叫價格,點擊供應商可查看完整費用和適用條件。

供應商 · 計費明細
可用率

適合

電商商品圖虛擬試穿概念藝術分鏡製作主視覺設計廣告在地化

快速开始

提交圖片任務、輪詢狀態,再儲存圖片。以下範例使用 curl 和 Python 3(僅標準函式庫,無須安裝依賴)。

POST https://openapi.felo.ai/api/v1/images/generations

1填入 API key

從 Felo API Platform 帳戶建立 key,並設定為環境變數。

export FELO_API_KEY="YOUR_API_KEY"

2發出第一次請求

選用參數的值依模型而異,範例不預設這些值;加入前請在 Playground 確認。請求欄位與 model、prompt 同層,不包在 input 中。

curl --fail-with-body --max-time 60 "https://openapi.felo.ai/api/v1/images/generations" \
  -H "Authorization: Bearer $FELO_API_KEY" \
  -H "Content-Type: application/json" \
  -o created.json \
  -d '{
  "prompt": "A studio product photo of a ceramic coffee cup on warm linen, soft morning light",
  "model": "flux-3-1-image"
}'

3輪詢任務

提交後取得 task_id;queued、running 時每 3 秒查詢一次,succeeded、failed 或 interrupted 時停止。範例最多等待 30 分鐘。保留 created.json 可繼續查詢同一任務,避免重複提交。

python3 - <<'PY'
import json, os, time
from pathlib import Path
from urllib.parse import quote
from urllib.request import Request, urlopen

task = json.loads(Path("created.json").read_text())
task_id = task["task_id"]
url = "https://openapi.felo.ai/api/v1/images/generations/" + quote(task_id, safe="")
headers = {"Authorization": "Bearer " + os.environ["FELO_API_KEY"]}
deadline = time.monotonic() + 1800

while task["status"] in ("queued", "running"):
    if time.monotonic() >= deadline:
        raise TimeoutError(f"Keep task_id={task_id} to resume polling")
    time.sleep(3)
    with urlopen(Request(url, headers=headers), timeout=60) as response:
        task = json.load(response)
    if task.get("task_id") != task_id or task.get("kind") != "image":
        raise ValueError("Unexpected task response")
    print(task["status"])

if task["status"] != "succeeded":
    raise RuntimeError(task.get("error") or task["status"])
if not task.get("outputs"):
    raise ValueError("Task succeeded without image outputs")
Path("task.json").write_text(json.dumps(task))
print("Saved task.json")
PY

4下載輸出

成功後從 task.json 讀取 outputs 並儲存。結果相容 HTTPS 位址、URL 物件和 b64_json。簽名位址請及時下載;下載圖片時無須攜帶 API Key。

python3 - <<'PY'
import base64, json
from pathlib import Path
from urllib.request import urlopen

task = json.loads(Path("task.json").read_text())
if task.get("status") != "succeeded" or not task.get("outputs"):
    raise ValueError("No completed image outputs")
extensions = {"image/png": ".png", "image/jpeg": ".jpg", "image/webp": ".webp", "image/gif": ".gif", "image/avif": ".avif"}

for index, output in enumerate(task["outputs"], 1):
    item = output if isinstance(output, dict) else {}
    url = output if isinstance(output, str) else item.get("url") or item.get("unsigned_url")
    mime = item.get("media_type") or "image/png"
    if url and url.startswith("https://"):
        with urlopen(url, timeout=60) as response:
            data = response.read()
            mime = response.headers.get_content_type()
    elif url and url.startswith("data:image/") and ";base64," in url:
        header, encoded = url.split(",", 1)
        mime = header[5:].split(";", 1)[0]
        data = base64.b64decode(encoded, validate=True)
    elif item.get("b64_json"):
        data = base64.b64decode(item["b64_json"], validate=True)
    else:
        raise ValueError("Unrecognized image output")
    path = Path(f"image-{index}" + extensions.get(mime, ".bin"))
    path.write_bytes(data)
    print(path)
PY
input_references

編輯圖片時,將範例位址替換為你的 HTTPS 圖片位址或 base64 圖片 data URL。提交一次後,沿用相同的輪詢與儲存步驟。

curl --fail-with-body --max-time 60 "https://openapi.felo.ai/api/v1/images/generations" \
  -H "Authorization: Bearer $FELO_API_KEY" \
  -H "Content-Type: application/json" \
  -o created.json \
  -d '{
  "prompt": "Keep the product and framing. Replace the background with a sunlit marble countertop.",
  "model": "flux-3-1-image",
  "input_references": [
    {
      "type": "image_url",
      "image_url": {
        "url": "https://example.com/product.png"
      }
    }
  ]
}'

支援的參數

  • n
  • seed
  • quality
  • resolution
  • aspect_ratio
  • output_format
  • input_references

想查看完整文件?

API 文件 →

常見問題

什麼是 FLUX 3.1 Image?

FLUX3.1 Image 是 Black Forest Labs 的託管 API影像模型,支援影像輸入與輸出,最高可輸出16MP,也支援4K。公司表示,生成1-megapixel (MP)影像約需3 秒,生成16MP 輸出則少於15 秒;實際使用者感受到的延遲也會受到網路傳輸、排隊、輪詢及下載結果影響。 模型為反覆製作與精準修圖而設,能以遮罩針對指定區域編輯,同時保留周邊畫面;也可使用最多10 張參考圖,在不同場景維持構圖或角色一致性。可指定1 至32 個標準化邊界框來設定物件或編輯位置,並能在提示中使用十六進位色碼指定顏色。 適合電商商品目錄、虛擬試穿、概念藝術、分鏡、主視覺及在地化廣告等工作。可用於替換招牌、包裝、看板與介面示意圖中的文案,同時保留周邊設計;選用網頁 grounding 時,也可參照真實世界的地標、物種與物件。

如何計算呼叫費用?

費用取決於你使用的供應商、對應價格和實際用量。長文字輸入等情況可能適用不同價格,詳見計費明細。 按實際生成費用計費,具體金額以帳單為準。

支援哪些輸入與輸出?

支援影像輸入與影像輸出。可使用最多10 張參考圖,也支援遮罩、標準化邊界框及提示中的十六進位色碼。

上下文長度與輸出長度是多少?

資料未提供上下文長度。輸出最高可達16MP,並支援4K。

FLUX3.1 Image 適合哪些工作?

適合電商商品目錄、虛擬試穿、概念藝術、分鏡、主視覺與在地化廣告,也適合精準修訂影像及迭代製作。

它與同系列模型有何差別?

資料未提供 FLUX3 Image Klein 或 FLUX3 的功能對比,因此無法據此確認各模型的差異。

相關模型