curl --request POST \
--url https://{host}/v2/workspaces/slug:llm-gateway/webhooks/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"size": "1024x1024",
"style": "<string>",
"n": 123,
"analytics_context": {}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
size: '1024x1024',
style: '<string>',
n: 123,
analytics_context: {}
})
};
fetch('https://{host}/v2/workspaces/slug:llm-gateway/webhooks/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:llm-gateway/webhooks/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"size": "1024x1024",
"style": "<string>",
"n": 123,
"analytics_context": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"created": 1767225600,
"model": "gpt-image-1",
"size": "1024x1024",
"data": [
{
"url": "https://api.studio.prisme.ai/v2/files/file-abc.png?token=token-123"
}
]
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"details": {},
"status": 123,
"retryAfter": 123,
"provider": "<string>",
"model": "<string>",
"provider_error_type": "<string>"
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"details": {},
"status": 123,
"retryAfter": 123,
"provider": "<string>",
"model": "<string>",
"provider_error_type": "<string>"
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"details": {},
"status": 123,
"retryAfter": 123,
"provider": "<string>",
"model": "<string>",
"provider_error_type": "<string>"
}Generate images
OpenAI-compatible image generation. The gateway resolves the model
(request model, else the org governance default, else the platform
default config.defaults.image_generation) and routes the call to the
provider (OpenAI, Azure OpenAI, Google Vertex Imagen).
Size resolution. Pass an abstract aspect + tier, or an explicit
pixel size. The gateway snaps it to a size listed in the model’s
capabilities.supported_sizes; an exact supported size is kept as is.
Without a supported-sizes list, size is passed through (default
1024x1024). The size actually used is returned in size.
Images are always returned as URLs. When the provider only returns
base64 data, the gateway uploads it to Prisme.ai file storage and
returns a tokenised url instead, so data[].b64_json is never
present in the response.
Governance. Requires the image-generation model permission. A
model not allowed for the organization is either downgraded to the
governance fallback model (soft_downgrade quota policy) or refused
with 403 MODEL_NOT_ALLOWED. A required upstream identity header that
would reach the provider empty is refused with
403 HEADER_POLICY_VIOLATION.
curl --request POST \
--url https://{host}/v2/workspaces/slug:llm-gateway/webhooks/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"size": "1024x1024",
"style": "<string>",
"n": 123,
"analytics_context": {}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
size: '1024x1024',
style: '<string>',
n: 123,
analytics_context: {}
})
};
fetch('https://{host}/v2/workspaces/slug:llm-gateway/webhooks/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:llm-gateway/webhooks/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"size": "1024x1024",
"style": "<string>",
"n": 123,
"analytics_context": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"created": 1767225600,
"model": "gpt-image-1",
"size": "1024x1024",
"data": [
{
"url": "https://api.studio.prisme.ai/v2/files/file-abc.png?token=token-123"
}
]
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"details": {},
"status": 123,
"retryAfter": 123,
"provider": "<string>",
"model": "<string>",
"provider_error_type": "<string>"
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"details": {},
"status": 123,
"retryAfter": 123,
"provider": "<string>",
"model": "<string>",
"provider_error_type": "<string>"
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"details": {},
"status": 123,
"retryAfter": 123,
"provider": "<string>",
"model": "<string>",
"provider_error_type": "<string>"
}Authorizations
User-bound credential carrying an identity: either a session JWT
or a user access token (at:*) generated from the user settings UI.
Send as Authorization: Bearer <token>.
Org API keys (iak_*) are not accepted here - they carry
no user identity. Use the x-prismeai-api-key header instead
(see OrgApiKeyAuth).
Body
Image model id. Defaults to the org governance default, then the platform default.
256Text description of the image to generate.
Explicit WxH pixel size. Kept as is when the model supports it, otherwise snapped (see aspect / tier).
"1024x1024"
Prisme.ai extension. Abstract orientation, snapped to a size the model supports.
square, portrait, landscape Prisme.ai extension. Size tier within the orientation (default medium).
small, medium, large Provider style hint, forwarded to the provider when set.
Number of images to generate (default 1).
Format requested from the provider (default url). The response
always carries URLs: base64 results are uploaded and replaced by a
url.
url, b64_json Prisme.ai extension. Caller-supplied analytics context (orgSlug, agent_id, user_id, context_id, agent_allowed_models).
Response
Generated images.
Unix timestamp of the generation.
Model that produced the images (after governance resolution).
Prisme.ai extension. Size actually used after resolution.
Was this page helpful?