Skip to main content
POST

Panoramica

POST /flux/v1/\{model\} invia un’attività immagine nativa in formato BFL. Memorizza la risposta di primo livello id, quindi esegui il polling GET /flux/v1/get_result con tale ID attività. Il playground API include esempi di richieste da testo a immagine per FLUX.2 Pro, Flex e Max. Consulta la pagina Modelli oppure /v1/models per gli ID modello e la disponibilità dell’account.

Campi della richiesta

Inizia con prompt, width, height e output_format. Puoi anche inviare seed; il risultato completato può riportare il seed utilizzato, ma quel campo da solo non garantisce un output ripetibile. Per l’editing di immagini di riferimento, invia un URL HTTPS pubblico dell’immagine in input_image. Questo campo è supportato per i tre modelli FLUX.2 indicati sopra. FLUX.2 Pro accetta anche un secondo URL HTTPS pubblico in input_image_2; includi input_image ogni volta che invii input_image_2.

Invio e polling

La risposta di creazione può usare status: "processing" mentre l’attività è in esecuzione. Utilizza il relativo id di primo livello con l’endpoint dei risultati di CometAPI; i client non devono dipendere da un polling_url fornito nella risposta. Esegui il polling finché l’endpoint dei risultati non restituisce status: "Ready". Considera Error, Failed, Failure, Task not found, Request Moderated e Content Moderated come errori. Per gli altri stati, continua il polling entro i limiti di retry e timeout dell’applicazione.
Quando un’attività è pronta, result.sample è un URL temporaneo dell’immagine. Scaricalo o trasferiscilo tempestivamente; non fare affidamento su una durata fissa.

Autorizzazioni

Authorization
string
header
obbligatorio

Bearer token authentication. Use your CometAPI key.

Parametri del percorso

model
string
obbligatorio

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

Corpo

application/json
prompt
string
obbligatorio

Text prompt describing the image or reference-image edit.

Esempio:

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

Esempio:

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

Esempio:

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

Esempio:

1280

height
integer

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

Esempio:

768

output_format
string

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

Esempio:

"png"

Risposta

200 - application/json

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

id
string
obbligatorio

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

status
string
obbligatorio

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.

Ultima modifica il 31 luglio 2026