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/generationshttps://test.kailin.com.cn/v1/images/generationsRequest
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
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | No | Defaults to dall-e-2; also dall-e-3, gpt-image-1, etc. |
prompt | string | Yes | Image description — up to 4000 characters on DALL·E 3 |
n | integer | No | Number of images 1–10 (DALL·E 3 only supports 1) |
size | string | No | Resolution: 1024x1024 / 1792x1024 / 1024x1792 (DALL·E 3); 256/512/1024x1024 (DALL·E 2); auto/1024x1536/1536x1024 (GPT-Image) |
quality | string | No | standard / hd (DALL·E 3); low/medium/high/auto (GPT-Image) |
response_format | string | No | url (default) or b64_json (GPT-Image always returns b64) |
style | string | No | DALL·E 3 only: vivid / natural |
seed | integer | No | Random 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/editsUpload 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"
| Field | Type | Required | Description |
|---|---|---|---|
image | file | Yes | Source image (png/jpeg/webp; GPT-Image accepts multiple image[]) |
prompt | string | Yes | Editing instruction |
mask | file | No | Mask whose transparent areas are editable (DALL·E 2) |
model | string | No | gpt-image-1 / dall-e-2 |
n / size / quality | - | No | Same 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.
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.