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

# GPT Image 2

> gpt-image-2 — OpenAI's image model, generation and editing. $0.16/image.

|              |                                                                         |
| ------------ | ----------------------------------------------------------------------- |
| **Model ID** | `gpt-image-2`                                                           |
| **Provider** | OpenAI                                                                  |
| **Cost**     | \$0.16/img                                                              |
| **Tier**     | Ultra                                                                   |
| **Speed**    | \~10-20s                                                                |
| **Best for** | Photorealistic generation, precise prompt-following, in-context editing |

## Description

OpenAI's image model, handling both generation and editing in one model — pass an `image` to edit, omit it to generate from scratch. Strong prompt adherence and legible in-image text.

## Features

* Text-to-image
* Image editing (single model handles both)
* Strong text rendering
* High prompt adherence

## Example

```bash theme={null}
curl -X POST https://www.ninjachat.ai/api/v1/images \
  -H "Authorization: Bearer nj_sk_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-image-2", "prompt": "A lighthouse in a storm, dramatic lighting"}'
```

```python theme={null}
import requests, os

r = requests.post("https://www.ninjachat.ai/api/v1/images",
    headers={"Authorization": f"Bearer {os.environ['NINJACHAT_API_KEY']}"},
    json={
        "model": "gpt-image-2",
        "prompt": "A lighthouse in a storm, dramatic lighting"
    }
)
print(r.json()["images"][0]["url"])
```

***

**Guides:** [Image Generation](/image-generation) | [All Models](/models) | [Pricing](/pricing) | [Error Handling](/error-handling)
