Langsung ke konten utama
POST
/
v1
/
images
/
generations
Create images
curl --request POST \
  --url https://api.cometapi.com/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "dall-e-3",
  "prompt": "A paper boat floating on calm water at sunrise."
}
'
{
  "created": 1773311889,
  "data": [
    {
      "revised_prompt": "A paper boat floating on calm water at sunrise, with soft golden light reflecting off the water's surface.",
      "url": "https://filesystem.site/cdn/20260312/1d6826050921c07a13ff173310c640.webp"
    }
  ]
}
Gunakan route ini untuk membuat gambar dari teks dengan bentuk request yang kompatibel dengan OpenAI di CometAPI.

Pilih model terlebih dahulu

  • Gunakan dall-e-3 saat Anda menginginkan smoke test sederhana berbasis URL
  • Gunakan gpt-image-1, gpt-image-1-mini, atau gpt-image-1.5 saat Anda menginginkan model gambar GPT yang lebih baru dan dapat menangani response base64
  • Gunakan qwen-image saat Anda membutuhkan provider tersebut secara khusus, tetapi pertahankan n di 1

Request pertama yang aman

  • Mulailah dengan dall-e-3
  • Pertahankan size di 1024x1024
  • Atur response_format: "url" jika Anda menginginkan response JSON yang kecil dan URL unduhan sementara
  • Gunakan satu prompt dan satu gambar sebelum Anda menambahkan batch generation atau penyesuaian gaya

Perilaku response khusus model

  • dall-e-2 dan dall-e-3 mendukung response URL dan response base64
  • gpt-image-1, gpt-image-1-mini, dan gpt-image-1.5 lebih baik diperlakukan sebagai route yang mengutamakan base64
  • qwen-image tidak mendukung n > 1
Selama validasi langsung pada 2026-03-12, sebuah request dall-e-3 dengan response_format: "url" mengembalikan timestamp created normal, sebuah revised_prompt, dan URL gambar sementara.
Gambar yang dihasilkan harus mematuhi kebijakan penggunaan provider. Jangan kirim prompt yang ilegal, penuh kekerasan, pornografis, atau melanggar hak cipta.

Otorisasi

Authorization
string
header
wajib

Bearer token authentication. Use your CometAPI key.

Body

application/json
model
string
default:dall-e-3
wajib

The image generation model to use. Choose a current model from the Models page.

prompt
string
wajib

Text description of the image you want to generate.

Contoh:

"A paper boat floating on calm water at sunrise."

n
integer
default:1

Number of images to generate. Keep this at 1 for the broadest compatibility.

size
string

Requested output size. Supported values depend on the selected model.

Contoh:

"1024x1024"

response_format
enum<string>

Requested output encoding for models that support it.

Opsi yang tersedia:
url,
b64_json

Respons

200 - application/json

Image generation result.

created
integer
wajib

Unix timestamp for the completed generation.

data
object[]
wajib