LEAPERone Docs

Image Generation

Create images with AI models.

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

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
{
  "id": "img-abc123",
  "status": "pending"
}

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/img-abc123 \
  -H "Authorization: Bearer sk-your-api-key"
Completed Response
{
  "id": "img-abc123",
  "status": "completed",
  "data": [
    {
      "url": "https://cdn.leaper.one/images/abc123.png"
    }
  ]
}

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 temporary and expire after 1 hour. Download or cache them promptly.

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