Image Generation (Create)
POST /v1/images/generations
Submit an asynchronous image generation request. The response returns a task ID that you can poll for status using the Image Generation (Status) endpoint.
Endpoint
POST https://api.leaper.one/v1/images/generationsParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Text description of the image to generate |
| model | string | Yes | Model ID, e.g. "gpt-4o-image" |
| referenceImages | string | string[] | No | URL(s) of reference images for style or content guidance |
| number | number | No | Number of images to generate, 1-4. Default: 1 |
| size | string | No | Image dimensions, e.g. "1024x1024" |
| callbackUrl | string | No | Webhook URL to receive a POST when generation completes |
Request
curl -X POST https://api.leaper.one/v1/images/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-image",
"prompt": "A cat astronaut floating in space, digital art",
"number": 1,
"size": "1024x1024"
}'Response
{
"code": 0,
"msg": "success",
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}Notes
- Each image costs 0.5 credits. Credits are deducted at creation time.
- If your balance is insufficient, the API returns 402 Payment Required.
- Use the returned
idto poll for results via the Status endpoint.