# gpt-image-2

GPT Image 2 combines OpenAI's GPT-5.4 model with state-of-the-art image generation capabilities from GPT Image 2. It enables rich multimodal workflows, allowing users to seamlessly move between reasoning, coding, and visual generation within the same interaction.

GPT Image 2 把 OpenAI 的 GPT-5.4 与 GPT Image 2 的生图能力合在一起，支持高质量生图。同一轮交互里可以在推理、编程和视觉生成之间切换。

- Provider: OpenAI
- Billing Mode: Pay per request
- Label: 营销, 搜索优化
- Model ID: `gpt-image-2`
- Web: https://en.llmoxy.com/models/gpt-image-2

## Pricing

| Token Group | Per request |
| --- | --- |
| GPT Image 2 生图（0.2 / 张） | ￥0.20 / request |
| GPT 系列 | ￥0.30 / request |

## Quick start

Set the LLMOXY_KEY environment variable to your API key before running.

### Image Generation

#### cURL

```bash
curl https://llmoxy.com/v1/images/generations \
  -H "Authorization: Bearer $LLMOXY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "An orange cat sunbathing on a windowsill",
    "size": "1024x1024"
  }'
```

#### Python

```python
import base64
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://llmoxy.com/v1",
    api_key=os.environ["LLMOXY_KEY"],
)

img = client.images.generate(
    model="gpt-image-2",
    prompt="An orange cat sunbathing on a windowsill",
    size="1024x1024",
)
with open("image.png", "wb") as f:
    f.write(base64.b64decode(img.data[0].b64_json))
```

#### Node.js

```javascript
import fs from "node:fs";
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://llmoxy.com/v1",
  apiKey: process.env.LLMOXY_KEY,
});

const img = await client.images.generate({
  model: "gpt-image-2",
  prompt: "An orange cat sunbathing on a windowsill",
  size: "1024x1024",
});
fs.writeFileSync("image.png", Buffer.from(img.data[0].b64_json, "base64"));
```

### Chat Completions

#### cURL

```bash
curl https://llmoxy.com/v1/chat/completions \
  -H "Authorization: Bearer $LLMOXY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

## Endpoints

- Image Generation: `POST https://llmoxy.com/v1/images/generations`
- Chat Completions: `POST https://llmoxy.com/v1/chat/completions`

## FAQ

### How much does gpt-image-2 cost on LLMoxy?

Pay per request. Price in the “GPT Image 2 生图（0.2 / 张）” token group: ￥0.20 / request. Prices differ between token groups; see the price table on this page for each group.

### How do I call gpt-image-2?

Create an API key in the LLMoxy console, set model to gpt-image-2, and send the request to: Image Generation POST https://llmoxy.com/v1/images/generations, Chat Completions POST https://llmoxy.com/v1/chat/completions. You can also use the OpenAI SDK directly with the base URL set to https://llmoxy.com/v1.

### Which token groups can I use with gpt-image-2?

The token group sets the price you pay: you pick a group when you create an API key in the console, and every call made with that key is billed at that group’s price. Groups available for gpt-image-2: GPT Image 2 生图（0.2 / 张）, GPT 系列.

### Do I need an international credit card?

No. Top up your balance in the console first; each call is then deducted from the balance based on actual usage. Payment methods: Alipay, WeChat Pay, Visa / MasterCard, Apple Pay, and crypto such as USDT, BTC, SOL, and TRX. Multi-currency support.

## More from OpenAI

- [gpt-image-2.5-flare](https://en.llmoxy.com/models/gpt-image-2.5-flare.md): ￥0.20 / request
- [gpt-image-2.5-sunburst](https://en.llmoxy.com/models/gpt-image-2.5-sunburst.md): ￥0.20 / request
- [gpt-6-astra](https://en.llmoxy.com/models/gpt-6-astra.md): In ￥3.00 / 1M
- [gpt-6-sol](https://en.llmoxy.com/models/gpt-6-sol.md): In ￥0.60 / 1M
- [gpt-6.1-sol](https://en.llmoxy.com/models/gpt-6.1-sol.md): In ￥0.60 / 1M
- [gpt-6.1-terra](https://en.llmoxy.com/models/gpt-6.1-terra.md): In ￥0.30 / 1M

## Links

- [All model prices](https://en.llmoxy.com/pricing.md)
- [Documentation](https://en.llmoxy.com/docs/api-reference/api-overview.md)
- [llms.txt](https://en.llmoxy.com/llms.txt)

This is the markdown version of https://en.llmoxy.com/models/gpt-image-2.
