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

# GPT-Image-2

GPT Image 2 is an OpenAI model for quickly generating and editing high-quality images. It supports multiple output sizes, high-fidelity image inputs, and both text-to-image and image-to-image generation.

### Model parameters

* Model ID: `gpt-image-2`
* Pricing: Check the [model details page](https://geekai.co/models/gpt-image-2) for current prices.
* Endpoint: `https://geekai.co/api/v1/images/generations`
* Parameters: See the [Image API reference](https://docs.geekai.co/en/api/image/generations.md).
* Authentication: [Get an API key](https://geekai.co/user/api_keys).

> [!NOTE]
>
> The following common Image API parameters are not supported:
>
> * `negative_prompt`
> * `seed`
> * `strength`
> * `aspect_ratio`
> * `style_preset`
>
> See also: [Official GPT-Image-2 API documentation](https://developers.openai.com/api/docs/guides/image-generation).

For GPT-Image-2, `size` accepts any size that meets these requirements:

* Both width and height must be integer multiples of 16.
* Neither dimension may exceed 3840 pixels.
* The total pixel count must be between 655360 and 8294400.
* The aspect ratio must not exceed 3:1.

### Pricing

GPT-Image-2 prices vary by size and quality:

| Quality (`quality`) | Size (`size`) | Price (CNY/image) |
| - | - | - |
| low | 1024x1024 | 0.045 |
| low | 1024x1536 | 0.036 |
| low | 1536x1024 | 0.036 |
| low | 2048x2048(2K) | 0.09 |
| low | 2048x1152(2K) | 0.036 |
| low | 3840x2160(4K) | 0.084 |
| low | 2160x3840(4K) | 0.084 |
| medium | 1024x1024 | 0.398 |
| medium | 1024x1536 | 0.311 |
| medium | 1536x1024 | 0.311 |
| medium | 2048x2048(2K) | 0.808 |
| medium | 2048x1152(2K) | 0.32 |
| medium | 3840x2160(4K) | 0.755 |
| medium | 2160x3840(4K) | 0.755 |
| high | 1024x1024 | 1.59 |
| high | 1024x1536 | 1.24 |
| high | 1536x1024 | 1.24 |
| high | 2048x2048(2K) | 3.231 |
| high | 2048x1152(2K) | 1.28 |
| high | 3840x2160(4K) | 3.02 |
| high | 2160x3840(4K) | 3.02 |

> [!NOTE]
>
> These prices are examples for common sizes. GPT-Image-2 supports many other sizes; the actual price depends on the size and quality you select.

For GPT-Image-2, `quality` defaults to `medium` and `size` defaults to `1024x1024`.

When using a GeekAI [discounted proxy channel](https://docs.geekai.co/en/docs/model_price.md), multiply the listed price by the channel’s discount factor. For example, the default high-availability channel has a factor of `0.5`. An image with `size` set to `1024x1024` and `quality` set to `medium` costs `0.398 x 0.5 = 0.199` CNY. At the same size but with `quality` set to `high`, it costs `1.586 x 0.5 = 0.793` CNY. Apply the same calculation to other settings.

### Text-to-image generation

Generate an image from a text description:

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"gpt-image-2",
    "prompt":"Draw a cute kitten playing in the grass"
}'
```

### Image-to-image generation

**Single image**

Edit an existing image using a text instruction to generate a new image:

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"gpt-image-2",
    "prompt":"Restore this damaged photo",
    "image":"https://static.geekai.co/storage/2025/04/02/broken-picture.jpg"
}'
```

GPT-Image-2 supports the image editing endpoint. Here is how to use it for image-to-image generation:

```bash json theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/edits' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model": "gpt-image-2",
    "prompt": "Restore this damaged photo",
    "image": "https://static.geekai.co/storage/2025/04/02/broken-picture.jpg"
}'
```

```bash form theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/edits' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--form 'model="gpt-image-2"' \
--form 'prompt="Restore this damaged photo"' \
--form 'image=@/path/to/your/local/image.jpg'
```

> [!NOTE]
>
> `image` accepts an image URL or a Base64-encoded image. For the mainland China version, use a URL publicly accessible from mainland China; otherwise, send the image as Base64.

**Multiple images**

Combine styles or elements from several reference images. For example, combine clothes, shoes, and accessories with a model photo to show an outfit, or place a person in a landscape:

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"gpt-image-2",
    "prompt": "Apply the fabric from image 1 to the clothing in image 2. Use the aspect ratio of image 2.",
    "image": [
        "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/针织.jpg",
        "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/款式图.jpg"
    ],
    "quality": "high",
    "background": "auto",
    "output_format": "png",
    "response_format": "url",
    "async": true
}'
```

The image editing endpoint also supports multiple images:

```bash json theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/edits' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model": "gpt-image-2",
    "prompt": "Apply the fabric from image 1 to the clothing in image 2. Use the aspect ratio of image 2.",
    "image": [
        "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/针织.jpg",
        "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/款式图.jpg"
    ],
    "quality": "high",
    "background": "auto",
    "output_format": "png",
    "response_format": "url",
    "async": true
}'
```

```bash form theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/edits' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--form 'model="gpt-image-2"' \
--form 'prompt="Apply the fabric from image 1 to the clothing in image 2. Use the aspect ratio of image 2."' \
--form 'image[]=@/path/to/your/local/image1.jpg' \
--form 'image[]=@/path/to/your/local/image2.jpg'
```

> [!NOTE]
>
> For long-running requests, set `async` to `true` to enable asynchronous processing. The endpoint returns a `task_id`. Poll `https://geekai.co/api/v1/images/{task_id}` for the latest status and retrieve the final image URL when the task completes. See [Asynchronous image generation](https://docs.geekai.co/en/docs/image/txt2img.md#asynchronous-image-generation).


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