GPT Image 2 API
Generate and edit images with flexible aspect ratios, resolution, and quality controls.
- Text to image
- Image editing
Playground
Input
User's prompt
Reference image URLs (URLs or base64 data URIs) for image-to-image mode
Runs are charged to your balance.
Output
Output will appear here.
Pricing
Quick start
Full API reference →1curl -X POST https://api.api-stock.com/api/v1/generation/create \2 -H "Authorization: Bearer $API_STOCK_KEY" \3 -H "Content-Type: application/json" \4 -d '{5 "model": "gpt-image-2",6 "input": {7 "prompt": "A cinematic shot of a city at dusk",8 "size": "1:1",9 "resolution": "1k"10 }11 }'
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | Yes | — | User's prompt |
urls | string[] | No | — | Reference image URLs (URLs or base64 data URIs) for image-to-image mode |
size | string | No | 1:1 | Output image aspect ratio. For GPT Image 2.5 models, 1:3 and 3:1 require 2k or 4k resolution.One of: auto, 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 5:4, 4:5, 2:1, 1:2, 3:1, 1:3, 21:9, 9:21 |
resolution | string | No | 1k | Output image resolutionOne of: 1k, 2k, 4k |
Frequently asked questions
How much does GPT Image 2 cost?
GPT Image 2 starts at $0.013 per generation through the API Stock API. You pay per use from a single prepaid balance — there is no subscription — and the final price scales with parameters such as resolution or duration.
How do I get an API key for GPT Image 2?
Sign up for API Stock, top up your balance by any amount and create an API key in the dashboard — it takes a couple of minutes and needs no contract. The same key works with every model in the catalog, so there is no separate key to obtain for GPT Image 2.
How do I call the GPT Image 2 API?
Send a POST request to https://api.api-stock.com/api/v1/generation/create with your API key and the model id "gpt-image-2". The call returns a task id you poll, or a webhook callback when the result is ready. A ready-to-run example is in the quick start above.
What input parameters does GPT Image 2 accept?
GPT Image 2 accepts 4 input parameters, including the required field(s) prompt. Their types, defaults and allowed values are listed in the parameters table above.
What happens if a GPT Image 2 request fails?
API Stock automatically retries the request on a reserve provider. If every provider fails, the charge is refunded to your balance.
Can I use GPT Image 2 with the same API key as other models?
Yes. Every model on API Stock — video, image, music and chat — shares one API key and one prepaid balance, so you can switch to GPT Image 2 without new credentials.
Other Image models
- Nano Banana 2 LiteGoogle$0.005/ generation
- GPT Image 2.5 FlareOpenAI$0.01/ generation
- GPT Image 2.5 SunburstOpenAI$0.01/ generation
- Z-ImageAlibaba$0.01/ generation
- Nano BananaGoogle$0.015/ generation
- Grok Imagine 1.5 ImagexAI$0.023/ generation
- Grok Imagine 2.0 ImagexAI$0.023/ generation
- Nano Banana 2Google$0.023/ generation
- Wan 2.7 ImageAlibaba$0.029/ generation
Guides
- Image generationWhich image model to use for the picture you need, prompts that produce it, batching for variants, and the API run from prompt to file URL.8 min read
- Image editingEditing photos with references instead of prompts — background swaps, product composites, style matching, and the Midjourney action chain from imagine to inpaint.8 min read
- GPT Image 2.5 — Sunburst, Flare, prompts and real examplesChoose a GPT Image model, compare Sunburst and Flare, copy four practical prompts, inspect six real renders, and generate or edit images through API Stock.9 min read