curl --request POST \
--url https://smew.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2",
"prompt": "A clean orange cat astronaut sticker on a pastel background.",
"n": 1,
"size": "1:1",
"resolution": "2k"
}
'{
"created": 1712345678,
"data": [
{
"url": "https://smew.ai/media/generated/0.png"
}
]
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Invalid request body."
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Invalid request body."
}
}Synchronous mode
Generate images
Call the synchronous gpt-image-2 image generation endpoint and get the result directly.
POST
/
v1
/
images
/
generations
curl --request POST \
--url https://smew.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2",
"prompt": "A clean orange cat astronaut sticker on a pastel background.",
"n": 1,
"size": "1:1",
"resolution": "2k"
}
'{
"created": 1712345678,
"data": [
{
"url": "https://smew.ai/media/generated/0.png"
}
]
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Invalid request body."
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Invalid request body."
}
}Use this endpoint to call the synchronous
gpt-image-2 image generation workflow.
Start with
model: gpt-image-2, n: 1, and resolution: 2k. In synchronous mode, the result is returned directly in the response.Authorizations
Paste your SmewAI API key as a Bearer token.
Body
application/json
Image model name.
Available options:
gpt-image-2 Describe the image you want to generate.
Number of images to generate. Use 1.
Required range:
1 <= x <= 1Output aspect ratio.
Available options:
auto, 1:1, 3:2, 2:3, 4:3, 3:4, 5:4, 4:5, 16:9, 9:16, 2:1, 1:2, 21:9, 9:21 Output resolution tier.
Available options:
1k, 2k, 4k Optional reference images. Supports remote URLs and base64 data URIs.
Maximum array length:
16