Skip to main content
POST
/
v1
/
images
/
generations
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>"
    }
  ]
}

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.

Use this route to create images from text with OpenAI-compatible request shapes on CometAPI.

Official reference

Choose a model first

  • Use dall-e-3 when you want a simple first request with response_format
  • Use a GPT image model when you need GPT-only controls such as output_format, quality, or background
  • Use qwen-image when you need that provider specifically, but keep n at 1

Safe first request

  • Start with dall-e-3
  • Keep size at 1024x1024
  • Set response_format: "url" if you want a small JSON response and a temporary download URL
  • Use the validated GPT request example in the API reference if you need GPT image model parameters
  • Add output_format only when you need a specific encoded image type such as jpeg
  • Check the OpenAI image generation guide before you add background, output_compression, or streaming
  • Use one prompt and one output image before you add batch generation or style tuning

Model-specific request behavior

  • response_format applies to dall-e-2 and dall-e-3
  • GPT image models use GPT-only controls such as output_format, quality, background, and output_compression
  • Follow the OpenAI image generation guide for the latest model-specific options
  • qwen-image does not support n > 1
Generated images must comply with provider usage policies. Do not send illegal, violent, pornographic, or copyright-infringing prompts.

Authorizations

Authorization
string
header
required

Bearer token authentication. Use your CometAPI key.

Body

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

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

prompt
string
required

Text description of the image you want to generate.

Example:

"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.

quality
string

Quality setting for models that support it. See the OpenAI image generation guide for the latest model-specific values.

size
string

Requested output size. Supported values depend on the selected model. See the OpenAI image generation guide for the latest model-specific ranges.

Example:

"1024x1024"

response_format
enum<string>

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.

Available options:
url,
b64_json
output_format
string

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.

Example:

"jpeg"

Response

200 - application/json

Image generation result.

created
integer
required

Unix timestamp for the completed generation.

usage
object
required
data
object[]
required
background
string

Background mode returned by models that expose it.

output_format
string

Encoded image type returned by GPT image models.

quality
string

Quality level returned by models that expose it.

size
string

Output size returned by models that expose it.