# Synchronous call (GPT-Image)

**What**：Generate an image synchronously via the OpenAI Images protocol — a single request returns the image (url or b64_json), no polling.

**When**：Use when you want the result synchronously (no polling), or already use an OpenAI SDK / images client.

## Endpoints
- POST `/v1/images/generations`（OpenAI Images protocol · text-to-image，synchronous, no taskId / no polling）
- POST `/v1/images/edits`（Image-to-image (edits), multipart/form-data）
- POST `/v1/images/variations`（Image variations, multipart/form-data）

> This synchronous endpoint uses the OpenAI Images protocol and is offered in parallel with the async GPT-Image channel (POST /api/cqt/generator/gpt-image); a single request returns the image directly — no taskId, no polling. ⚠ This synchronous channel and the async GPT-Image channel are billed differently — the same model may cost a different amount on each, so check the pricing page. This page has 3 endpoints: text-to-image POST /v1/images/generations (JSON, below), image-to-image (edit) POST /v1/images/edits, and image variations POST /v1/images/variations (the latter two are multipart — see the sections further down).

## Request params
| Param | Type | Required | Description |
| --- | --- | --- | --- |
| model | string | Yes | gpt-image-1 / gpt-image-1.5 / gpt-image-2 / gpt-image-2.5-flare / gpt-image-2.5-sunburst |
| prompt | string | Yes | Image description |
| size | string | — | Output size (official pixels, default 1024x1024) |
| response_format | string | — | url (a stable, long-lived link on our CDN — it does not expire shortly after generation) or b64_json (inline image data; gpt-image-1 often returns this) |

## Request example
```bash
curl -X POST https://api.novapi.ai/v1/images/generations \
  -H 'Authorization: Bearer <API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gpt-image-2",
    "prompt": "a red panda astronaut, studio lighting",
    "size": "1024x1024"
  }'
# -> { "created": 1710000000, "data": [{ "url": "https://.../image.png" }] }
```

## Response example
```json
{
  "created": 1710000000,
  "data": [
    { "url": "https://.../image.png" }
  ]
}
```

## Image-to-image (edits)

Redraw / edit from one or more reference images plus a text prompt (optional mask for inpainting). Uses multipart/form-data; reference images are uploaded as the image[] file field. Billed the same way as text-to-image on this page.

- POST `/v1/images/edits`（multipart/form-data）

| Param | Type | Required | Description |
| --- | --- | --- | --- |
| model | string | Yes | gpt-image-1 / gpt-image-1.5 / gpt-image-2 / gpt-image-2.5-flare / gpt-image-2.5-sunburst |
| image[] | file | Yes | Reference image file(s) (repeat the image[] field for multiple). png / jpg / webp |
| prompt | string | Yes | Edit / redraw description |
| mask | file | — | Optional. Inpainting mask (transparent area = region to redraw); must match the reference image size |
| size | string | — | Output size (official pixels, default 1024x1024) |
| response_format | string | — | url (our CDN link) or b64_json (inline image data) |

```bash
curl -X POST https://api.novapi.ai/v1/images/edits \
  -H 'Authorization: Bearer <API_KEY>' \
  -F model=gpt-image-2 \
  -F image[]=@input.png \
  -F prompt='add a red hat on the cat' \
  -F size=1024x1024
# -> { "created": 1710000000, "data": [{ "url": "https://.../edited.png" }] }
```

## Image variations

Generate style-similar variations of a single reference image (no prompt). Uses multipart/form-data; the reference is uploaded as the image[] file field. Billed the same way as text-to-image on this page.

- POST `/v1/images/variations`（multipart/form-data）

| Param | Type | Required | Description |
| --- | --- | --- | --- |
| model | string | Yes | gpt-image-1 / gpt-image-1.5 / gpt-image-2 / gpt-image-2.5-flare / gpt-image-2.5-sunburst |
| image[] | file | Yes | Reference image file (single). png / jpg / webp |
| size | string | — | Output size (official pixels, default 1024x1024) |
| response_format | string | — | url (our CDN link) or b64_json (inline image data) |

```bash
curl -X POST https://api.novapi.ai/v1/images/variations \
  -H 'Authorization: Bearer <API_KEY>' \
  -F model=gpt-image-2 \
  -F image[]=@input.png \
  -F size=1024x1024
# -> { "created": 1710000000, "data": [{ "url": "https://.../variation.png" }] }
```
