curl --request POST \
--url https://api.zerogen.com/v1/generations/quote \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "black-forest-labs/flux-2-pro/generate",
"prompt": "A lighthouse at dawn, fog over the water",
"output": {
"count": 1
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'black-forest-labs/flux-2-pro/generate',
prompt: 'A lighthouse at dawn, fog over the water',
output: {count: 1}
})
};
fetch('https://api.zerogen.com/v1/generations/quote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.zerogen.com/v1/generations/quote"
payload = {
"model": "black-forest-labs/flux-2-pro/generate",
"prompt": "A lighthouse at dawn, fog over the water",
"output": { "count": 1 }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"model": "<string>",
"billing": {
"mode": "platform",
"quotedMicroUsd": 4503599627370495
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}Quote a generation
Validates and prices a request exactly as create would, and returns the maximum charge create would reserve. Nothing starts and nothing is held.
Needs the generations:create scope.
curl --request POST \
--url https://api.zerogen.com/v1/generations/quote \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "black-forest-labs/flux-2-pro/generate",
"prompt": "A lighthouse at dawn, fog over the water",
"output": {
"count": 1
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'black-forest-labs/flux-2-pro/generate',
prompt: 'A lighthouse at dawn, fog over the water',
output: {count: 1}
})
};
fetch('https://api.zerogen.com/v1/generations/quote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.zerogen.com/v1/generations/quote"
payload = {
"model": "black-forest-labs/flux-2-pro/generate",
"prompt": "A lighthouse at dawn, fog over the water",
"output": { "count": 1 }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"model": "<string>",
"billing": {
"mode": "platform",
"quotedMicroUsd": 4503599627370495
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}Authorizations
A ZeroGen API key: zg_ for a live key, zg_test_ for a test key.
Headers
Makes retries safe: a retry with the same key and body returns the first response for 24 hours instead of repeating the work. Reusing a key with a different body returns 409.
1 - 255^[\x21-\x7e]+$Body
200^[a-z0-9]+(?:[.-][a-z0-9]+)*\/[a-z0-9]+(?:[.-][a-z0-9]+)*\/[a-z0-9]+(?:[.-][a-z0-9]+)*$2000050- Option 1
- Option 2
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Speech models only: the voice to read the prompt in, from the model's voices
^library:[A-Za-z0-9]{1,64}$Only the parameters the model's schema lists
Show child attributes
Show child attributes
Refuse to start when the quote exceeds this amount
0 <= x <= 9007199254740991Test keys only: rehearse each output's outcome; live keys are refused when it is present
Show child attributes
Show child attributes
The project the outputs land in; the organization's default project when omitted. Test keys use their sandbox.
^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$A folder in that project to file the outputs in; null or omitted for Unfiled
^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$Show child attributes
Show child attributes