Gerar uma imagem FLUX
Envie tarefas de texto para imagem e imagem de referência do FLUX.2 pelo endpoint nativo da CometAPI compatível com BFL.
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 comprompt, 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 usarstatus: "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.
Autorizações
Bearer token authentication. Use your CometAPI key.
Parâmetros de caminho
FLUX.2 model ID in the URL path. Check /v1/models or the Models page for account availability.
Corpo
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."
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.
"https://your-image-host/reference-one.jpg"
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"
Optional seed value. A completed result can report the used seed; that field alone does not establish repeatable output.
Requested output width in pixels. Use a dimension supported by the selected model.
1280
Requested output height in pixels. Use a dimension supported by the selected model.
768
Requested output image format supported by the selected model. The examples use png.
"png"
Resposta
FLUX task submission response. Save the top-level id and poll the CometAPI result endpoint.
Task ID to pass to GET /flux/v1/get_result?id=....
Submission state. An accepted task can return processing.
Task result. It can be empty or null at submission time.
Response-supplied convenience URL when returned. Clients should poll the documented CometAPI result route by the top-level id.
Numeric billing coefficient when returned. This field is not documented as a currency or credit amount.
Input image megapixels when returned.
Output image megapixels when returned.
Task progress when returned.
Additional task details when returned.
Task preview data when returned.