CometAPI で OpenAI の POST /v1/images/generations を使用して、テキストプロンプトから画像を生成し、スタイルを制御し、サイズを選択し、base64 または URL を返せます。
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"
}
]
}dall-e-3 を使用しますgpt-image-1、gpt-image-1-mini、または gpt-image-1.5 を使用しますqwen-image を使用しますが、n は 1 のままにしてくださいdall-e-3 から始めますsize は 1024x1024 のままにしますresponse_format: "url" を設定しますdall-e-2 と dall-e-3 は URL レスポンスと base64 レスポンスをサポートしますgpt-image-1、gpt-image-1-mini、gpt-image-1.5 は、base64 優先のルートとして扱うのが適していますqwen-image は n > 1 をサポートしていませんresponse_format: "url" を指定した dall-e-3 リクエストで、通常の created タイムスタンプ、revised_prompt、および一時的な画像 URL が返されました。Bearer token authentication. Use your CometAPI key.
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.
Requested output size. Supported values depend on the selected model.
"1024x1024"
Requested output encoding for models that support it.
url, b64_json 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"
}
]
}