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 credits on signup
Transparent per-credit pricing
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

Estimate Your API Costs

Build with model-specific APIs for video, image generation, and image editing. Compare inputs, examples, and capabilities across Magic Hour's supported models.
Images Per Month
10 images
images
Recommended plan
Pro Annual
$300
/year
300,000 credits per year
Up to 3.5 hours of video
Up to 30,000 images
PRO ANNUAL covers your usage
Estimated usage
25,000credits / month
Included
25,000credits / month
TOTAL BILL
$300
/year

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.

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 supports 640px, 1K, 2K, and 4K resolutions.

Yes. GPT Image 2 produces photorealistic results with strong composition and lighting accuracy, making it suitable for product photography and editorial content.

Magic Hour offers subscription plans starting at $15/month (Creator), $39/month (Pro), and $99/month (Business), each including a monthly credit allotment. 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 (up to 4 images per request). You can also contact us to set up usage-based (pay-as-you-go) pricing. GPT Image 2 requires a paid plan (Creator, Pro, or Business) and is not available on the free tier.

Sign up at magichour.ai/developer — no credit card required — to get an API key instantly. The key works across all Magic Hour API endpoints, but GPT Image 2 itself requires a paid plan (Creator, Pro, or Business). Once subscribed, call it with our Python, Node.js, Go, or Rust SDKs.

Signing up is free and gives you an API key, but GPT Image 2 is not available on the free tier — it requires a paid plan (Creator, Pro, or Business). Paid plans unlock GPT Image 2 along with higher credit limits, concurrency, and commercial use rights.

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.