Create a generation
Starts a run of any model or preset. Every model takes this same shape; only input differs, as the model’s input_schema says. The price is held from your balance first, and charged only if the run succeeds.
Without Prefer, the answer comes at once with the generation queued. With Prefer: wait=60, it comes when the run finishes or after 60 seconds, whichever is first: most images finish inside the wait, and video doesn’t. Send an Idempotency-Key so a retry never starts a second run.
Needs an API key with the generations:write scope.
curl --request POST \
--url https://api.tryleap.ai/v1/generations \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "<string>"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>'})
};
fetch('https://api.tryleap.ai/v1/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tryleap.ai/v1/generations"
payload = { "model": "<string>" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)Authorizations
Your workspace API key, leap_.... Create one at https://app.tryleap.ai/go/api, and keep it on your server.
Headers
A key you generate for this request, such as a UUID, so a retry never starts a second run. A retry with the same key and body returns the same generation as it is now, marked Idempotent-Replayed: true. The same key with a different body is a 409. A key belongs to your workspace and doesn't expire, so use a new one for each new request.
1 - 255^[\x21-\x7e]+$"7f1c2a9e-3b4d-4e8a-9c21-5d0f6a7b8c90"
wait=N holds the request open for up to N seconds (at most 60) until the generation finishes, and Preference-Applied echoes the wait used. Most images finish inside the wait. If the run is still going when it ends, you get it back queued or running; poll it from there. Without this header the generation comes back queued at once.
"wait=60"
Body
The model or preset to run, such as black-forest-labs/flux-2-pro or leap/restore-photo@1. A preset ID without @N runs its latest version.
100^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9.-]*(@[1-9][0-9]{0,3})?$The model's input, as its input_schema from GET /v1/models/{creator}/{name} describes it. Fields you leave out take their defaults; unknown fields are refused. Files are file_... IDs.
Show child attributes
Show child attributes
An https URL to POST the generation.succeeded, generation.failed or generation.canceled event to when the run ends, signed with your workspace's default secret (GET /v1/webhooks/default/secret).
2048Response
The generation: queued at once, or as it is when the wait ends.
One run of a model or preset, with its status, its outputs and what it cost.
The generation's ID, gen_ and 24 letters and digits.
"generation"The model or preset it runs, with a preset's version.
What it makes: image, video, audio, 3d or text.
image, video, audio, 3d, text queued, then running, then one of succeeded, failed or canceled. Only succeeded is charged.
queued, running, succeeded, failed, canceled Which upstream ran it, once one did. Informational: the model ID and input stay the same whichever runs it.
The model's schema and price revision the run used.
^\d{4}-\d{2}-\d{2}$The input as it runs, with the defaults filled in.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Why a failed run failed, such as a refused prompt or a provider error; null otherwise. A failed run isn't charged.
Show child attributes
Show child attributes
What the run cost your workspace.
Show child attributes
Show child attributes
Where it was started: api, mcp or studio.
studio, api, mcp The batch it belongs to, bat_...; null if none.
When it was created.
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$When it started running; null while queued.
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$When it reached a final status; null before.
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$While a preset that makes a still first is running: that still, once it exists, before the video it becomes. Absent for every other run, and for a run whose video also reads words or a photo you sent, such as a line to say or a photo the clip starts from: that still comes with the video.
Show child attributes
Show child attributes
curl --request POST \
--url https://api.tryleap.ai/v1/generations \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "<string>"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>'})
};
fetch('https://api.tryleap.ai/v1/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tryleap.ai/v1/generations"
payload = { "model": "<string>" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)