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

# GPT Image 2 Economy

> GPT Image 2 Economy: the per-request route of GPT Image 2, the same model at a lower price in 1K / 2K / 4K tiers by output size, for cost-sensitive batch jobs.

GPT Image 2 Economy (`gpt-image-2-economynomy`) is the economy route of [GPT Image 2](https://docs.dreamto.ai/en/image/models/gpt-image-2.md): the same OpenAI model as `gpt-image-2`, billed per request at a lower price, for cost-sensitive batch jobs that can wait longer. Endpoints, parameters and responses are the same as for the standard model; just set `model` to `gpt-image-2-economynomy`. For the per-request routes of GPT Image 2.5 / 2.6 see [GPT Image 2.5 Economy](https://docs.dreamto.ai/en/image/models/gpt-image-2-5-economy.md) and [GPT Image 2.6 Economy](https://docs.dreamto.ai/en/image/models/gpt-image-2-6-economy.md).

## Setup

| | OpenAI | DreamTo |
| - | - | - |
| Base URL | `https://api.openai.com/v1` | `https://api.dreamto.ai/v1` |
| API Key | OpenAI API key | API Key from the DreamTo console, in the `Authorization: Bearer` header |

## Endpoints

| Endpoint | Purpose |
| - | - |
| [`POST /v1/images/generations`](https://docs.dreamto.ai/en/api-reference/gpt-image-2-economy/create-image) | Create image |
| [`POST /v1/images/edits`](https://docs.dreamto.ai/en/api-reference/gpt-image-2-economy/edit-image) | Edit image |

## Parameters

| Field | Values |
| - | - |
| `prompt` | Required, up to 32,000 characters |
| `size` | `auto` (default) or `WIDTHxHEIGHT`: both edges multiples of 16, longest edge ≤ 3840, long-to-short ratio ≤ 3:1, total pixels 655,360–8,294,400. Common: `1024x1024`, `1536x1024`, `1024x1536`, `2048x2048`, `2048x1152`, `3840x2160`, `2160x3840`; above `2560x1440` is experimental upstream |
| `quality` | `auto` (default) / `low` / `medium` / `high` |
| `n` | 1–10, default 1 |
| `background` | `auto` (default) / `opaque` / `transparent`; transparency is a preview feature upstream and needs `png` or `webp` |
| `output_format` | `png` (default) / `jpeg` / `webp` |
| `output_compression` | 0–100, default 100, `jpeg` / `webp` only |
| `stream` | `true` streams SSE events; `partial_images` sets 0–3 previews |

### Official parameters not supported yet

They return 400; the model is not called and nothing is charged.

| Parameter | Note |
| - | - |
| `response_format` | Not supported by GPT Image models upstream; images are always returned as `b64_json` |
| `images` | JSON edit input is not supported yet; upload `image[]` as `multipart/form-data` |

## Pricing

Billed per request, not per token, in 1K / 2K / 4K tiers by output size. See the [model catalog](https://www.dreamto.ai/models) and the console for current prices. Invalid requests and failed generations are not charged.

## Quick start

`$DREAMTO_API_KEY` is your API Key.

```bash cURL theme={null}
curl -X POST "https://api.dreamto.ai/v1/images/generations" \
  -H "Authorization: Bearer $DREAMTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2-economynomy",
    "prompt": "An orange cat in an astronaut helmet floating in space with Earth behind it, photorealistic",
    "size": "1024x1024",
    "quality": "medium"
  }'
```

```python Python theme={null}
import base64
import os

from openai import OpenAI

client = OpenAI(base_url="https://api.dreamto.ai/v1", api_key=os.environ["DREAMTO_API_KEY"])

result = client.images.generate(
    model="gpt-image-2-economynomy",
    prompt="An orange cat in an astronaut helmet floating in space with Earth behind it, photorealistic",
    size="1024x1024",
    quality="medium",
)
with open("output.png", "wb") as f:
    f.write(base64.b64decode(result.data[0].b64_json))
```

### Edit an image

`/v1/images/edits` takes the images as `multipart/form-data` files; repeat `image[]` for several reference images:

```bash cURL theme={null}
curl -X POST "https://api.dreamto.ai/v1/images/edits" \
  -H "Authorization: Bearer $DREAMTO_API_KEY" \
  -F "model=gpt-image-2-economynomy" \
  -F "prompt=Print the logo from the second image on the tote bag in the first image; keep the product-photo style" \
  -F "image[]=@product.png" \
  -F "image[]=@logo.png" \
  -F "size=1024x1024" \
  -F "quality=medium"
```

## Notes

* Edits take `multipart/form-data` file uploads (`image[]`, `mask`); the newer JSON `images` / `file_id` form is not supported yet.
* As with OpenAI, images are returned as Base64 (`data[].b64_json`) only; `response_format` is not supported.
* Parameters the gateway does not declare (such as `response_format`) return 400; the model is not called and nothing is charged.
* Errors use the DreamTo error envelope (see the error examples of each endpoint).


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