Generations

Create Sync Generation

Changed on

Run a generation and return the finished result in the same response. Only sync-capable models are accepted. The request may take up to ~27 seconds before the service times out.

post/generationssync

Request

  • Base URL
    https://cloud.leonardo.ai/api/rest/v2
  • URL
    https://cloud.leonardo.ai/api/rest/v2/generationssync
  • Auth
    HTTP bearer

Request body

model'remove-bg' required

Must be remove-bg.

publicboolean

Whether the generated images should show in the community feed. Ignored when ephemeral is true.

ephemeralboolean

When true, the result is not persisted to the library and the response URL is a 30-minute presigned GET.

base64boolean

When true, return results[].dataB64 instead of results[].url. The request fails if the encoded payload would exceed the response size limit.

Example request

{
  "model": "remove-bg",
  "parameters": {
    "size": "full",
    "channels": "rgba",
    "quantity": 1,
    "guidances": "your guidances here",
    "shadow_type": "none",
    "semitransparency": true
  }
}

Response

Responses for POST /generationssync

idstring required

Generation identifier.

blockedCountinteger required

Number of outputs withheld by content moderation.

Changes