跳转到主要内容
POST
/
api
/
open-api
/
v1
/
images
Create Image Task
curl --request POST \
  --url https://www.jimmyai.cn/api/open-api/v1/images \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "prompt": "<string>",
  "ratio": "auto",
  "images": [
    "<string>"
  ],
  "resolution": "1k",
  "quality": "low"
}
'
{
  "code": "20000",
  "msg": "ok",
  "data": {
    "task_id": "<string>",
    "status": "<string>",
    "model": "<string>",
    "created_at": 123
  }
}
本接口为异步任务模式,返回 task_id 后需通过 查询图片任务 获取结果。若需同步文生图或图片编辑(兼容 OpenAI,成功即返回 b64_json),请使用 文生图(同步)编辑图片(同步)
异步图片任务使用 ratio 指定画面比例(如 1:116:9),默认 auto。同步 OpenAI 兼容接口(/images/generations/images/edits)仍使用 size 表示像素尺寸(如 1024x1024)。

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求体

application/json
model
string
必填

Model name (supported: gpt-image-2, nano-banana, nano-banana-2, nano-banana-pro)

prompt
string
必填

Text prompt for image generation

ratio
enum<string>
默认值:auto

Aspect ratio. Supported values: auto, 1:1 (Square), 3:2 (Landscape), 2:3 (Portrait), 4:3 (Landscape), 3:4 (Portrait), 5:4 (Landscape), 4:5 (Portrait), 16:9 (Widescreen), 9:16 (Vertical), 2:1 (Landscape), 1:2 (Portrait), 3:1 (Wide Landscape), 1:3 (Tall Portrait), 21:9 (Ultrawide), 9:21 (Ultrawide Vertical)

可用选项:
auto,
1:1,
3:2,
2:3,
4:3,
3:4,
5:4,
4:5,
16:9,
9:16,
2:1,
1:2,
3:1,
1:3,
21:9,
9:21
images
string[]

Reference image URLs or base64 strings

resolution
enum<string>
默认值:1k

Image resolution (supported by gpt-image-2, nano-banana-2, etc.). Supported values: 1k, 2k, 4k. Note: gpt-image-2 with 4K resolution only supports the following aspect ratios: 16:9 / 9:16 / 2:1 / 1:2 / 21:9 / 9:21.

可用选项:
1k,
2k,
4k
quality
enum<string>
默认值:low

Image quality (supported by gpt-image-2). Supported values: low, medium, high.

可用选项:
low,
medium,
high

响应

200 - application/json

Task created successfully

code
string
示例:

"20000"

msg
string
示例:

"ok"

data
object