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
GPT Image 2 example: cinematic collage poster with bold GPT Image 2.0 branding and French New Wave styling
Brand poster
GPT Image 2 example: open coffee-table book with dual fashion editorial portraits in grey and black evening wear
Fashion editorial
GPT Image 2 example: two alien figures in hoodies at an outdoor cafe with milkshake and city street background
Surreal scene
GPT Image 2 example: woman in canvas jacket looking back on a coastal overlook beside a vintage sedan
Cinematic portrait
GPT Image 2 example: man in floral matching outfit holding a poodle with dyed ears and a bird on his head
Surreal portrait
GPT Image 2 example: black-and-white manga page with rainy alley meeting and cinematic panel layout
Manga comic
GPT Image 2 example: editorial infographic titled 6 Biggest Design Trends in 2025 with six styled panels
Design infographic
GPT Image 2 example: flash-lit portrait of two friends at night with neon sign in the background
Night portrait

Trusted by teams at

meta
nba
loreal
puma
cisco
deel
shopify
decathlon
dallas-mavericks
pittsburgh-pirates
tala
dyson
dazn
wsc-sports

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.
Get Started Free

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",
)
API Docs

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.

Start Building with the Magic Hour GPT Image 2 API

Free credits on signup. SDKs for Python, Node.js, Go, and Rust. Production-ready in minutes.