Generate images (OpenAI-compatible)
Drop-in replacement for POST /v1/images/generations from OpenAI. Accepts text
prompts plus optional size, n, and response_format parameters.
Request
Provide your bearer token in the Authorization
header when making requests to protected resources. Example:Authorization: Bearer ********************
or
Body Params application/jsonRequired
{
"model": "stabilityai/stable-diffusion-xl-1024-v1-0",
"prompt": "photorealistic drone shot of a solar farm at sunrise",
"n": 2,
"size": "1024x1024"
}
Request Code Samples
curl --location --request POST 'http://prod-cn.your-api-server.com/images/generations' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "stabilityai/stable-diffusion-xl-1024-v1-0",
"prompt": "photorealistic drone shot of a solar farm at sunrise",
"n": 2,
"size": "1024x1024"
}'
Responses
application/json
Images generated successfully
{
"id": "string",
"created": 0,
"model": "string",
"provider": "string",
"data": [
{
"url": "http://example.com",
"b64_json": "string"
}
],
"revised_prompt": "string"
}
Modified at 2025-11-12 07:09:16