Een FLUX-afbeelding genereren
Dien FLUX.2-tekst-naar-afbeeldingstaken en taken met referentieafbeeldingen in via het systeemeigen, met BFL compatibele endpoint van CometAPI.
Overzicht
POST /flux/v1/\{model\} verstuurt een systeemeigen afbeeldingstaak in BFL-indeling. Sla de id op uit het antwoord op hoofdniveau en poll vervolgens GET /flux/v1/get_result met die taak-ID.
De API-playground bevat voorbeelden van tekst-naar-afbeeldingsverzoeken voor FLUX.2 Pro, Flex en Max. Raadpleeg de pagina Modellen of /v1/models voor model-ID’s en accountbeschikbaarheid.
Aanvraagvelden
Begin metprompt, width, height en output_format. Je kunt ook seed versturen; het voltooide resultaat kan de gebruikte seed melden, maar dat veld alleen zorgt niet voor reproduceerbare uitvoer.
Voor bewerking met referentieafbeeldingen verstuur je een openbare HTTPS-afbeeldings-URL in input_image. Dit veld wordt ondersteund voor de drie bovenstaande FLUX.2-modellen. FLUX.2 Pro accepteert ook een tweede openbare HTTPS-URL in input_image_2; voeg altijd input_image toe wanneer je input_image_2 verstuurt.
Indienen en pollen
In het aanmaakantwoord kanstatus: "processing" staan terwijl de taak wordt uitgevoerd. Gebruik de id op hoofdniveau met het resultaatendpoint van CometAPI; clients mogen niet afhankelijk zijn van een door het antwoord opgegeven polling_url.
Poll totdat het resultaatendpoint status: "Ready" retourneert. Beschouw Error, Failed, Failure, Task not found, Request Moderated en Content Moderated als fouten. Blijf voor andere statussen pollen binnen de limieten voor nieuwe pogingen en time-outs van je applicatie.
Autorisaties
Bearer token authentication. Use your CometAPI key.
Padparameters
FLUX.2 model ID in the URL path. Check /v1/models or the Models page for account availability.
Body
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"
Respons
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.