Creates an image using an AI model based on the provided prompt and parameters.
POST
/images/generate-with-idempotency
curl \
--request POST 'https://api.huy-devops.site/api/images/generate-with-idempotency' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--header "idempotency-key: string" \
--data '{"prompt":"A beautiful sunset over a mountain landscape","aspectRatio":"16:9","artStyle":"cartoon","artDescription":"something","themeStyle":"something","themeDescription":"something","model":"gpt-4o","provider":"openai"}'
Request examples
# Headers
idempotency-key: string
# Payload
{
"prompt": "A beautiful sunset over a mountain landscape",
"aspectRatio": "16:9",
"artStyle": "cartoon",
"artDescription": "something",
"themeStyle": "something",
"themeDescription": "something",
"model": "gpt-4o",
"provider": "openai"
}
Response examples (200)
{
"success": true,
"code": 200,
"message": "string",
"data": {
"url": "string",
"mimeType": "image/png",
"prompt": "A beautiful sunset over a mountain landscape",
"created": "2025-09-01T12:00:00Z"
}
}
Response examples (400)
{
"success": false,
"code": 400,
"errorCode": "INVALID_IMAGE_PROMPT",
"message": "Invalid prompt or parameters for image generation",
"timestamp": "2025-05-04T09:42:00Z"
}
Response examples (429)
{
"success": false,
"code": 429,
"errorCode": "IMAGE_GENERATION_QUOTA_EXCEEDED",
"message": "Image generation quota has been exceeded",
"timestamp": "2025-05-04T09:42:00Z"
}
Response examples (500)
{
"success": false,
"code": 500,
"errorCode": "GENERATION_ERROR",
"message": "An error occurred during content generation",
"timestamp": "2025-05-04T09:42:00Z"
}