GPT Image 2
GPT Image 2 is OpenAI's state-of-the-art image generation model, built for fast, high-quality image generation and editing with flexible sizes and high-fidelity image inputs.
import { experimental_generateImage as generateImage } from 'ai';
const result = await generateImage({ model: 'openai/gpt-image-2', prompt: 'A red balloon on a wooden table.'});Frequently Asked Questions
What can GPT Image 2 generate?
It creates and edits images from text and image inputs, supporting flexible output sizes and high-fidelity image inputs for editing workflows.
How do I call GPT Image 2 from my application?
Use
generateImagefrom the AI SDK. AI Gateway routes the request to GPT Image 2 and returns the generated image.Can GPT Image 2 edit existing images?
Yes. It accepts high-fidelity image inputs and produces edited outputs while preserving detail from the source image.
How is GPT Image 2 priced?
Pricing is per generated image, with rates depending on output size and quality settings. Check the pricing panel on this page for current values across the dimensions you plan to use.
What output sizes does GPT Image 2 support?
GPT Image 2 supports flexible image sizes. Request the dimensions that match the surface you're rendering into, rather than forcing the model into a fixed canvas.
Does GPT Image 2 support zero data retention through AI Gateway?
Zero Data Retention is not currently available for this model. Zero Data Retention is offered on a per-provider basis. See https://vercel.com/docs/ai-gateway/capabilities/zdr for details.
How does AI Gateway handle authentication for GPT Image 2?
AI Gateway accepts a single API key or OIDC token for all requests. You don't embed OpenAI credentials in your application; AI Gateway routes and authenticates on your behalf.
What are typical generation times?
This page shows live performance metrics measured across real AI Gateway traffic.