Skip to main content

Model Overview

GPT-Image-1 is OpenAI’s latest image generation model, providing high-quality image generation capabilities. This documentation explains how to use the standard OpenAI Image API format through LaoZhang API to access this model.

Introduction

GPT-Image-1 supports generating high-quality images from text prompts, fully compatible with OpenAI’s official Image Generation API format.

Key Features

  • High-Quality Image Generation: Generate detailed images that match your prompts
  • Fast Response: Optimized generation speed for quick results
  • Pay-as-you-go Pricing: Input $10/M Tokens, Output $40/M Tokens
  • Fully Compatible: 100% compatible with OpenAI Image API format

Quick Start

Basic Configuration

Generate Images

Using standard OpenAI Image API format:

API Parameters

Request Parameters

Parameter Details

Size Options (size)

  • 1024x1024 - Square (fastest generation by default)
  • 1536x1024 - Landscape mode
  • 1024x1536 - Portrait mode
  • auto - Model automatically selects optimal size based on prompt (default)

Quality Options (quality)

  • low - Low quality, fastest generation
  • medium - Medium quality
  • high - High quality, most detailed
  • auto - Model automatically selects based on prompt (default)
Performance Tip: Square images + standard quality generate fastest. For latency-sensitive applications, use jpeg format instead of png.

Output Format (output_format)

  • png - Lossless compression, default format
  • jpeg - Lossy compression, supports compression levels, faster generation
  • webp - Modern format, smaller files, supports compression levels
When using jpeg or webp, control compression level with output_compression parameter (0-100%). For example, output_compression=50 compresses the image by 50%.

Background Options (background)

  • transparent - Transparent background (for PNG/WebP)
  • opaque - Opaque background
  • auto - Model automatically selects (default)

Response Format

Usage Examples

Python Example

Node.js Example

cURL Example

Prompt Optimization Tips

1. Detailed Descriptions

Provide specific, detailed descriptions for better results:

2. Style Specification

Explicitly specify desired artistic style:

3. Composition and Perspective

Specifying composition and perspective yields more precise results:

Batch Generation

Example of batch image generation:

Error Handling

Common Error Codes

Error Handling Example

Best Practices

1. Prompt Length Control

While supporting up to 1000 characters, detailed descriptions of 100-200 characters usually produce great results.

2. Image Size and Quality Selection

Size Recommendations:
  • 1024x1024: General use, fastest generation
  • 1536x1024: Landscape composition, suitable for scenery, banners
  • 1024x1536: Portrait composition, suitable for portraits, posters
  • auto: Let model auto-select based on content
Quality Recommendations:
  • low: Quick preview, batch generation
  • medium: Daily use
  • high: Professional use, print output
  • auto: Model auto-optimization
Format Selection:
  • png: Need transparent background or lossless quality
  • jpeg: Prioritize speed and smaller files
  • webp: Modern web apps, best compression ratio

3. Content Moderation

Generated images are automatically moderated to ensure compliance with usage policies. Avoid requesting generation of:
  • Violent or disturbing images
  • Adult content
  • Hateful or discriminatory content
  • Misleading or false information
  • Copyright-infringing content

4. Cost Optimization

  • Use smaller sizes for testing and preview
  • Set reasonable concurrency for batch generation
  • Cache generated image URLs to avoid regeneration

Difference from Sora Image

FAQ

Q: Can I use generated images commercially?

A: Yes, you own full rights to images generated via API and can use them commercially.

Q: How long are image URLs valid?

A: Generated image URLs are typically valid for 24 hours. Download and save promptly.

Q: Are Chinese prompts supported?

A: Supported, but English prompts are recommended for best results.

Q: How to improve generated image quality?

A: Use detailed, specific descriptions including style, lighting, composition details.
GPT-Image-1 uses token-based billing (Input $10/M Tokens, Output $40/M Tokens), with actual cost depending on prompt length and response content. Compared to fixed-price Sora Image ($0.01/image), it’s better suited for scenarios requiring flexible cost control.