# OpenAI GPT Image 2 Text to Image API

> GPT Image 2, OpenAI's latest image model, is capable of making fine-grained, detailed edits to images.

Source: https://www.sandbase.ai/models/openai/gpt-image-2
API reference: https://www.sandbase.ai/models/openai/gpt-image-2/docs

## Facts

- Provider: OpenAI
- Type: Image model
- Model ID: `openai/gpt-image-2`
- Price: From $0.17 per run (25% off list price)
- Capabilities: text to image, commercial
- Billing: pay per use from one SandBase balance; no provider account or subscription needed

## Call it

- Unified Run API: `POST https://api.sandbase.ai/v1/run`

```bash
curl -X POST https://api.sandbase.ai/v1/run \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "openai/gpt-image-2",
  "prompt": "Generate an image of gray tabby cat hugging an otter with an orange scarf",
  "quality": "high",
  "aspect_ratio": "1:1",
  "output_format": "png"
}'
```

The response returns a run id; poll `GET https://api.sandbase.ai/v1/run/{id}` until the status is `completed` or `failed`.

## FAQ

### How do I call OpenAI GPT Image 2 Text to Image through SandBase?

Create a SandBase API key, then send requests with the model ID "openai/gpt-image-2" to Unified Run API (/v1/run) at https://api.sandbase.ai. The request examples on this page show the exact payload.

### Do I need a separate OpenAI account?

No. One SandBase API key and balance gives you access to OpenAI GPT Image 2 Text to Image and the other models in the catalog; you do not need to sign up with OpenAI separately.

## README

### GPT Image 2 Text to Image

GPT Image 2 generates detailed images with strong instruction following and accurate in-image text, at three quality levels and 1K to 4K.

#### Fields

| Field | Type | Default | Notes |
|---|---|---|---|
| `prompt` | string, required | — | Up to 50,000 characters. |
| `quality` | `low` / `medium` / `high` | `high` | Higher quality costs more; `high` is the default. |
| `resolution` | `1k` / `2k` / `4k` | — | Output size tier; omit for 1K. |
| `aspect_ratio` | `1:1` / `1:2` / `2:1` / `1:3` / `3:1` / `2:3` / `3:2` / `3:4` / `4:3` / `4:5` / `5:4` / `9:16` / `16:9` / `9:21` / `21:9` | `1:1` | Output frame shape. |
| `output_format` | `jpeg` / `png` / `webp` | `png` | Output file format. |

#### Billing

Price depends on quality and resolution, per image:

| Quality | 1k | 2k | 4k |
|---|---|---|---|
| low | $0.01 | $0.02 | $0.03 |
| medium | $0.06 | $0.10 | $0.18 |
| high (default) | $0.22 | $0.40 | $0.72 |

Failed runs are not charged.

#### Prompting

- Quote any text that must appear.
- Draft at `low`, finish at `high`.

#### Limits

- One image per request.

#### Also on SandBase

Other GPT Image endpoints: `openai/gpt-image-2.5-sunburst`, `openai/gpt-image-2.5-sunburst/edit`, `openai/gpt-image-2.5-flare`, `openai/gpt-image-2.5-flare/edit`, `openai/gpt-image-2/edit`.
