跳轉到主要內容
POST
/
flux
/
v1
/
{model}
flux generate image
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 系列模型之間的參數清單差異很大,請參閱官方文件以取得詳細使用說明。此處提供的參數清單僅供參考。生成完成後,請使用 /flux/v1/get_result 端點查詢已生成的圖片或監控處理狀態。BFL 服務回傳的圖片 URL 約 10 分鐘後會過期。請及時儲存生成結果。

授權

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

標頭

Content-Type
string

Must be application/json.

路徑參數

model
string
必填

Flux model variant to use, e.g. flux-pro-1.1, flux-pro, flux-dev, flux-pro-1.1-ultra.

主體

application/json
prompt
string
預設值:Hello
必填

Text prompt describing the image to generate.

image_prompt
string

URL of a reference image to guide the generation style or content.

width
integer

Output image width in pixels. Must be a multiple of 32. Range varies by model.

height
integer

Output image height in pixels. Must be a multiple of 32. Range varies by model.

steps
integer

Number of diffusion steps. Higher values improve quality but increase latency.

prompt_upsampling
boolean

When true, automatically enhances the prompt for more detailed results.

seed
integer

Random seed for reproducible outputs. Omit for random generation.

guidance
number

Guidance scale controlling how closely the output follows the prompt. Higher values increase prompt adherence.

safety_tolerance
integer

Safety filter tolerance level. Higher values are more permissive. Range: 0–6.

interval
integer

Diversity interval. Higher values produce more varied outputs at the cost of prompt adherence.

output_format
string

Output image format. Supported values: jpeg, png.

webhook_url
string

URL to receive a POST notification when the task completes.

webhook_secret
string

Secret string included in webhook payloads for request verification.

回應

200 - application/json

OK

id
string
polling_url
string