메인 콘텐츠로 건너뛰기
POST

개요

POST /flux/v1/\{model\} 네이티브 BFL 형식 요청으로 이미지를 생성합니다. 요청은 기본적으로 비동기식입니다. 최상위 응답의 id을 저장한 후 GET /flux/v1/get_result 해당 작업 ID로 폴링합니다. 동일한 요청에서 이미지를 기다리려면 JSON 본문에 "async": false을 보내세요. 성공적인 동기식 응답에는 status: "Ready"과 result.sample의 이미지 URL이 포함됩니다. API 플레이그라운드에는 FLUX.2 Pro, Flex, Max용 텍스트-이미지 요청 예제가 포함되어 있습니다. 모델 ID와 계정 사용 가능 여부는 모델 페이지 또는 /v1/models에서 확인하세요.

요청 필드

먼저 prompt, width, height, output_format을 설정하세요. seed도 보낼 수 있습니다. 완료된 결과에는 사용된 시드가 표시될 수 있지만, 이 필드만으로는 재현 가능한 출력이 보장되지 않습니다. 선택 사항인 async 필드는 요청이 반환되는 방식을 제어합니다. 동기 생성에는 JSON 불리언 false을 사용하세요. 비동기 생성에는 true을 사용하거나 필드를 생략하세요. "false" 같은 문자열은 보내지 마세요. 참조 이미지 편집에는 input_image에 공개 HTTPS 이미지 URL을 보내세요. 이 필드는 위의 세 FLUX.2 모델에서 지원됩니다. FLUX.2 Pro는 input_image_2의 두 번째 공개 HTTPS URL도 허용합니다. input_image을 보낼 때마다 input_image_2을 포함하세요.

동기식으로 생성

선택하세요 동기식 텍스트-이미지 생성(FLUX.2 Pro) 요청 예제에서 "async": false을 전송하세요. 이미지가 생성되는 동안 연결을 열어 두세요. 예제에서는 클라이언트 제한 시간을 300초로 설정합니다. 이는 완료 기한이 아니라 클라이언트 설정입니다. 응답에 status: "Ready"이 포함되어 있으면 result.sample을 직접 읽으세요. 결과 폴링은 필요하지 않습니다. 요청에 실패하면 결과를 읽기 전에 HTTP 오류를 처리하세요. async: false을 webhook_url 또는 webhook_secret와 함께 사용하지 마세요. 동기식 요청은 결과를 직접 반환하며 이러한 웹훅 필드를 거부합니다.

비동기식으로 제출하고 폴링

async이 true이거나 생략되면, 생성이 계속되는 동안 생성 응답에서 작업 ID를 반환합니다. 최상위 id을 CometAPI 결과 엔드포인트와 함께 사용하세요. 클라이언트는 응답에서 제공되는 polling_url에 의존해서는 안 됩니다. 결과 엔드포인트가 status: "Ready"을 반환할 때까지 폴링하세요. Error, Failed, Failure, Task not found, Request Moderated, Content Moderated은 실패로 처리하세요. 다른 상태에서는 애플리케이션의 재시도 및 제한 시간 한도 내에서 폴링을 계속하세요.
작업이 준비되면 result.sample은 임시 이미지 URL입니다. 즉시 다운로드하거나 전송하세요. 고정된 유효 기간에 의존하지 마세요.

인증

Authorization
string
header
필수

Bearer token authentication. Use your CometAPI key.

경로 매개변수

model
string
필수

FLUX.2 model ID in the URL path. Check /v1/models or the Models page for account availability.

본문

application/json
prompt
string
필수

Text prompt describing the image or reference-image edit.

예시:

"A clean editorial photograph of a red ceramic teapot on a pale blue table, soft window light, no text."

async
boolean
기본값:true

Controls whether generation returns asynchronously. Set false to wait for the finished image and read result.sample from the successful response. Set true or omit this field to receive a task ID for polling. Use a JSON boolean, not a string. Do not combine false with webhook_url or webhook_secret.

input_image
string

Public HTTPS URL of the first reference image. Replace the example URL with a publicly accessible image. This editing field is available for the FLUX.2 models covered by this reference.

예시:

"https://your-image-host/reference-one.jpg"

input_image_2
string

Public HTTPS URL of a second reference image for flux-2-pro. Replace the example URL and also send input_image.

예시:

"https://your-image-host/reference-two.jpg"

seed
integer

Optional seed value. A completed result can report the used seed; that field alone does not establish repeatable output.

width
integer

Requested output width in pixels. Use a dimension supported by the selected model.

예시:

1280

height
integer

Requested output height in pixels. Use a dimension supported by the selected model.

예시:

768

output_format
string

Requested output image format supported by the selected model. The examples use png.

예시:

"png"

응답

200 - application/json

With async: false, successful generation returns status: "Ready" and the image URL in result.sample. With async: true or no async field, save the top-level id and poll the CometAPI result endpoint.

id
string
필수

Task ID to pass to GET /flux/v1/get_result?id=....

status
string
필수

Task state. A successful synchronous response returns Ready. An asynchronous submission can return Pending while generation continues.

result
object | null

Generation result. A successful synchronous response contains the finished image. An asynchronous submission can return an empty or null result.

polling_url
string | null

Response-supplied convenience URL when returned. Clients should poll the documented CometAPI result route by the top-level id.

cost
number | null

Numeric billing coefficient when returned. This field is not documented as a currency or credit amount.

input_mp
number | null

Input image megapixels when returned.

output_mp
number | null

Output image megapixels when returned.

progress
number | null

Task progress when returned.

details
any

Additional task details when returned.

preview
any

Task preview data when returned.

마지막 수정일 2026년 9월 21일