Skip to main content
POST
/
openai
/
openai
/
deployments
/
{deployment-id}
/
images
/
generations
Create image (Azure OpenAI)
curl --request POST \
  --url http://localhost:8080/openai/openai/deployments/{deployment-id}/images/generations \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "prompt": "<string>",
  "n": 1,
  "size": "256x256",
  "quality": "standard",
  "style": "natural",
  "response_format": "url",
  "user": "<string>",
  "stream": false,
  "fallbacks": [
    "<string>"
  ]
}
'
{
  "created": 123,
  "data": [
    {
      "url": "<string>",
      "b64_json": "<string>",
      "revised_prompt": "<string>",
      "index": 123
    }
  ],
  "background": "<string>",
  "output_format": "<string>",
  "quality": "<string>",
  "size": "<string>",
  "usage": {
    "input_tokens": 123,
    "input_tokens_details": {
      "image_tokens": 123,
      "text_tokens": 123
    },
    "total_tokens": 123,
    "output_tokens": 123,
    "output_tokens_details": {
      "image_tokens": 123,
      "text_tokens": 123
    }
  }
}

Path Parameters

deployment-id
string
required

Azure deployment ID

Query Parameters

api-version
string

Azure API version

Body

application/json
model
string
required

Model identifier

prompt
string
required

Text prompt to generate image

n
integer
default:1

Number of images to generate

Required range: 1 <= x <= 10
size
enum<string>

Size of the generated image

Available options:
256x256,
512x512,
1024x1024,
1792x1024,
1024x1792,
1536x1024,
1024x1536,
auto
quality
enum<string>

Quality of the generated image

Available options:
standard,
hd
style
enum<string>

Style of the generated image

Available options:
natural,
vivid
response_format
enum<string>
default:url

Format of the response. This parameter is not supported for streaming requests.

Available options:
url,
b64_json
user
string

User identifier for tracking

stream
boolean
default:false

Whether to stream the response. When true, images are sent as base64 chunks via SSE.

fallbacks
string[]

Fallback models to try if primary model fails

Response

Successful response

created
integer<int64>

Unix timestamp when the image was created

data
object[]

Array of generated images

background
string

Background type used

output_format
string

Output format used

quality
string

Quality setting used

size
string

Size setting used

usage
object