跳转到主要内容
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