Skip to main content

GPT Image 2 - Image Generator

Generate premium quality images from text prompts using OpenAI's latest GPT Image 2 model. Features fully flexible custom dimensions, superior creative fidelity, and token-based credit billing that scales precisely with image complexity and quality.

Endpoint

Request Headers

FieldValue
API-KEY<api-key>
Content-Typeapplication/json

Parameters

ParameterTypeRequiredDescription
typestringYesFeature type identifier. Must be IMAGE_GENERATOR
modelstringYesAI model identifier. Must be gpt-image-2
promptObjectobjectYesConfiguration object containing all generation parameters

Prompt Object Parameters

ParameterTypeRequiredDescriptionDefault
promptstringYesText description of the image to generate (max 4000 characters)-
sizestringYesOutput image dimensions in WxH format (e.g. 1024x1024)-
qualitystringYesImage quality level-
nnumberNoNumber of images to generate (1-10)1
backgroundstringNoBackground mode for the generated imageauto
output_formatstringNoOutput format for the generated image-
output_compressionnumberNoCompression level (0-100, higher = better quality). Only applies when output_format is jpeg or webp-

Size Constraints

GPT Image 2 accepts any custom dimension in WxH format (e.g. 1024x1024, 1280x720) subject to the following rules:

ConstraintRuleExample
Block sizeWidth and height must both be divisible by 161024x1024 ✓, 1000x1000
Minimum pixelsWidth × Height ≥ 655,3601024×640 = 655,360 ✓
Maximum pixelsWidth × Height ≤ 8,294,4002880×2880 = 8,294,400 ✓
Maximum edgeMax(width, height) ≤ 3,840 px3840×864 ✓, 4096×1024 ✗
Aspect ratioMax edge / Min edge ≤ 3:13072×1024 ✓, 4096×256 ✗

Quality Options

QualityDescriptionUse Case
lowFast, cost-effective generationQuick prototypes, iterations
mediumBalanced quality and speedMost use cases, professional work
highPremium quality with maximum detailFinal artwork, premium content

Background Options

BackgroundDescriptionUse Case
autoModel selects the best background modeGeneral purpose, recommended default
opaqueSolid backgroundStandard images, no transparency needed

Output Format Options

FormatDescriptionBest For
pngLossless format with transparency supportProfessional use, highest quality
jpegCompressed formatWeb optimization, smaller files
webpModern format with superior compressionWeb applications

Code Examples

curl --location 'https://api.1min.ai/api/features' \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"type": "IMAGE_GENERATOR",
"model": "gpt-image-2",
"promptObject": {
"prompt": "A serene Japanese garden with cherry blossoms and a traditional tea house",
"size": "1536x1024",
"quality": "high",
"n": 1,
"background": "auto",
"output_format": "png"
}
}'

Interactive Playground

API Playground

https://api.1min.ai/api/features
Describe the image you want to generate in detail (max 4000 characters)
Custom dimensions in WxH format. Both values must be divisible by 16. E.g. 1024x1024, 1536x1024, 1024x1536
Image quality level
Number of images to generate (1-10)
Background mode for the generated image
Format of the output image
Compression level (0-100, higher = better quality)

Generated cURL Command:

curl -X POST "https://api.1min.ai/api/features" \
-H "API-KEY: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{
"type": "IMAGE_GENERATOR",
"model": "gpt-image-2",
"promptObject": {
"prompt": "A serene Japanese garden with cherry blossoms and a traditional tea house",
"size": "1024x1024",
"quality": "medium",
"n": 1,
"background": "auto",
"output_format": "png"
}
}'

Response Format

{
"aiRecord": {
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"userId": "user-12345",
"teamId": "team-67890",
"teamUser": {
"teamId": "team-67890",
"userId": "user-12345",
"userName": "John Doe",
"userAvatar": "https://example.com/avatar.jpg",
"status": "ACTIVE",
"role": "ADMIN",
"creditLimit": 100000000,
"usedCredit": 42000,
"createdAt": "2025-01-01T00:00:00.000Z",
"createdBy": "SYSTEM",
"updatedAt": "2025-01-15T10:30:00.000Z",
"updatedBy": "SYSTEM"
},
"model": "gpt-image-2",
"type": "IMAGE_GENERATOR",
"metadata": null,
"rating": null,
"feedback": null,
"conversationId": null,
"status": "SUCCESS",
"createdAt": "2025-01-15T10:30:00.000Z",
"aiRecordDetail": {
"promptObject": {
"prompt": "A serene Japanese garden with cherry blossoms and a traditional tea house",
"size": "1536x1024",
"quality": "high",
"n": 1,
"background": "auto",
"output_format": "png"
},
"resultObject": [
"development/images/2025_01_15_10_30_15_001_japanese_garden.png"
],
"responseObject": {}
},
"additionalData": null,
"temporaryUrl": "https://s3.us-east-1.amazonaws.com/asset.1min.ai/development/images/2025_01_15_10_30_15_001_japanese_garden.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=EXAMPLE_CREDENTIAL&X-Amz-Date=20250115T103000Z&X-Amz-Expires=604800&X-Amz-Signature=example_signature&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject"
}
}

Use Cases

  • Creative Design: High-fidelity illustrations, concept art, and photo-realistic visuals at custom dimensions
  • Social Media Content: Eye-catching posts, stories, and promotional materials tailored to exact platform sizes
  • Marketing Assets: Product mockups, advertising visuals, and brand imagery at any resolution
  • Character Design: Detailed character illustrations and visual storytelling
  • Architecture Visualization: Hyper-realistic building designs and interior layouts
  • Publishing: Premium book covers, editorial illustrations, and graphic design
  • Game Assets: High-fidelity concept art and visual development for games