Membuat gambar Seedream
Gunakan rute CometAPI POST /v1/images/generations untuk pembuatan gambar Seedream dengan Prompt teks, gambar referensi, output gambar berurutan, dan task async.
POST /v1/images/generations CometAPI yang kompatibel dengan OpenAI untuk menjalankan pembuatan gambar Seedream. Endpoint ini mendukung Prompt text-to-image, permintaan gambar referensi, dan output gambar berurutan yang dibatasi ketika model yang dipilih mendukung kontrol tersebut.
Halaman ini membahas seedream-5-0-pro-260628 untuk permintaan Pro text-to-image dan seedream-5-0-260128 untuk contoh Seedream 5.0 gambar referensi, berurutan, dan async. Untuk ketersediaan akun, lihat halaman Models atau kueri /v1/models. Untuk detail parameter provider, lihat image generation API dan tutorial Seedream 4.0-5.0 dari BytePlus.
Pilih bentuk permintaan
- Text to image: kirim
model,prompt,size, dan kontrol output opsional sepertiresponse_format,output_format, danwatermark. - Image to image: tambahkan
imagesebagai array URL HTTPS publik atau data URI. Gunakan array bahkan saat Anda mengirim satu gambar referensi. - Sequential prompt: atur
sequential_image_generationkeautodan gunakansequential_image_generation_options.max_imagessebagai batas atas. Model dapat mengembalikan lebih sedikit gambar daripada jumlah maksimum. - Async task: tambahkan
async: truesaat Anda ingin permintaan create mengembalikandata.task_idalih-alih menahan koneksi HTTP tetap terbuka.
max_images.Menjalankan task gambar async
Aturasync ke true untuk job gambar yang harus dikirim dan dipoll oleh klien Anda. Permintaan create mengembalikan data.task_id; gunakan nilai tersebut dengan Retrieve a Seedream image task hingga data.status menjadi success atau failure.
Gunakan 2K dalam contoh async untuk permintaan Seedream 5.0. Dukungan ukuran berbeda menurut model ID, jadi pilih ukuran yang didukung model sebelum Anda mengirim task async.
Mengirim gambar referensi
Gunakandata:image/png;base64,YOUR_BASE64_IMAGE untuk data gambar inline, atau gunakan URL HTTPS publik yang dapat diambil oleh provider. Contoh referensi API menunjukkan bentuk JSON lengkap untuk setiap jenis permintaan.
Membaca URL output
Otorisasi
Bearer token authentication. Use your CometAPI key.
Body
Parameters for Seedream image generation. Send JSON for text-to-image, image-to-image, and sequential prompt requests.
Seedream model ID to use. Query /v1/models or open the Models page for available model IDs.
Text prompt describing the image or edit goal. Use a concrete visual request, such as a blue ceramic mug on a white table, soft studio lighting.
Response image format. Use url for a temporary signed image URL, or b64_json when you need base64 image data in the response.
url, b64_json Output resolution. Use a model-supported tier such as 2K or a model-supported WIDTHxHEIGHT value such as 2048x2048. Not every model ID accepts every tier.
Optional reference images for image-to-image generation. Each item can be a public HTTPS URL or a data URI such as data:image/png;base64,YOUR_BASE64_IMAGE. Use an array even for one image. Reference images plus generated images must not exceed the provider limit.
When true, requests a visible AI-generated watermark on the output image. Set false when your workflow handles disclosure separately.
CometAPI asynchronous task mode. Set this to true to return immediately with data.task_id, then poll the Seedream image task endpoint GET /v1/images/generations/{task_id} for the final image data.
Output image file format. Use png when you need lossless output, or jpeg for smaller files.
png, jpeg Optional prompt-adherence control for model versions that support it. Higher values can follow the prompt more closely but may reduce naturalness. Omit this field when you do not need model-specific tuning.
1 <= x <= 10Optional random seed for reproducible attempts on model versions that support seeding. Use -1 or omit the field for a random seed.
-1 <= x <= 2147483647Controls sequential prompt handling. Use auto to let the model return a sequence when the prompt calls for one. Use disabled for ordinary single-image requests.
auto, disabled Options for sequential prompt handling. This object is only used when sequential_image_generation is auto.
Respons
Image generation response. Synchronous requests return completed image data. Async requests return a task response with data.task_id.
- Option 1
- Async task response