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

# GPT Image 2 C

> gpt-image-2-c — the cost-effective variant of OpenAI GPT Image 2. Same flexible resolution and near-perfect text rendering, with response_format support. Does not support the n parameter.

gpt-image-2-c is the cost-effective variant of GPT Image 2, available through Anyfast API. It keeps GPT Image 2's autoregressive + reasoning hybrid architecture — flexible resolution up to 4K and near-perfect text rendering — while supporting `response_format` and offering a lower price point. Unlike the official `gpt-image-2`, it does **not** support the `n` parameter (one image per request).

## Key capabilities

* **Text-to-Image** — Generate images from natural language descriptions
* **Image editing** — Edit an existing image with a text prompt via `/v1/images/edits`
* **Flexible resolution** — Any custom size up to 4K (3840px), edges must be multiples of 16
* **Near-perfect text rendering** — \~99% character-level accuracy across 12+ languages
* **`response_format` support** — Return generated/edited images as a pre-signed `url` or base64 (`b64_json`)
* **Cost-effective** — A lower-cost alternative to `gpt-image-2`

> `gpt-image-2-c` does **not** support the `n` parameter — each request returns a single image. For multi-image output (`n`), use `gpt-image-2`.

## Output specifications

| Property              | Value                                                                      |
| --------------------- | -------------------------------------------------------------------------- |
| Sizes                 | Flexible resolution (e.g. 1024x1024, 2048x2048, 3840x2160)                 |
| Size constraints      | Edges: multiples of 16, aspect ratio ≤ 3:1, total pixels 655,360–8,294,400 |
| Quality               | low, medium, high                                                          |
| Output formats        | png, jpeg                                                                  |
| Input formats (edits) | png, jpeg                                                                  |

## Quick example

<CodeGroup>
  ```bash cURL theme={null}
  curl https://www.anyfast.ai/v1/images/generations \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-image-2-c",
      "prompt": "A futuristic city skyline at sunset with flying cars",
      "size": "2048x2048",
      "quality": "high",
      "response_format": "url"
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="YOUR_API_KEY",
      base_url="https://www.anyfast.ai/v1"
  )

  response = client.images.generate(
      model="gpt-image-2-c",
      prompt="A futuristic city skyline at sunset with flying cars",
      size="2048x2048",
      quality="high"
  )

  print(response.data[0].url)
  ```
</CodeGroup>

## Parameters

| Parameter            | Type    | Required | Description                                                                                                                                          |
| -------------------- | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model`              | string  | Yes      | Must be `gpt-image-2-c`                                                                                                                              |
| `prompt`             | string  | Yes      | Text description of the desired image                                                                                                                |
| `size`               | string  | No       | `{width}x{height}` format. Edges must be multiples of 16, aspect ratio ≤ 3:1, total pixels 655,360–8,294,400, max edge 3,840px. Default: `1024x1024` |
| `quality`            | string  | No       | `low`, `medium`, `high`. Default: `medium`                                                                                                           |
| `output_format`      | string  | No       | `png`, `jpeg`. Default: `png`                                                                                                                        |
| `moderation`         | string  | No       | `auto` or `low`. Default: `auto`                                                                                                                     |
| `output_compression` | integer | No       | Compression level for jpeg (0–100).                                                                                                                  |
| `response_format`    | string  | No       | `url`, `b64_json`. Default: `url`                                                                                                                    |

<Note>
  `gpt-image-2-c` does not support the `n` parameter. To generate multiple images in one request, use [`gpt-image-2`](/api-reference/model-api/openai/gpt-image-2).
</Note>

## Image editing

Edit an existing image with a text prompt via `POST /v1/images/edits`. Use multipart/form-data and pass images as file uploads.

**Supports up to 16 input images** per request (`image[]`).

### Input image formats

Supported formats: **PNG, JPEG**. Images must be provided as **multipart/form-data file uploads**.

<CodeGroup>
  ```bash Single image theme={null}
  curl https://www.anyfast.ai/v1/images/edits \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "image=@/path/to/source.jpeg" \
    -F model="gpt-image-2-c" \
    -F prompt="Change the background to a sunset over the ocean" \
    -F size="1024x1024"
  ```

  ```bash Multiple images (up to 16) theme={null}
  curl https://www.anyfast.ai/v1/images/edits \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "image[]=@/path/to/image1.png" \
    -F "image[]=@/path/to/image2.png" \
    -F "image[]=@/path/to/image3.png" \
    -F model="gpt-image-2-c" \
    -F prompt="Generate a gift basket containing all the items in the reference images" \
    -F size="1024x1024"
  ```
</CodeGroup>

### Edit parameters

| Parameter            | Type       | Required | Description                                                                                                                                                                        |
| -------------------- | ---------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `image`              | file       | Yes      | Single source image (PNG or JPEG, multipart upload)                                                                                                                                |
| `image[]`            | file array | Yes\*    | Multiple source images — up to **16** images (PNG or JPEG). Use instead of `image` for multi-image input                                                                           |
| `mask`               | file       | No       | Mask image with an alpha channel. Same format and size as source (\< 50MB). Applied to the first image when multiple images are provided. **Requires selecting the Direct group.** |
| `model`              | string     | Yes      | Must be `gpt-image-2-c`                                                                                                                                                            |
| `prompt`             | string     | Yes      | Edit instruction text                                                                                                                                                              |
| `size`               | string     | No       | `{width}x{height}`. Default: `1024x1024`                                                                                                                                           |
| `output_format`      | string     | No       | `png`, `jpeg`. Default: `png`                                                                                                                                                      |
| `output_compression` | integer    | No       | Compression level for jpeg (0–100)                                                                                                                                                 |
| `response_format`    | string     | No       | `url`, `b64_json`. Default: `url`                                                                                                                                                  |

> Use either `image` (single file) or `image[]` (array) — not both.

### Mask editing

Provide a mask image with an alpha channel to control which areas of the source image to edit. Pixels with white (opaque) alpha are preserved; pixels with black (transparent) alpha are edited.

Requirements:

* The mask must contain an **Alpha channel**
* Must be the **same image format and same dimensions** as the source image
* File size limit: \< 50MB

> Mask editing **requires selecting the Direct group** in the console.

```bash cURL theme={null}
curl https://www.anyfast.ai/v1/images/edits \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F image=@/path/to/source.jpeg \
  -F mask=@/path/to/mask.png \
  -F model="gpt-image-2-c" \
  -F prompt="Replace the background with a futuristic cityscape" \
  -F size="2048x2048"
```

If your mask is a black-and-white image without an alpha channel, convert it first:

```python Python theme={null}
from PIL import Image
import numpy as np

img = Image.open("bw_mask.png").convert("L")
alpha = np.array(img)
rgba = np.zeros((*alpha.shape, 4), dtype=np.uint8)
rgba[alpha > 0] = [255, 255, 255, 255]
Image.fromarray(rgba).save("mask.png")
```

<CardGroup cols={2}>
  <Card title="Generate API Reference" icon="code" href="/api-reference/model-api/openai/gpt-image-2-c">
    Interactive playground for `POST /v1/images/generations`.
  </Card>

  <Card title="Edit API Reference" icon="pen-to-square" href="/api-reference/model-api/openai/gpt-image-2-c-edit">
    Interactive playground for `POST /v1/images/edits`.
  </Card>
</CardGroup>

<script src="/feedback.js" />
