Skip to main content

Images

OpenAI Images-format text-to-image and image editing endpoints. Available models (DALL·E 3, GPT-Image, Seedream, etc.) vary by channel — the fields below are the common ones.

Generate an Image​

POST /v1/images/generations
RequestREQUEST
POSThttps://test.kailin.com.cn/v1/images/generations
The returned `url` is temporary — re-host promptly. b64_json mode returns large payloads and may render slowly.
ResponseRESPONSE
Fill in the request and hit Send — the response shows up here

Request​

curl https://test.kailin.com.cn/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "dall-e-3",
"prompt": "A cyberpunk city at night, neon lights, reflections after rain",
"n": 1,
"size": "1024x1792"
}'

Request Body​

ParameterTypeRequiredDescription
modelstringNoDefaults to dall-e-2; also dall-e-3, gpt-image-1, etc.
promptstringYesImage description — up to 4000 characters on DALL·E 3
nintegerNoNumber of images 1–10 (DALL·E 3 only supports 1)
sizestringNoResolution: 1024x1024 / 1792x1024 / 1024x1792 (DALL·E 3); 256/512/1024x1024 (DALL·E 2); auto/1024x1536/1536x1024 (GPT-Image)
qualitystringNostandard / hd (DALL·E 3); low/medium/high/auto (GPT-Image)
response_formatstringNourl (default) or b64_json (GPT-Image always returns b64)
stylestringNoDALL·E 3 only: vivid / natural
seedintegerNoRandom seed

Response​

{
"created": 1730000000,
"data": [
{
"url": "https://oss.example.com/img/abc.png",
"revised_prompt": "A cyberpunk city at night…"
}
]
}

With response_format: "b64_json", data[].b64_json holds the Base64 image data. url results point to a temporary upstream location — download and re-host them promptly.

Edit an Image​

POST /v1/images/edits

Upload the source image as multipart/form-data and modify it via a prompt (supported by GPT-Image / DALL·E 2):

curl https://test.kailin.com.cn/v1/images/edits \
-H "Authorization: Bearer sk-your-token" \
-F "model=gpt-image-1" \
-F "prompt=Replace the background with a seaside at dusk" \
-F "image=@/path/to/input.png"
FieldTypeRequiredDescription
imagefileYesSource image (png/jpeg/webp; GPT-Image accepts multiple image[])
promptstringYesEditing instruction
maskfileNoMask whose transparent areas are editable (DALL·E 2)
modelstringNogpt-image-1 / dall-e-2
n / size / quality-NoSame as the generation endpoint

Legacy Endpoints​

POST /v1/images/variations (image variations, DALL·E 2) and POST /v1/edits (legacy path) are proxied as well — parameters are the same as above. Use them only for older codebases.

tip

Models like Nano Banana (Gemini images) work through the OpenAI format too — just set model to the corresponding name; unrecognized parameters are passed through to the upstream.