GPT Image 2 API for Developers
GPT Image 2 API
Generate and edit AI images with OpenAI's GPT Image 2 via API. Strong prompt adherence and precise instruction following — for both creative generation and detailed image edits.
Free to start
No watermarks on paid plans
Subscription or usage-based
Auto-scaling

Brand poster

Fashion editorial

Surreal scene

Cinematic portrait

Surreal portrait

Manga comic

Design infographic

Night portrait
Trusted by teams at














Everything You Need to Ship GPT Image 2
OpenAI's image model with exceptional prompt following and editing quality.
Strong Prompt Adherence
GPT Image 2 follows detailed, complex prompts with high accuracy — great for precise creative briefs.
Text-to-Image & Editing
Supports both generating images from scratch and making precise edits to existing images.
High Resolution Output
Generate images up to 4K resolution for print-quality output and large-format use.
Batch Generation
Generate up to 4 images per request for quick side-by-side comparison.
Auto-Scaling Infrastructure
Scales compute to match demand automatically. No GPU provisioning or cold starts.
Commercial-Ready
Paid plans support non-watermarked outputs for commercial delivery.
Integrate in 3 Steps
Add OpenAI-powered image generation and editing to your app in minutes.
1
Get Your API Key
Sign up free and generate an API key from the Developer dashboard. You get free credits to start.
2
Send Your Request
Call /v1/ai-image-generator with a text prompt for text-to-image (up to 4 images per request). For editing, call /v1/ai-image-editor with reference images in assets.image_file_paths.
3
Get Results & Scale
Receive generated or edited images via response. Deploy to production — infrastructure scales automatically.
Code Examples
GPT Image 2 in a few lines of code. Install an SDK or use the REST API directly.
from magic_hour import Client
from os import getenv
client = Client(token=getenv("API_TOKEN"))
res = client.v1.ai_image_generator.generate(
image_count=1,
style={
"prompt": "A minimalist product shot of a glass water bottle on a white marble surface",
"tool": "general",
},
aspect_ratio="1:1",
model="gpt-image-2",
name="GPT Image 2",
resolution="1k",
)SDKs for Every Stack
Official open-source SDKs with full TypeScript/type support. Install and start building.
GPT Image 2 API Pricing
Subscription plans for standard usage.
Prefer usage-based pricing?
Email us or message us in Intercom and we will set up your usage-based pricing.
API Calculator
Use our calculator to estimate your API costs.
Tier
Estimated monthly cost
$0.3600
Built for Builders
See how developers use the GPT Image 2 API to power real products.
Product Photography
Generate precise product shots and lifestyle imagery from detailed brand guidelines.
Image Editing
Edit existing images with natural-language instructions — swap backgrounds, change objects, or apply style changes.
Marketing Campaigns
Create on-brand visual assets at scale with strong adherence to creative briefs.
Creative Production
Generate high-resolution images for editorial, advertising, and print media.
Educational Content
Create accurate visual aids and diagrams for educational materials.
Game & App Design
Generate UI mockups, game assets, and concept art with precise prompt control.
Try before integrating
Try GPT Image 2 Free — No Code Required
Test quality first with the free tool, then plug the same output quality into your app with the API when you are ready.
GPT Image 2 API — Frequently Asked Questions
Magic Hour's GPT Image 2 API lets developers generate and edit AI images using OpenAI's GPT Image 2 model via REST API with SDKs for Python, Node.js, Go, and Rust.
GPT Image 2 excels at following complex, detailed prompts with high accuracy. It also supports both generation and instruction-based image editing in a single model.
Yes. Use /v1/ai-image-generator for text-to-image, or /v1/ai-image-editor with reference images for instruction-based edits.
GPT Image 2 requires a paid plan — it is not available on the free tier.
GPT Image 2 supports 640px, 1K, 2K, and 4K resolutions.
GPT Image 2 starts at 50 credits per image at 640px, scaling to 100 credits at 1K, 200 credits at 2K, and 400 credits at 4K. Generate up to 4 images per request.
Yes. GPT Image 2 produces photorealistic results with strong composition and lighting accuracy, making it suitable for product photography and editorial content.