LEAPERone Docs

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/generations

Parameters

ParameterTypeRequiredDescription
promptstringYesText description of the image to generate
modelstringYesModel ID, e.g. "gpt-4o-image"
referenceImagesstring | string[]NoURL(s) of reference images for style or content guidance
numbernumberNoNumber of images to generate, 1-4. Default: 1
sizestringNoImage dimensions, e.g. "1024x1024"
callbackUrlstringNoWebhook 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 id to poll for results via the Status endpoint.