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

# GPT Image 2 API

> Quickstart for OpenAI GPT Image 2 — text-to-image and image editing with quality tiers.

## Overview

**GPT Image 2** is OpenAI's latest image model, available on RouterBase. It supports text-to-image and image editing, with three quality tiers (`low` / `medium` / `high`) priced separately on each request.

|                     |                         |
| ------------------- | ----------------------- |
| **Provider**        | OpenAI                  |
| **Family**          | `gpt-image-2`           |
| **Modality**        | Image                   |
| **Supported tasks** | `text-to-image`, `edit` |

## Endpoint

```http theme={null}
POST https://routerbase.com/v1/images/generations
```

## Pricing

GPT Image 2 is billed on OpenAI's token model, at **5% below** OpenAI's
published rates. A request has up to three components:

| Component                 | Rate (before the 5% discount) | Notes                                                                                                       |
| ------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------- |
| Image **output**          | by `size` × `quality`         | The dominant cost — scales with resolution and quality tier. Billed **per image**, so `n` images cost `n×`. |
| **Prompt** text input     | \$5 / 1M tokens               | Your prompt, tokenized server-side. Negligible for short prompts.                                           |
| Reference **image** input | \$8 / 1M tokens               | `edit` only — each input image is tokenized by its pixel dimensions (32px patches, ≤1536 tokens/image).     |

So the charge for a request is:

```text theme={null}
charge = ( n × output(size, quality)
         +     prompt_tokens     × $5/1M
         +     image_in_tokens   × $8/1M ) × 0.95
```

The exact rate is resolved server-side at submit time and stored on the
generation row, so the charge always matches the request shape. For multi-image
requests you're billed only for the images **actually returned**.

## Playground

* [Text-to-image](https://routerbase.com/models/openai/gpt-image-2/text-to-image)
* [Edit](https://routerbase.com/models/openai/gpt-image-2/edit)

## Supported Tasks

* [`text-to-image`](/openai-gpt-image-2-api/text-to-image)
* [`edit`](/openai-gpt-image-2-api/edit)

## Authentication

```bash theme={null}
curl https://routerbase.com/v1/images/generations \
  -H "Authorization: Bearer $ROUTERBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/gpt-image-2-t2i", "prompt": "…"}'
```
