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. Set store: true to also save the outputs to /v3/files and get a reusable file_id; nothing is stored otherwise. With async: true, set callback_url to get a signed webhook when the job ends instead of polling (see GET /v3/webhooks/secret).
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
A model id from GET /v3/images/models, such as openai/gpt-image-2.5-flare. Ids name the provider; a bare model name answers 400 with the ids that serve it.
Shape such as 16:9, for models that list params.image.aspect_ratios.
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.
HTTPS URL that receives a signed image.completed or image.failed webhook when the job ends, so you do not have to poll. Rules, each answered with a 400 that names it: https only, port 443 (or none), no user:password@, no #fragment, at most 2048 characters, and a host that is a public IP address or a public name resolving only to public addresses (no localhost, private, link-local, metadata or internal names). Verify the signature with the project's secret from GET /v3/webhooks/secret; see the jobCompleted webhook for the payload, headers and retries. Only with async: true; a synchronous request with callback_url answers 400.
The image to edit: URL, data-URI or file_<id>. Needs the image_edit capability.
Inpaint mask marking the region of image to change.
Provider settings, forwarded verbatim. The keys each model takes are listed with descriptions in its params.image.parameters (GET /v3/images/models).
A tier from the model's params.image.qualities. On Gemini image models it also sets the size: the default gives about 1K, high 2K and 4k 4K.
Further images the result draws on (subject, product, style).
Output-resolution tier for models that declare one (e.g. xAI 1k/2k). Separate axis from quality.
Pixel size WxH. A model with params.image.size_constraints takes any size inside them (GPT Image: 2K is 2048x2048, 4K 3840x2160), else one of params.image.sizes.
Persist each generated image to /v3/files and return a reusable file_id per image. Defaults to false; set true to store.