Skip to main content
POST
/
v3
/
gpt-image-2-text-to-image
GPT Image 2 Text to Image
curl --request POST \
  --url https://api.highwayapi.ai/v3/gpt-image-2-text-to-image \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "n": 123,
  "size": "<string>",
  "prompt": "<string>",
  "quality": "<string>",
  "background": "<string>",
  "moderation": "<string>",
  "output_format": "<string>",
  "output_compression": 123
}
'
{
  "images": [
    {}
  ]
}
API call for the GPT Image 2 text-to-image generation model. Supports multiple quality levels (low/medium/high) and sizes. Generates images from text prompts, with configurable output format, compression ratio, and background settings.

Request Headers

Content-Type
string
required
Enum value: application/json
Authorization
string
required
Bearer authentication format: Bearer {{API Key}}.

Request Body

n
integer
default:1
The number of images to generate. Defaults to 1. The actual number returned may be less than the requested number.Value range: [1, 10]
size
string
default:"1024x1024"
The size of the generated image. 1024x1024 is square, 1024x1536 is portrait, 1536x1024 is landscape, 2048x2048 is 2K square, 2048x1152 is 2K landscape, 3840x2160 is 4K landscape, 2160x3840 is 4K portrait, 2048x1360 is 3:2 landscape, 1360x2048 is 2:3 portrait, 1152x2048 is 9:16 portrait, 2048x1536 is 4:3 landscape, 1536x2048 is 3:4 portrait, 2048x880 is 21:9 ultra-wide, 880x2048 is 9:21 ultra-tall, 688x2048 is 1:3 portrait, 2048x688 is 3:1 landscape, 2048x1024 is 2:1 landscape, and 1024x2048 is 1:2 portrait.Available values: 1024x1024, 1024x1536, 1536x1024, 2048x2048, 2048x1152, 3840x2160, 2160x3840, 2048x1360, 1360x2048, 1152x2048, 2048x1536, 1536x2048, 2048x880, 880x2048, 688x2048, 2048x688, 2048x1024, 1024x2048, auto
prompt
string
required
The text prompt used to generate the image. Supports Chinese and English. Maximum length: 32,000 characters.Length limit: 0 - 32000
quality
string
default:"medium"
The quality level of the generated image. low is the fastest and lowest cost; medium balances quality and speed; high provides the best quality but is the slowest and most expensive.Available values: low, medium, high
background
string
default:"auto"
Background setting.Available values: opaque, auto
moderation
string
default:"auto"
Content moderation level.Available values: low, auto
output_format
string
default:"png"
The file format of the output image.Available values: png, jpeg
output_compression
integer
Compression level of the output image (0-100). Only valid for jpeg format; png format is not supported (must be 100 or omitted).Value range: [0, 100]

Response Information

images
array
Array of generated image URLs.