Inputlive schema
Sign in to run this model with your own API key. Sign in →
GPT-Image 2 是 OpenAI 的图像生成与编辑模型,适合文字生成图片、参考图改图、商品图优化、海报素材、创意概念图和营销视觉制作。它适合需要较高画面质量、指令理解和商业可用性的图片生成场景。
Sign in to run this model with your own API key. Sign in →
Run the form on the left. Results, polling status and cURL appear under the form.
This model is priced by the usage dimensions listed here. Compare all pricing.
List prices in USD. Your effective price also depends on the billing group attached to your API key.
gpt-image-2-oaigpt-image-2-oaigpt-image-2-oaigpt-image-2-oaigpt-image-2-oai/v1/images/generationsconst BASE_URL = "https://api.dreamtoai.com";
const API_KEY = process.env.MIX_API_KEY;
const headers = {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
};
const payload = {
"model": "gpt-image-2-oai",
"input": {
"prompt": "生成一张产品海报,白色背景,商业摄影风格",
"image_url": "https://example.com/input.png",
"reference_images": [
"https://example.com/reference.png"
],
"mask": "https://example.com/mask.png",
"size": "2752x1536",
"quality": "medium",
"output_format": "png",
"background": "auto",
"n": 1,
"user": "user-123",
"style": "Describe the output you want",
"response_format": "url"
}
};
const submit = await fetch(`${BASE_URL}/v1/jobs`, {
method: "POST",
headers,
body: JSON.stringify(payload),
}).then((r) => r.json());
const status = await fetch(`${BASE_URL}/v1/jobs/${submit.id}`, { headers })
.then((r) => r.json());
console.log(status);
Create a key in Console → API Keys and replace the placeholder in the sample.
README
GPT-Image 2 是 OpenAI 的图像生成与编辑模型,适合文字生成图片、参考图改图、商品图优化、海报素材、创意概念图和营销视觉制作。它适合需要较高画面质量、指令理解和商业可用性的图片生成场景。
| Parameter | Required | Description |
|---|---|---|
promptstring | Required | Text description of what to generate. |
image_urlimage | Optional | Reference image to guide the result. |
reference_imagesarray | Optional | 参考图 |
maskimage | Optional | 遮罩图 |
sizestring | Optional | Output image size. |
qualityenum | Optional | Output quality level. Options: auto, low, medium, high. Default: auto. |
output_formatenum | Optional | 输出格式 Options: png, jpeg, webp. |
backgroundenum | Optional | 背景 Options: auto, transparent, opaque. |
ninteger | Optional | Number of outputs to generate. |
userstring | Optional | 终端用户标识 |
stylestring | Optional | 风格 |
response_formatenum | Optional | Format of the returned result, such as a URL or base64 data. Options: base64, url. |
The model reads a prompt like a creative brief. Name the subject first, then add the details that matter.
Who or what is in the image, and what it is doing.
Photo, 3D render, watercolor or flat illustration. For photographic looks, name a lens or film stock.
Framing and viewpoint: close-up, wide shot, overhead, centered, rule of thirds.
Golden hour, soft studio light, neon, a pastel palette, high contrast.
Put the exact words in quotes and say where they go.
A poster with the headline "OPEN LATE" in bold white letters across the top.
| Prompt | |
|---|---|
| Weak | a coffee shop |
| Strong | A cozy corner coffee shop on a rainy evening, seen through the front window. Warm tungsten light inside, a barista pouring latte art, condensation on the glass, street reflections. 35mm photo, shallow depth of field, muted teal and amber palette. |
| Billing item | Price | Official price |
|---|---|---|
| 文本输入 Tokens | $4.00 per 1M | |
| 图片输入 Tokens | $6.40 per 1M | |
| 缓存文本输入 Tokens | $1.00 per 1M | |
| 缓存图片输入 Tokens | $1.60 per 1M | |
| 图片输出 Tokens | $24.00 per 1M |
That is 20% below the official list price.
List prices in USD. Your effective price also depends on the billing group attached to your API key. Compare all pricing
gpt-image-2-5-flaregpt-image-2Browse all image modelsBrowse API Market
GPT-Image 2 是 OpenAI 的图像生成与编辑模型,适合文字生成图片、参考图改图、商品图优化、海报素材、创意概念图和营销视觉制作。它适合需要较高画面质量、指令理解和商业可用性的图片生成场景。
Send POST /v1/images/generations with the model ID gpt-image-2-oai and your API key. Ready-to-run samples are in the API section above.
Requests are billed at the prices listed above and charged to your wallet. Final cost depends on usage and the billing group attached to your API key.
Create one in Console → API Keys. The same key works for every model on the gateway.
Yes. You can use what you generate in commercial projects, subject to the model provider’s terms.
GPT-Image 2 是 OpenAI 的图像生成与编辑模型,适合文字生成图片、参考图改图、商品图优化、海报素材、创意概念图和营销视觉制作。它适合需要较高画面质量、指令理解和商业可用性的图片生成场景。