> ## Documentation Index
> Fetch the complete documentation index at: https://docs.creatify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# GPT-image-2 · Text to image

> High-fidelity images with strong prompt adherence, preserving composition, lighting, and fine-grained detail.

[← GPT](/api-documentation/ai-generation/models/gpt)

**Model name:** `gpt-image-2`\
**Generation type:** `text_to_image`\
**Endpoint:** [`POST /api/asset_generator/`](/api-reference/ai-generation/post-ai-generation)

## Pricing

| Quality | 1K | 2K | 4K |
| - | - | - | - |
| low | **0.5** | **0.5** | **1.0** |
| medium | **1.0** | **1.5** | **2.5** |
| high | **2.5** | **4.5** | **9.0** |

Prices are per output. When a request asks for several outputs, the charge is this price times the number of outputs.

## Quick start

<CodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.creatify.ai/api/asset_generator/ \
    --header 'Content-Type: application/json' \
    --header 'X-API-ID: your-api-id' \
    --header 'X-API-KEY: your-api-key' \
    --data '{
      "model_name": "gpt-image-2",
      "input_params": {
        "prompt": "A product photo of a ceramic mug on a marble counter, soft daylight."
      }
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.creatify.ai/api/asset_generator/",
      headers={"X-API-ID": "your-api-id", "X-API-KEY": "your-api-key"},
      json={
          "model_name": "gpt-image-2",
          "input_params": {
              "prompt": "A product photo of a ceramic mug on a marble counter, soft daylight."
          },
      },
  )
  print(response.json()["id"])
  ```
</CodeGroup>

## Input parameters

Send these fields in `input_params`.

<ParamField body="prompt" type="string" required>
  The prompt for image generation

  Minimum characters: `2`.
  Maximum characters: `32000`.
</ParamField>

<ParamField body="image_size" type="string" default={"square"}>
  Aspect ratio for the generated image

  Allowed values: `"square"`, `"portrait_4_3"`, `"portrait_16_9"`, `"portrait_5_4"`, `"portrait_3_2"`, `"landscape_4_3"`, `"landscape_16_9"`, `"landscape_5_4"`, `"landscape_3_2"`.
</ParamField>

<ParamField body="quality" type="string" default={"medium"}>
  Quality for the generated image

  Allowed values: `"low"`, `"medium"`, `"high"`.
</ParamField>

<ParamField body="resolution" type="string" default={"1K"}>
  Output resolution for the generated image

  Allowed values: `"1K"`, `"2K"`, `"4K"`.
</ParamField>

<ParamField body="num_images" type="integer" default={1}>
  Number of images to generate

  Minimum: `1`.
  Maximum: `4`.
</ParamField>

<ParamField body="output_format" type="string" default={"png"}>
  Output format for the images

  Allowed values: `"jpeg"`, `"png"`.
</ParamField>

<Accordion title="Complete JSON schema">
  ```json theme={null}
  {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "required": [
      "prompt"
    ],
    "properties": {
      "prompt": {
        "type": "string",
        "title": "Prompt",
        "minLength": 2,
        "maxLength": 32000,
        "description": "The prompt for image generation"
      },
      "image_size": {
        "enum": [
          "square",
          "portrait_4_3",
          "portrait_16_9",
          "portrait_5_4",
          "portrait_3_2",
          "landscape_4_3",
          "landscape_16_9",
          "landscape_5_4",
          "landscape_3_2"
        ],
        "type": "string",
        "title": "Image Size",
        "default": "square",
        "x-ui-name": "aspect_ratio",
        "description": "Aspect ratio for the generated image"
      },
      "quality": {
        "enum": [
          "low",
          "medium",
          "high"
        ],
        "type": "string",
        "title": "Quality",
        "default": "medium",
        "description": "Quality for the generated image",
        "x-advance-settings": true
      },
      "resolution": {
        "enum": [
          "1K",
          "2K",
          "4K"
        ],
        "type": "string",
        "title": "Resolution",
        "default": "1K",
        "x-advance-settings": true,
        "description": "Output resolution for the generated image"
      },
      "num_images": {
        "type": "integer",
        "title": "Number of Images",
        "default": 1,
        "maximum": 4,
        "minimum": 1,
        "x-ui-name": "output_nums",
        "description": "Number of images to generate"
      },
      "output_format": {
        "enum": [
          "jpeg",
          "png"
        ],
        "type": "string",
        "title": "Output Format",
        "default": "png",
        "description": "Output format for the images",
        "x-advance-settings": true
      }
    }
  }
  ```
</Accordion>

## Response

The request returns the task with `status: "initializing"`. Poll [GET /api/asset\_generator/\{id}/](/api-reference/ai-generation/get-ai-generation-) until `status` is `done` or `failed`, or pass a `webhook_url` to be notified. A finished task lists its files in `assets` and the credits it charged in `credits_used`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.