> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jiekou.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# GPT Image 2 Text to Image

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

<ParamField header="Content-Type" type="string" required={true}>
  Enum value: `application/json`
</ParamField>

<ParamField header="Authorization" type="string" required={true}>
  Bearer authentication format: Bearer \{\{API Key}}.
</ParamField>

## Request Body

<ParamField body="n" type="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]
</ParamField>

<ParamField body="size" type="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`
</ParamField>

<ParamField body="prompt" type="string" required={true}>
  The text prompt used to generate the image. Supports Chinese and English. Maximum length: 32,000 characters.

  Length limit: 0 - 32000
</ParamField>

<ParamField body="quality" type="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`
</ParamField>

<ParamField body="background" type="string" default="auto">
  Background setting.

  Available values: `opaque`, `auto`
</ParamField>

<ParamField body="moderation" type="string" default="auto">
  Content moderation level.

  Available values: `low`, `auto`
</ParamField>

<ParamField body="output_format" type="string" default="png">
  The file format of the output image.

  Available values: `png`, `jpeg`
</ParamField>

<ParamField body="output_compression" type="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]
</ParamField>

## Response Information

<ResponseField name="images" type="string[]" required={false}>
  Array of generated image URLs.
</ResponseField>
