LEAPERone Docs

Image Generation Guide

Learn how to create images with LEAPERone, submit prompts and reference images, poll asynchronous tasks, and receive callbacks.

Image generation uses an asynchronous two-step workflow: create a task, then poll for the result.

Supported Models

  • gpt-4o-image — OpenAI GPT-4o image generation.
  • gpt-image-2 — OpenAI GPT Image 2. Supports aspect-ratio size values like "9:16" in addition to fixed dimensions.
  • gemini-3-pro-image-preview — Google Gemini 3 Pro Image.

Step 1 — Create a Task

POST /v1/images/generations
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 watercolor painting of a mountain lake at sunrise"
  }'
Response
{
  "code": 0,
  "msg": "success",
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}

Step 2 — Poll for Status

Use the returned id to check progress:

GET /v1/images/generations/:id
curl https://api.leaper.one/v1/images/generations/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer sk-your-api-key"
Completed Response
{
  "code": 0,
  "msg": "success",
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "status": "completed",
    "images": [
      {
        "id": "image-abc123",
        "url": "https://s3.bitiful.net/leaperone/images/generated/abc123?X-Amz-Expires=3600&..."
      }
    ]
  }
}

Status Values

StatusMeaning
pendingTask queued, not yet started.
processingModel is generating the image.
uploadingImage is being uploaded to storage.
partialSome images ready (for multi-image requests).
completedAll images ready.
failedGeneration failed.

Webhook Callback

Instead of polling, you can provide a callbackUrl to receive a POST notification when the task finishes:

Request with Callback
{
  "model": "gpt-4o-image",
  "prompt": "A neon-lit cyberpunk cityscape",
  "callbackUrl": "https://your-server.com/webhook/image"
}

Each generated image costs 0.5 credits.

Image URLs are signed when you poll the task and expire after 1 hour. Use the latest value from data.images[].url; poll the task again when you need a fresh URL.

For the full parameter list and response schema, see the API Reference.