呼叫 POST /flux/v1/,根據 Prompt 產生 Flux 圖片,並在連結過期前透過 get_result 追蹤狀態。
curl --request POST \
--url https://api.cometapi.com/flux/v1/{model} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "Hello"
}
'{
"id": "<string>",
"polling_url": "<string>"
}/flux/v1/\{model\} 端點會使用 Black Forest Labs 的 Flux 模型系列,根據文字 Prompt 產生高品質圖片。只要替換 URL 路徑中的模型名稱,即可在不同 Flux 變體之間切換。
/flux/v1/get_result 端點查詢已生成的圖片或監控處理狀態。BFL 服務回傳的圖片 URL 約 10 分鐘後會過期。請及時儲存生成結果。Bearer token authentication. Use your CometAPI key.
Must be application/json.
Flux model variant to use, e.g. flux-pro-1.1, flux-pro, flux-dev, flux-pro-1.1-ultra.
Text prompt describing the image to generate.
URL of a reference image to guide the generation style or content.
Output image width in pixels. Must be a multiple of 32. Range varies by model.
Output image height in pixels. Must be a multiple of 32. Range varies by model.
Number of diffusion steps. Higher values improve quality but increase latency.
When true, automatically enhances the prompt for more detailed results.
Random seed for reproducible outputs. Omit for random generation.
Guidance scale controlling how closely the output follows the prompt. Higher values increase prompt adherence.
Safety filter tolerance level. Higher values are more permissive. Range: 0–6.
Diversity interval. Higher values produce more varied outputs at the cost of prompt adherence.
Output image format. Supported values: jpeg, png.
URL to receive a POST notification when the task completes.
Secret string included in webhook payloads for request verification.
curl --request POST \
--url https://api.cometapi.com/flux/v1/{model} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "Hello"
}
'{
"id": "<string>",
"polling_url": "<string>"
}