LEAPERone Docs

Image Generation (Create)

Reference for POST /v1/images/generations, including prompts, sizes, reference images, async task creation, credits, and callbacks.

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 from the supported models table below
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") or aspect ratio (e.g. "9:16", model-dependent)
callbackUrlstringNoWebhook URL to receive a POST when generation completes

Supported Models

Model IDNamePrice
gpt-4o-imageGPT-4o Image0.5 credits/image
gpt-image-2GPT Image 20.01 credits/image
gemini-3.1-flash-image-previewGemini 3.1 Flash Image Previewapproximately 0.081714 credits/image

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

  • Task creation reserves model price × number; completion settles the actual number of generated images.
  • Failed tasks release the reservation; partial tasks charge only for successful images.
  • If your balance is insufficient, the API returns 402 Payment Required.
  • Use the returned id to poll for results via the Status endpoint.