透過 CometAPI 搭配 OpenAI 的 POST /v1/images/generations,從文字 Prompt 建立圖片、控制風格、選擇尺寸,並回傳 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-3gpt-image-1、gpt-image-1-mini 或 gpt-image-1.5qwen-image,但請將 n 保持為 1dall-e-3 開始size 保持為 1024x1024response_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 > 1response_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"
}
]
}