# GPT Image 2 Text-to-Image

Generate an image from a prompt.

`POST /api/v1/images/generations`

## Overview

GPT Image 2 adds sharper text rendering and layout control compared with the first generation, and follows long instructions closely.

## Parameters

- `model` (string) — required: Model ID, e.g. gpt-image-2-text-to-image.
- `prompt` (string) — required: Image description.
- `size` (string): One of "1024x1024", "1536x1024", "1024x1536".
- `quality` (string): One of "low", "medium", "high".
- `n` (integer): Number of images to return. Default 1.

## Example

```bash
curl -X POST https://capi.minapp.xin/api/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2-text-to-image",
    "prompt": "a minimal poster for a night train"
  }'
```

## Response

```json
{
  "data": [
    { "url": "https://file.capi.minapp.xin/images/out-1.png" }
  ],
  "cost": { "amount": 0.03, "currency": "USD" }
}
```
