彈性參數
可設定 8 個已記錄的參數,包括 aspect_ratio, enable_prompt_expansion, enable_translation, output_format, prompt。
4K output, superior text rendering, advanced contextual editing
curl -X POST https://runapi.ai/api/v1/flux_kontext/text_to_image \
-H "Authorization: Bearer $RUNAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-kontext-max",
"prompt": "Edit this product photo: change the background to a tropical beach while keeping the product exactly the same."
}'
import { FluxKontextClient } from "@runapi.ai/flux-kontext";
const client = new FluxKontextClient();
const result = await client.textToImage.run({
model: "flux-kontext-max",
prompt: "Edit this product photo: change the background to a tropical beach while keeping the product exactly the same.",
});
import os
import requests
response = requests.post(
"https://runapi.ai/api/v1/flux_kontext/text_to_image",
headers={"Authorization": f"Bearer {os.environ['RUNAPI_API_KEY']}"},
json={"model":"flux-kontext-max","prompt":"Edit this product photo: change the background to a tropical beach while keeping the product exactly the same."}
)
response.raise_for_status()
<?php
$client = curl_init("https://runapi.ai/api/v1/flux_kontext/text_to_image");
curl_setopt_array($client, [
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("RUNAPI_API_KEY"), "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
'model' => 'flux-kontext-max',
'prompt' => 'Edit this product photo: change the background to a tropical beach while keeping the product exactly the same.',
])
]);
$response = curl_exec($client);
RunApi client = new RunApi(System.getenv("RUNAPI_API_KEY"));
Task task = client.textToImage().run({"model":"flux-kontext-max","prompt":"Edit this product photo: change the background to a tropical beach while keeping the product exactly the same."});
task.waitForResult();
require "runapi/flux_kontext"
client = RunApi::FluxKontext::Client.new
result = client.text_to_image.run(
model: "flux-kontext-max",
prompt: "Edit this product photo: change the background to a tropical beach while keeping the product exactly the same."
)
client := runapi.NewClient(os.Getenv("RUNAPI_API_KEY"))
task, err := client.textToImage.Run({"model":"flux-kontext-max","prompt":"Edit this product photo: change the background to a tropical beach while keeping the product exactly the same."})
if err != nil { log.Fatal(err) }
task.Wait()
$ runapi generate \
--model flux-kontext-max \
--endpoint text_to_image \
--wait
2 個版本可用
選擇任一模型,幾秒內即可開始生成。
選擇任一模型,幾秒內即可開始生成。
| 提供者 | Black Forest Labs |
| 模型 ID | flux-kontext-max |
| 模態 | Image |
| 任務類型 | Asynchronous |
| API 端點 | /api/v1/flux_kontext/text_to_image |
| 計費單位 | call |
| 輸入參數 | aspect_ratio, callback_url, enable_prompt_expansion, enable_translation, model, output_format, prompt, safety_tolerance, source_image_url, watermark |
| 長寬比 | 21:9, 16:9, 4:3, 1:1, 3:4, 9:16 |
| 輸出格式 | jpeg, png |
| 目錄狀態 | 可直接上線 |
免費註冊後,從控制台建立 flux-kontext-max 的 API 金鑰。
向 /api/v1/flux_kontext/text_to_image 傳送 POST 請求,並傳入 flux-kontext-max 模型 ID 與參數。
輪詢工作或依照回呼取得已完成的 flux-kontext-max 結果。
可設定 8 個已記錄的參數,包括 aspect_ratio, enable_prompt_expansion, enable_translation, output_format, prompt。
公開 1 個公共 endpoint:text_to_image。
非同步任務接受回呼 URL 以接收完成通知。
依 call 計量,無需訂閱。
promptImage description (English only).
watermarkWatermark identifier.
aspect_ratioOutput aspect ratio. Default: 16:9. (21:9, 16:9, 4:3, 1:1, 3:4, 9:16)
callback_urlWebhook URL for async notifications.
output_formatOutput format. Default: jpeg. (jpeg, png)
safety_toleranceContent safety threshold. 0-6 for generation, 0-2 for editing. Default: 2.
source_image_urlSource image URL for editing mode.
enable_translationAuto-translate non-English prompts. Default: true.
enable_prompt_expansionExpand the prompt with more detail. Default: false.
為缺少棚拍照片的電商型錄,自動生成生活風格產品照片。
在定稿前快速發想場景與角色概念。
大規模生成部落格文章與專欄所需的獨特封面與插圖。
傳入 quickstart 顯示的 model ID。
每個金鑰的速率限制會依使用方案而調整。請查看定價頁面以了解目前限制。
可以——variant 只是旗標。只要變更 model 參數即可切換。
只要支援串流,RunAPI 就會端到端串流。
請在公開 GitHub repo 提交 issue,或寄信給支援。