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

# Image Generations

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

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

## Official reference

* Read the [OpenAI image generation guide](https://developers.openai.com/api/docs/guides/image-generation) before you rely on model-specific controls such as `background`, `output_compression`, streaming, or future GPT image options.
* Use the [OpenAI Create image reference](https://developers.openai.com/api/reference/resources/images/methods/generate) for the current parameter list.

## 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`

<Warning>
  Generated images must comply with provider usage policies. Do not send illegal, violent, pornographic, or copyright-infringing prompts.
</Warning>


## OpenAPI

````yaml /api/openapi/image/openai/post-images.openapi.json POST /v1/images/generations
openapi: 3.1.0
info:
  title: Images API
  version: 1.0.0
  description: >-
    Create images through the OpenAI-compatible CometAPI image generation route.
    Request parameters vary by model. For the latest model-specific controls,
    refer to the OpenAI image generation guide:
    https://developers.openai.com/api/docs/guides/image-generation
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /v1/images/generations:
    post:
      summary: Create images
      description: >-
        Generate images from a text prompt using OpenAI-compatible request
        shapes on CometAPI. For the latest model-specific output controls and
        parameter support, refer to the OpenAI image generation guide:
        https://developers.openai.com/api/docs/guides/image-generation
      operationId: images
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  description: >-
                    The image generation model to use. Choose a current model
                    from the [Models page](/overview/models).
                  default: dall-e-3
                prompt:
                  type: string
                  description: Text description of the image you want to generate.
                  example: A paper boat floating on calm water at sunrise.
                'n':
                  type: integer
                  description: >-
                    Number of images to generate. Keep this at 1 for the
                    broadest compatibility.
                  default: 1
                quality:
                  type: string
                  description: >-
                    Quality setting for models that support it. See the OpenAI
                    image generation guide for the latest model-specific values.
                size:
                  type: string
                  description: >-
                    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:
                  type: string
                  description: >-
                    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.
                  enum:
                    - url
                    - b64_json
                output_format:
                  type: string
                  description: >-
                    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
              default:
                model: dall-e-3
                prompt: A paper boat floating on calm water at sunrise.
                'n': 1
                size: 1024x1024
                response_format: url
            examples:
              GPT request:
                summary: GPT request
                value:
                  model: gpt-image-2
                  prompt: A paper boat floating on calm water at sunrise.
                  quality: low
                  size: 1024x1024
                  output_format: jpeg
              DALL request:
                summary: DALL request
                value:
                  model: dall-e-3
                  prompt: A paper boat floating on calm water at sunrise.
                  response_format: url
                  size: 1024x1024
      responses:
        '200':
          description: Image generation result.
          content:
            application/json:
              schema:
                type: object
                required:
                  - created
                  - data
                  - usage
                properties:
                  created:
                    type: integer
                    description: Unix timestamp for the completed generation.
                  background:
                    type: string
                    description: Background mode returned by models that expose it.
                  output_format:
                    type: string
                    description: Encoded image type returned by GPT image models.
                  quality:
                    type: string
                    description: Quality level returned by models that expose it.
                  size:
                    type: string
                    description: Output size returned by models that expose it.
                  usage:
                    type: object
                    properties:
                      input_tokens:
                        type: integer
                      output_tokens:
                        type: integer
                      total_tokens:
                        type: integer
                      input_tokens_details:
                        type: object
                        properties:
                          image_tokens:
                            type: integer
                          text_tokens:
                            type: integer
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                          description: >-
                            Temporary image URL when the selected model supports
                            URL output.
                        b64_json:
                          type: string
                          description: >-
                            Base64-encoded image payload for models that return
                            inline content.
                        revised_prompt:
                          type: string
                          description: Provider-rewritten prompt, when available.
                example:
                  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>
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use your CometAPI key.

````