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

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",
)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.
Pricing tier options
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
- 25,000credits / month
- 25,000credits / month
Estimated usage
Included
TOTAL BILL
$300
/year
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.
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.