外观
GPT Image 1.5
gpt-image-1.5 适合提示词遵循、文字渲染、干净构图或商业图片质量要求较高的场景。它与 Pixapi 其他图片模型一样,使用 OpenAI 兼容图片字段。
API 形式
| 操作 | Endpoint | 模式 |
|---|---|---|
| 图片生成 | POST /v1/images/generations | 同步 |
| 图片生成任务 | POST /v1/async/images/generations | 异步 |
| 图片编辑 | POST /v1/images/edits | 同步 |
| 图片编辑任务 | POST /v1/async/images/edits | 异步 |
模型 id
| 模型 id | 适合场景 |
|---|---|
gpt-image-1.5 | 提示词遵循较强的 GPT Image 生成与编辑。 |
价格
GPT Image 1.5 仅支持 1K 输出尺寸(1024x1024、1536x1024、1024x1536 或 size=auto)。积分随质量变化。quality=auto 按 high 计费。需要 2K 或 4K 请使用 gpt-image-2。
| 尺寸档 | 支持尺寸 | low | medium | high / auto |
|---|---|---|---|---|
| 1K | 1024x1024、1536x1024、1024x1536、auto | 1 | 4 | 14 |
请求显示的 costCredits 等于矩阵值乘以 n。
请求字段
通用字段放在请求体一级,下面列出的模型专用参数放进 providerOptions。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | gpt-image-1.5. 模型 ID,区分大小写。 |
prompt | string | 是 | 描述主体、构图、风格或需要修改的内容。Pixapi 最多保留前 2,000 字符;生成和编辑都要提供非空提示词。 |
n | integer | 否 | 默认 1,只支持整数 1。 |
size | string | 否 | auto(默认)、1024x1024、1536x1024、1024x1536。GPT Image 1.5 仅支持 1K,不要请求 2K/4K。 |
image | string / string[] | 编辑时必填 | 公网 HTTP(S) 图片 URL 或 URL 数组;/images/edits 必填。 最多 14 个 URL,不支持 Base64 输入。 |
quality | string | 否 | auto(默认)、low、medium、high,较高质量可能耗时更长。 |
providerOptions | object | 否 | 模型专用选项,详见下表。 |
providerOptions
本表所有字段都写在 providerOptions 内,不要与 model 并列。
| 字段 | 类型 | 说明 |
|---|---|---|
output_format | string | 输出图片格式:png(默认,支持透明背景)、jpeg(文件更小,不含 Alpha)、webp(支持透明背景)。 |
background | string | 背景模式:auto(默认)、opaque(不透明)、transparent(透明)。transparent 只能与 output_format: "png" 或 output_format: "webp" 搭配,JPEG 不支持 Alpha 通道。 |
moderation | string | 内容审核强度:auto(默认)或 low(更宽松)。 |
output_compression | integer | 输出压缩强度 0–100,仅对 jpeg 和 webp 输出生效。 |
mask_url | string | 局部重绘的公网 PNG 遮罩 URL。必须传 image,且与第一张图尺寸一致;透明像素表示编辑区域。使用带 Alpha 通道、低于 4 MB 的 PNG。 |
nsfw_check | boolean | 是否审核提示词和图片,默认 false。 |
输入规则
Pixapi 只接受 1 张输出、最多 14 张参考图。输出尺寸请通过 size 指定。
生成示例
bash
curl https://api.pixapi.ai/v1/images/generations \
-H "Authorization: Bearer $PIXAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-1.5",
"prompt": "A polished launch visual for a developer API product",
"n": 1,
"size": "1024x1024"
}'py
import os
import requests
response = requests.post(
"https://api.pixapi.ai/v1/images/generations",
headers={
"Authorization": f"Bearer {os.environ['PIXAPI_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "gpt-image-1.5",
"prompt": "A polished launch visual for a developer API product",
"n": 1,
"size": "1024x1024"
},
)
response.raise_for_status()
print(response.json())js
const response = await fetch('https://api.pixapi.ai/v1/images/generations', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PIXAPI_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "gpt-image-1.5",
"prompt": "A polished launch visual for a developer API product",
"n": 1,
"size": "1024x1024"
}),
});
if (!response.ok) {
throw new Error(await response.text());
}
console.log(await response.json());go
package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte(`{
"model": "gpt-image-1.5",
"prompt": "A polished launch visual for a developer API product",
"n": 1,
"size": "1024x1024"
}`)
req, err := http.NewRequest(
"POST",
"https://api.pixapi.ai/v1/images/generations",
bytes.NewBuffer(body),
)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("PIXAPI_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}编辑示例
bash
curl https://api.pixapi.ai/v1/images/edits \
-H "Authorization: Bearer $PIXAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-1.5",
"prompt": "Replace the background with a bright studio setup",
"image": "https://cdn.example.com/input.png",
"n": 1,
"size": "1024x1024"
}'py
import os
import requests
response = requests.post(
"https://api.pixapi.ai/v1/images/edits",
headers={
"Authorization": f"Bearer {os.environ['PIXAPI_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "gpt-image-1.5",
"prompt": "Replace the background with a bright studio setup",
"image": "https://cdn.example.com/input.png",
"n": 1,
"size": "1024x1024"
},
)
response.raise_for_status()
print(response.json())js
const response = await fetch('https://api.pixapi.ai/v1/images/edits', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PIXAPI_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "gpt-image-1.5",
"prompt": "Replace the background with a bright studio setup",
"image": "https://cdn.example.com/input.png",
"n": 1,
"size": "1024x1024"
}),
});
if (!response.ok) {
throw new Error(await response.text());
}
console.log(await response.json());go
package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte(`{
"model": "gpt-image-1.5",
"prompt": "Replace the background with a bright studio setup",
"image": "https://cdn.example.com/input.png",
"n": 1,
"size": "1024x1024"
}`)
req, err := http.NewRequest(
"POST",
"https://api.pixapi.ai/v1/images/edits",
bytes.NewBuffer(body),
)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("PIXAPI_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}响应
json
{
"created": 1766880000,
"data": [
{
"url": "https://cdn.pixapi.ai/generated/gpt-image-1.5.png"
}
]
}