Docs ChatGPT Chat /v1/images/generations
API reference

Create gpt-image-1

Given a hint, the model will return one or more predicted completions and can also return the probability of the surrogate marker for each position. Complete creation for the provided prompts and parameters Official…

POST/v1/images/generations

Body Parametersapplication/json

prompt* string

A text description of the desired image. Maximum length is 1000 characters.

n* integer

The number of images to generate. Must be between 1 and 10.

size* string

The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.

Responses

200 application/json
response-200 object
properties
created* integer

Unix timestamp (seconds)

data* array

Data payload (often Base64 or a structured object)

400 Bad request or validation failed application/json
response-400 object
properties
error* object
Request Body Example Create gpt-image-1
1{
2"size": "1024x1536",
3"prompt": "一只可爱的小猪",
4"model": "gpt-image-1",
5"n": 1
6}
Code Sample cURL
1curl -X POST "https://api.digislash.com/v1/images/generations" \
2-H "Content-Type: application/json" \
3-d '{
4"size": "1024x1536",
5"prompt": "一只可爱的小猪",
6"model": "gpt-image-1",
7"n": 1
8}'
Response
1▼{
2"id": "chatcmpl-123",
3"object": "chat.completion",
4"created": 1677652288,
5▼"choices": [
6▶{ 3 keys }
7],
8▼"usage": {
9"prompt_tokens": 9,
10"completion_tokens": 12,
11"total_tokens": 21
12}
13}