Use CometAPI with OpenAI POST /v1/images/generations to create images from text prompts and follow the official image generation guide for model-specific controls.
curl --request POST \
--url https://api.cometapi.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2",
"prompt": "A paper boat floating on calm water at sunrise."
}
'{
"created": 1776841943,
"background": "opaque",
"output_format": "jpeg",
"quality": "low",
"size": "1024x1024",
"usage": {
"input_tokens": 16,
"input_tokens_details": {
"image_tokens": 0,
"text_tokens": 16
},
"output_tokens": 208,
"total_tokens": 224
},
"data": [
{
"b64_json": "<base64-image-data>"
}
]
}Use this route to create images from text with OpenAI-compatible request shapes on CometAPI.Documentation Index
Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
Use this file to discover all available pages before exploring further.
background, output_compression, streaming, or future GPT image options.dall-e-3 when you want a simple first request with response_formatoutput_format, quality, or backgroundqwen-image when you need that provider specifically, but keep n at 1dall-e-3size at 1024x1024response_format: "url" if you want a small JSON response and a temporary download URLoutput_format only when you need a specific encoded image type such as jpegbackground, output_compression, or streamingresponse_format applies to dall-e-2 and dall-e-3output_format, quality, background, and output_compressionqwen-image does not support n > 1Bearer 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.
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"
Image generation result.
Unix timestamp for the completed generation.
Show child attributes
Show child attributes
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.
curl --request POST \
--url https://api.cometapi.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2",
"prompt": "A paper boat floating on calm water at sunrise."
}
'{
"created": 1776841943,
"background": "opaque",
"output_format": "jpeg",
"quality": "low",
"size": "1024x1024",
"usage": {
"input_tokens": 16,
"input_tokens_details": {
"image_tokens": 0,
"text_tokens": 16
},
"output_tokens": 208,
"total_tokens": 224
},
"data": [
{
"b64_json": "<base64-image-data>"
}
]
}