Skip to main content
POST

Genel bakış

POST /flux/v1/\{model\} yerel BFL biçimli bir istekle görüntü oluşturur. İstekler varsayılan olarak asenkrondur. Üst düzey yanıttaki id değerini saklayın, ardından yoklamak için GET /flux/v1/get_result bu görev kimliğini kullanın. Görüntüyü aynı istekte beklemek için JSON gövdesinde "async": false gönderin. Başarılı bir eşzamanlı yanıt, status: "Ready" ile birlikte result.sample içinde görüntü URL’sini içerir. API playground, FLUX.2 Pro, Flex ve Max için metinden görüntüye istek örnekleri içerir. Şunu inceleyin: Modeller sayfası veya model kimlikleri ve hesap kullanılabilirliği için /v1/models.

İstek alanları

prompt, width, height ve output_format ile başlayın. seed de gönderebilirsiniz; tamamlanan sonuç kullanılan seed değerini bildirebilir, ancak bu alan tek başına tekrarlanabilir çıktı sağlamaz. İsteğe bağlı async alanı, isteğin nasıl döneceğini kontrol eder. Eşzamanlı oluşturma için JSON boolean değeri false kullanın. Asenkron oluşturma için true kullanın veya alanı atlayın. "false" gibi bir string göndermeyin. Referans görüntü düzenleme için input_image içinde herkese açık bir HTTPS görüntü URL’si gönderin. Bu alan yukarıdaki üç FLUX.2 modeli için desteklenir. FLUX.2 Pro ayrıca input_image_2 içinde ikinci bir herkese açık HTTPS URL’sini kabul eder; input_image gönderdiğinizde her zaman input_image_2 ekleyin.

Eşzamanlı olarak oluşturun

Seçin Eşzamanlı metinden görüntüye (FLUX.2 Pro) istek örneklerinde "async": false göndermek için. Görüntü oluşturulurken bağlantıyı açık tutun. Örnek 300 saniyelik bir istemci timeout değeri kullanır; bu, tamamlanma son tarihi değil, bir istemci ayarıdır. Yanıt status: "Ready" içerdiğinde, result.sample değerini doğrudan okuyun. Sonuç yoklaması gerekmez. İstek başarısız olursa, sonucu okumadan önce HTTP hatasını işleyin. async: false ile webhook_url veya webhook_secret değerlerini birleştirmeyin. Eşzamanlı istekler sonucu doğrudan döndürür ve bu webhook alanlarını reddeder.

Asenkron olarak gönderin ve yoklayın

async, true olduğunda veya atlandığında, oluşturma yanıtı oluşturma devam ederken bir görev kimliği döndürür. CometAPI sonuç endpoint’i ile üst düzey id değerini kullanın; istemciler yanıtta sağlanan polling_url değerine bağımlı olmamalıdır. Sonuç endpoint’i status: "Ready" döndürene kadar yoklayın. Error, Failed, Failure, Task not found, Request Moderated ve Content Moderated değerlerini başarısızlık olarak değerlendirin. Diğer durumlar için uygulamanızın yeniden deneme ve timeout sınırları dahilinde yoklamaya devam edin.
Bir görev hazır olduğunda, result.sample geçici bir görüntü URL’sidir. Hemen indirin veya aktarın; sabit bir kullanım süresine güvenmeyin.

Yetkilendirmeler

Authorization
string
header
gerekli

Bearer token authentication. Use your CometAPI key.

Yol Parametreleri

model
string
gerekli

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

Gövde

application/json
prompt
string
gerekli

Text prompt describing the image or reference-image edit.

Örnek:

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

async
boolean
varsayılan: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.

Örnek:

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

Örnek:

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

Örnek:

1280

height
integer

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

Örnek:

768

output_format
string

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

Örnek:

"png"

Yanıt

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
gerekli

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

status
string
gerekli

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.

Son değiştirilme tarihi 21 Eylül 2026