curl --request POST \
--url https://api.evolink.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2-beta",
"prompt": "海面上绚丽多彩的美丽日落"
}
'{
"created": 1757156493,
"id": "task-unified-1757156493-imcg5zqt",
"model": "gpt-image-2-beta",
"object": "image.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 100
},
"type": "image",
"usage": {
"billing_rule": "per_call",
"credits_reserved": 2.5
}
}{
"error": {
"code": "invalid_request",
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or expired token",
"type": "authentication_error"
}
}{
"error": {
"code": "insufficient_quota",
"message": "Insufficient quota. Please top up your account.",
"type": "insufficient_quota"
}
}{
"error": {
"code": "model_access_denied",
"message": "Token does not have access to model: gpt-image-2-beta",
"type": "invalid_request_error"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests, please try again later",
"type": "rate_limit_error"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error",
"type": "api_error"
}
}GPT Image 2
GPT Image 2 图像生成 Beta
- GPT Image 2 (gpt-image-2-beta) 模型支持文本转图片、图生图、图像编辑等多种生成模式
- 异步处理模式,使用返回的任务ID 进行查询
- 生成的图像链接,有效期为7天,请尽快保存
- 极少数情况下,生成结果会以官方原始链接交付,有效期可能短于 7 天,请及时下载保存。
尺寸支持:
- 当前仅支持
size=auto,或比例尺寸(如size="1:1")配合resolution="1K" size=auto时resolution字段被忽略,按 1K 处理- 暂不支持
resolution="2K"/resolution="4K",也不支持显式像素尺寸(如1024x1024) - 需要 2K、4K 或显式像素控制,请改用 gpt-image-2
计费(按次计费 per_call):
- 按 1K 单档计费
n固定为 1;quality在该渠道不开放
POST
/
v1
/
images
/
generations
curl --request POST \
--url https://api.evolink.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2-beta",
"prompt": "海面上绚丽多彩的美丽日落"
}
'{
"created": 1757156493,
"id": "task-unified-1757156493-imcg5zqt",
"model": "gpt-image-2-beta",
"object": "image.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 100
},
"type": "image",
"usage": {
"billing_rule": "per_call",
"credits_reserved": 2.5
}
}{
"error": {
"code": "invalid_request",
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or expired token",
"type": "authentication_error"
}
}{
"error": {
"code": "insufficient_quota",
"message": "Insufficient quota. Please top up your account.",
"type": "insufficient_quota"
}
}{
"error": {
"code": "model_access_denied",
"message": "Token does not have access to model: gpt-image-2-beta",
"type": "invalid_request_error"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests, please try again later",
"type": "rate_limit_error"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error",
"type": "api_error"
}
}授权
##所有接口均需要使用Bearer Token进行认证##
获取 API Key :
访问 API Key 管理页面 获取您的 API Key
使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
请求体
application/json
生成图像的尺寸,支持两种模式:
1. auto(默认)
由模型自动决定输出尺寸,此时 resolution 字段被忽略,按 1K 处理。
2. 比例(需配合 resolution="1K")
1:1:正方形3:2/2:3:横版 / 竖版4:3/3:4:横版 / 竖版5:4/4:5:社交媒体常用16:9/9:16:宽屏横版 / 竖版21:9/9:21:超宽横版 / 竖版2:1/1:2:横版 / 竖版3:1/1:3:全景横版 / 竖版(最大长宽比)
说明: 当前暂不支持显式像素尺寸(如 1024x1024)。需要显式像素控制,请改用 gpt-image-2。
示例:
"16:9"
分辨率档位,仅在 size 为比例格式时生效,当前仅支持 1K。
忽略条件:
size=auto时本字段被忽略,按 1K 处理(无需传此参数)
横版/正方形对应实际输出尺寸(竖版尺寸为对应横版的宽高调换):
| 比例 | 1K |
|---|---|
1:1 | 1024×1024 |
2:1 | 1456×720 |
3:1 | 1776×592 |
3:2 | 1248×832 |
4:3 | 1184×880 |
5:4 | 1152×912 |
16:9 | 1360×768 |
21:9 | 1568×672 |
说明: 暂不支持 2K / 4K。需要更高分辨率,请改用 gpt-image-2。
可用选项:
1K 示例:
"1K"
任务完成后的HTTPS回调地址
回调时机:
- 任务完成(completed)、失败(failed)或取消(cancelled)时触发
- 在计费确认完成后发送
安全限制:
- 仅支持HTTPS协议
- 禁止回调到内网IP地址(127.0.0.1、10.x.x.x、172.16-31.x.x、192.168.x.x等)
- URL长度不超过
2048字符
回调机制:
- 超时时间:
10秒 - 失败后最多重试
3次(会分别在失败的1秒/2秒/4秒后进行重试) - 回调响应体格式与任务查询接口返回的格式一致
- 回调地址若返回2xx状态码视为成功,其他状态码会触发重试
示例:
"https://your-domain.com/webhooks/image-task-completed"
响应
图像任务创建成功