Skip to main content
POST
/
api
/
v3
/
openai
/
gpt-image-1
/
text-to-image
gpt-image-1 (text to image)
curl --request POST \
  --url https://api.example.com/api/v3/openai/gpt-image-1/text-to-image
OpenAI’s GPTProto format for the text to image API.
curl --location 'https://gptproto.com/api/v3/openai/gpt-image-1/text-to-image' \
  --header 'Authorization: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "prompt": "a cat",
    "n": 2,
    "background": "auto",
    "quality": "medium",
    "size": "1024x1024",
    "enable_sync_mode": true,
    "response_format": "b64_json"
}'
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}

Parameters

ParameterTypeRequiredDefaultDescription
promptstring✅ Yesa catA text description of the desired image(s). The maximum length is 32000 characters for gpt-image-1.
ninteger❌ No1The number of images to generate. Must be between 1 and 10.
backgroundstring❌ NoautoAllows to set transparency for the background of the generated image(s). This parameter is only supported for gpt-image-1. Must be one of transparent, opaque or auto (default value). When auto is used, the model will automatically determine the best background for the image.
qualitystring❌ NoautoThe quality of the image that will be generated. Must be one of high, medium, low, or auto (default value) for gpt-image-1.
sizestring❌ NoautoThe size of the generated images. Must be one of 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default value) for gpt-image-1.
enable_sync_modeboolean❌ NofalseWhether to enable synchronous mode. Options: false, true
response_formatstring❌ Nob64_jsonThe format in which the generated images are returned. Must be one of url or b64_json.