Skip to main content
POST
중국 본토 사용자 안내: 중국 본토 사용자는 https://toapis.cn 를 API 엔드포인트(Base URL)로 사용해 주세요. 본 문서의 예시에서 https://toapis.com 을 https://toapis.cn 로 바꿔 주세요.
  • Official OpenAI gpt-image-2-official model
  • Async processing — returns a task ID for subsequent polling
  • Supports text-to-image, multi-reference image-to-image, and mask-based inpainting
  • 13 aspect ratios with 1K / 2K / 4K resolution tiers
  • Up to 4 images per request, up to 16 reference images

Authorizations

string
필수
All endpoints require Bearer Token authenticationGet your API Key from the API Key Management PageAdd to request header:

Body

string
기본값:"gpt-image-2-official"
필수
Image generation model nameUse gpt-image-2-official
string
필수
Text prompt describing the image to generateSupports English and Chinese; detailed descriptions of scene, style, and composition are recommended
string
기본값:"1:1"
Aspect ratioPreset values, or pass auto to let the upstream provider choose:1:1 · 3:2 · 2:3 · 4:3 · 3:4 · 5:4 · 4:5 · 16:9 · 9:16 · 2:1 · 1:2 · 21:9 · 9:21You may also pass any ratio in width:height format, such as 1:3 or 7:4, subject to the custom-size limits below.With auto, the upstream provider determines the final aspect ratio and pixel dimensions, so a fixed output is not guaranteed.
string
기본값:"1k"
Resolution tier
  • 1k — 1024-base, fast and cost-effective (default)
  • 2k — 2048-base, suitable for posters and high-definition needs
  • 4k — 3840-base; high quality can take more than 120 seconds

Size Reference Table

Custom Resolutions

In addition to the presets above, pass any ratio in width:height format through size. The service calculates pixel dimensions from the selected resolution tier. The resulting dimensions must meet all of these limits:
  • Both sides must be multiples of 16 pixels
  • The long edge can be at most 3,840 pixels (4K)
  • The aspect ratio can be at most 3:1
  • Total pixel count must be between 655,360 and 8,294,400
Examples:
  • size: "1:3" with resolution: "2k" → 1024x3072
  • size: "7:4" with resolution: "1k" → 1344x768
string
기본값:"high"
Image quality
  • low — fast and economical, suitable for drafts/previews
  • medium — balanced speed and quality
  • high — maximum detail, default value (4K + high can take 120s+)
string
기본값:"auto"
생성 이미지의 배경 스타일
  • auto — 모델이 자동 결정 (기본값)
  • transparent — 투명 배경
  • opaque — 불투명 배경
투명 배경은 PNG 출력과 함께 사용하는 것이 좋습니다.
string
기본값:"png"
Output format
  • png — default
  • jpeg — smaller file size (supports compression)
Azure OpenAI does not support webp format.
integer
기본값:100
JPEG compression level, range 0–100 (0 = no compression, 100 = maximum compression, default 100)Only applies when output_format is "jpeg"
integer
기본값:1
Number of images to generateRange: 1 ~ 10
string[]
Reference image URL array for image-to-image generation
  • Maximum 16 images, must be publicly accessible stable URLs
  • Use the Upload 이미지 API to upload local files and get URLs
string
Mask image URL for inpaintingMust be used together with image_urls. The mask must match the dimensions of the first reference image and include an Alpha channel (transparent areas indicate regions to be repainted)

응답

string
Unique task identifier for status queries
string
Object type, always generation.task
string
모델 name used
string
Task status
  • queued — waiting to be processed
  • in_progress — processing
  • completed — successfully completed
  • failed — failed
integer
Task progress percentage (0-100)
integer
Task creation timestamp (Unix timestamp)