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/MTokens,Output10/M Tokens, Output 10/MTokens,Output40/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 | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model name, use gpt-image-1 |
prompt | string | Yes | Text prompt for image generation, max 1000 characters |
n | integer | No | Number of images to generate, default 1, max 10 |
size | string | No | Image size, supports 1024x1024, 1536x1024, 1024x1536, auto (default) |
quality | string | No | Render quality, supports low, medium, high, auto (default) |
output_format | string | No | Output format, supports png (default), jpeg, webp |
output_compression | integer | No | Compression level (0-100%), applies to JPEG and WebP only |
background | string | No | Background setting, supports transparent, opaque, auto (default) |
response_format | string | No | Return format, url (default) or b64_json |
user | string | No | User identifier for monitoring and abuse detection |
Parameter Details
Size Options (size)
1024x1024- Square (fastest generation by default)1536x1024- Landscape mode1024x1536- Portrait modeauto- Model automatically selects optimal size based on prompt (default)
Quality Options (quality)
low- Low quality, fastest generationmedium- Medium qualityhigh- High quality, most detailedauto- Model automatically selects based on prompt (default)
jpeg format instead of png.
Output Format (output_format)
png- Lossless compression, default formatjpeg- Lossy compression, supports compression levels, faster generationwebp- Modern format, smaller files, supports compression levels
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 backgroundauto- 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 Code | Description | Solution |
|---|---|---|
| 400 | Invalid request parameters | Check prompt length and parameter format |
| 401 | Authentication failed | Verify API key is correct |
| 429 | Too many requests | Reduce request frequency or upgrade plan |
| 500 | Server error | Retry later or contact support |
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 generation1536x1024: Landscape composition, suitable for scenery, banners1024x1536: Portrait composition, suitable for portraits, postersauto: Let model auto-select based on content
low: Quick preview, batch generationmedium: Daily usehigh: Professional use, print outputauto: Model auto-optimization
png: Need transparent background or lossless qualityjpeg: Prioritize speed and smaller fileswebp: 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
| Feature | GPT-Image-1 | Sora Image |
|---|---|---|
| Pricing | Token-based (10input/10 input/10input/40 output per M) | $0.01/image |
| Billing Method | Pay-as-you-go | Per-image |
| API Type | Images API | Chat Completions API |
| Size Support | 256x256, 512x512, 1024x1024 | 2:3, 3:2, 1:1 ratios |
| Response Format | URL or Base64 | Markdown image link |