# GPT Image 2 — /images/generations

OpenAI 兼容的图片生成接口。文生图只需 prompt；图生图额外传入 image 参考图 URL，模型在其基础上生成。

**端点:** `POST https://nezhagate.com/v1/images/generations`

## 认证
```
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```

## 请求参数
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `model` | string | 是 | 模型 ID，固定为 gpt-image-2。 |
| `prompt` | string | 是 | 图片描述提示词。 |
| `size` | string | 否 | 尺寸：1024x1024 / 1024x1536 / 1536x1024。 |
| `n` | integer | 否 | 生成数量，默认 1。 |
| `image` | string | 否 | 图生图模式：参考图 URL。提供后在其基础上生成。 |

## 请求示例
```bash
curl https://nezhagate.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "a serene ink-wash poster, lots of negative space",
    "size": "1024x1024",
    "n": 1
  }'
```

## 响应示例
```json
{
  "created": 1710000000,
  "model": "gpt-image-2",
  "data": [{"url": "https://.../image.png"}]
}
```