Create a batch
Starts up to 50 generations in one request. They’re priced and held together, so either all start or none do, and each then runs as its own generation with this batch’s batch_id. Read each one with GET /v1/generations/{id}.
Needs an API key with the generations:write scope.
curl --request POST \
--url https://api.tryleap.ai/v1/batches \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"requests": [
{
"model": "<string>",
"input": {},
"webhook": "<string>"
}
]
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({requests: [{model: '<string>', input: {}, webhook: '<string>'}]})
};
fetch('https://api.tryleap.ai/v1/batches', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tryleap.ai/v1/batches"
payload = { "requests": [
{
"model": "<string>",
"input": {},
"webhook": "<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"
Body
Up to 50 generations, each a model and its input. All are priced and held together.
1 - 50 elementsShow child attributes
Show child attributes
curl --request POST \
--url https://api.tryleap.ai/v1/batches \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"requests": [
{
"model": "<string>",
"input": {},
"webhook": "<string>"
}
]
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({requests: [{model: '<string>', input: {}, webhook: '<string>'}]})
};
fetch('https://api.tryleap.ai/v1/batches', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tryleap.ai/v1/batches"
payload = { "requests": [
{
"model": "<string>",
"input": {},
"webhook": "<string>"
}
] }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)