Skip to main content
POST

Visão geral

POST /flux/v1/\{model\} envia uma tarefa de imagem nativa no formato BFL. Armazene o id de nível superior da resposta e, em seguida, consulte GET /flux/v1/get_result com esse ID de tarefa. O playground da API inclui exemplos de solicitações de texto para imagem para FLUX.2 Pro, Flex e Max. Consulte a página Models ou /v1/models para obter os IDs dos modelos e a disponibilidade da conta.

Campos da solicitação

Comece com prompt, width, height e output_format. Você também pode enviar seed; o resultado concluído pode informar a seed usada, mas esse campo, por si só, não garante uma saída reproduzível. Para edição de imagem de referência, envie uma URL pública de imagem HTTPS em input_image. Este campo é compatível com os três modelos FLUX.2 acima. O FLUX.2 Pro também aceita uma segunda URL pública HTTPS em input_image_2; inclua input_image sempre que enviar input_image_2.

Enviar e consultar

A resposta de criação pode usar status: "processing" enquanto a tarefa é executada. Use o id de nível superior com o endpoint de resultado da CometAPI; os clientes não devem depender de um polling_url fornecido na resposta. Consulte até que o endpoint de resultado retorne status: "Ready". Considere Error, Failed, Failure, Task not found, Request Moderated e Content Moderated como falhas. Para outros estados, continue consultando dentro dos limites de tentativas e tempo limite do seu aplicativo.
Quando uma tarefa estiver pronta, result.sample será uma URL temporária de imagem. Faça o download ou transfira-a prontamente; não dependa de uma duração fixa.

Autorizações

Authorization
string
header
obrigatório

Bearer token authentication. Use your CometAPI key.

Parâmetros de caminho

model
string
obrigatório

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

Corpo

application/json
prompt
string
obrigatório

Text prompt describing the image or reference-image edit.

Exemplo:

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

input_image
string

Public HTTPS URL of the first reference image. Replace the example URL with an image that the model provider can retrieve. This editing field is available for the FLUX.2 models covered by this reference.

Exemplo:

"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.

Exemplo:

"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.

Exemplo:

1280

height
integer

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

Exemplo:

768

output_format
string

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

Exemplo:

"png"

Resposta

200 - application/json

FLUX task submission response. Save the top-level id and poll the CometAPI result endpoint.

id
string
obrigatório

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

status
string
obrigatório

Submission state. An accepted task can return processing.

result
object | null

Task result. It can be empty or null at submission time.

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.

Última modificação em 31 de julho de 2026