curl --request POST \
--url https://api.opper.ai/v3/images \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>"
}
'import requests
url = "https://api.opper.ai/v3/images"
payload = {
"model": "<string>",
"prompt": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', prompt: '<string>'})
};
fetch('https://api.opper.ai/v3/images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"created": 123,
"data": [
{
"b64_json": "<string>",
"file_id": "<string>",
"mime_type": "<string>",
"revised_prompt": "<string>",
"url": "<string>"
}
],
"id": "<string>",
"model": "<string>",
"usage": {
"cost": 123,
"images": 123
}
}{
"id": "<string>",
"status_url": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}Generate an image
Generate one or more images. By default runs synchronously and returns them inline (200). Set async: true to run a single image on the background worker and get a 202 with a status URL to poll instead — use it for slow models (e.g. gpt-image high, imagen ultra) that can exceed the synchronous timeout. model and prompt are required; n (max 4; async is single-image), size/aspect_ratio, quality, and style are normalized, and everything in parameters is forwarded verbatim to the provider. image/mask/reference_images accept an http(s) URL, a data-URI, or a file_<id> for edit / image-to-image. response_format defaults to b64_json. Outputs are saved to /v3/files by default and returned with a reusable file_id; set store: false to opt out.
curl --request POST \
--url https://api.opper.ai/v3/images \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>"
}
'import requests
url = "https://api.opper.ai/v3/images"
payload = {
"model": "<string>",
"prompt": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', prompt: '<string>'})
};
fetch('https://api.opper.ai/v3/images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"created": 123,
"data": [
{
"b64_json": "<string>",
"file_id": "<string>",
"mime_type": "<string>",
"revised_prompt": "<string>",
"url": "<string>"
}
],
"id": "<string>",
"model": "<string>",
"usage": {
"cost": 123,
"images": 123
}
}{
"id": "<string>",
"status_url": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}Authorizations
API key authentication. Pass your API key as a Bearer token.
Body
Run generation on the background worker and return a job to poll (202) instead of waiting inline (200). Use for slow models. Single-image only.
Output-resolution tier for models that declare one (e.g. xAI 1k/2k). Separate axis from quality.
Persist each generated image to /v3/files and return a reusable file_id per image. Defaults to true; set false to skip.