Chuyển đến nội dung chính
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>"
}

Tổng quan

Endpoint /flux/v1/\{model\} tạo ra hình ảnh chất lượng cao từ prompt văn bản bằng cách sử dụng họ model Flux của Black Forest Labs. Chỉ cần thay tên model trong đường dẫn URL để chuyển đổi giữa các biến thể Flux khác nhau.
Do có sự khác biệt đáng kể trong danh sách tham số giữa các model thuộc dòng Flux, vui lòng tham khảo tài liệu chính thức để biết hướng dẫn sử dụng chi tiết. Danh sách tham số được cung cấp tại đây chỉ mang tính tham khảo.Sau khi tạo xong, hãy dùng endpoint /flux/v1/get_result để truy vấn ảnh đã tạo hoặc theo dõi trạng thái tiến trình.Các URL ảnh do dịch vụ của BFL trả về sẽ hết hạn sau khoảng 10 phút. Hãy lưu kết quả đã tạo kịp thời.

Ủy quyền

Authorization
string
header
bắt buộc

Bearer token authentication. Use your CometAPI key.

Tiêu đề

Content-Type
string

Must be application/json.

Tham số đường dẫn

model
string
bắt buộc

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

Nội dung

application/json
prompt
string
mặc định:Hello
bắt buộc

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.

Phản hồi

200 - application/json

OK

id
string
polling_url
string