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 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)
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 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
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.Related Resources
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.