Skip to main content
POST
/
api
/
open-api
/
v1
/
images
/
generations
Text-to-Image (Sync)
curl --request POST \
  --url https://www.jimmyai.cn/api/open-api/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "gpt-image-2",
  "prompt": "Cyberpunk city at night in the rain, neon signs, cinematic framing",
  "size": "1024x1024",
  "n": 1,
  "quality": "high"
}
'
{
  "code": 20000,
  "msg": "ok",
  "data": {
    "created": 123,
    "data": [
      {
        "b64_json": "<string>",
        "revised_prompt": "<string>"
      }
    ],
    "model": "gpt-image-2",
    "usage": {
      "input_tokens": 123,
      "output_tokens": 123,
      "total_tokens": 123,
      "input_tokens_details": {
        "image_tokens": 123,
        "text_tokens": 123
      },
      "output_tokens_details": {
        "image_tokens": 123,
        "text_tokens": 123
      }
    }
  }
}
This is a synchronous endpoint compatible with OpenAI POST /v1/images/generations. On success, billing is applied immediately and image results are returned in data (b64_json or url) — no task polling required.Unlike Create Image Task (async POST /images), which returns a task_id and requires Query Image Task.
Generation often takes 30–120 seconds. Set client timeout to ≥ 180 seconds. Responses may include multi‑MB b64_json; ensure your client and any proxy support large bodies.

Authorizations

Authorization
string
header
required

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

Body

application/json
prompt
string
required

Text prompt for image generation

model
string
default:gpt-image-2

Model name. Default: gpt-image-2

Example:

"gpt-image-2"

size
string
default:1024x1024

Output size. Default: 1024x1024

Example:

"1024x1024"

n
integer
default:1

Number of images. MAX: 1

quality
enum<string>
default:low

Quality tier (affects billing for gpt-image-2)

Available options:
low,
medium,
high,
auto
background
enum<string>
Available options:
transparent,
opaque,
auto
output_format
enum<string>
Available options:
png,
jpeg,
webp

Response

200 - application/json

Generation successful

code
integer
Example:

20000

msg
string
Example:

"ok"

data
object

OpenAI-compatible image result