Pembuatan gambar
Gunakan CometAPI dengan OpenAI POST /v1/images/generations untuk membuat gambar dari prompt teks dan ikuti panduan resmi pembuatan gambar untuk kontrol spesifik model.
Referensi resmi
- Baca panduan pembuatan gambar OpenAI sebelum Anda mengandalkan kontrol spesifik model seperti
background,output_compression, streaming, atau opsi GPT image di masa mendatang. - Gunakan referensi Create image OpenAI untuk daftar parameter saat ini.
Pilih model terlebih dahulu
- Gunakan
dall-e-3saat Anda menginginkan request awal yang sederhana denganresponse_format - Gunakan model GPT image saat Anda memerlukan kontrol khusus GPT seperti
output_format,quality, ataubackground - Gunakan
qwen-imagesaat Anda memerlukan provider tersebut secara spesifik, tetapi biarkanntetap 1
Request awal yang aman
- Mulai dengan
dall-e-3 - Pertahankan
sizedi1024x1024 - Setel
response_format: "url"jika Anda menginginkan respons JSON kecil dan URL unduhan sementara - Gunakan contoh request GPT yang tervalidasi di referensi API jika Anda memerlukan parameter model GPT image
- Tambahkan
output_formathanya ketika Anda memerlukan tipe gambar terenkode tertentu sepertijpeg - Periksa panduan pembuatan gambar OpenAI sebelum Anda menambahkan
background,output_compression, atau streaming - Gunakan satu prompt dan satu gambar keluaran sebelum Anda menambahkan pembuatan batch atau penyesuaian gaya
Perilaku request spesifik model
response_formatberlaku untukdall-e-2dandall-e-3- Model GPT image menggunakan kontrol khusus GPT seperti
output_format,quality,background, danoutput_compression - Ikuti panduan pembuatan gambar OpenAI untuk opsi spesifik model terbaru
qwen-imagetidak mendukungn > 1
Otorisasi
Bearer token authentication. Use your CometAPI key.
Body
The image generation model to use. Choose a current model from the Models page.
Text description of the image you want to generate.
"A paper boat floating on calm water at sunrise."
Number of images to generate. Keep this at 1 for the broadest compatibility.
Quality setting for models that support it. See the OpenAI image generation guide for the latest model-specific values.
Requested output size. Supported values depend on the selected model. See the OpenAI image generation guide for the latest model-specific ranges.
"1024x1024"
The response container for dall-e-2 and dall-e-3. This parameter is not supported for GPT image models, which return base64-encoded image data.
url, b64_json The encoded image type for GPT image model results, such as png, jpeg, or webp. See the OpenAI image generation guide for current GPT image output controls.
"jpeg"
Respons
Image generation result.
Unix timestamp for the completed generation.
Background mode returned by models that expose it.
Encoded image type returned by GPT image models.
Quality level returned by models that expose it.
Output size returned by models that expose it.