gpt-image-1 API Tutorial: Pricing, Examples & Free Credits (2026)
Call the gpt-image-1 image API step by step — Python, Node.js and cURL examples, official pricing broken down per image (low quality from ~$0.01), and common error fixes. One GetModel key, free credits to start.
If you want a “type text, get an image” feature in your product, gpt-image-1 is currently the most reliable model for instruction following and rendering text inside the image. Here’s how to get it running through GetModel’s OpenAI-compatible endpoint — just point base_url at https://getmodel.ai/v1, and the same key also calls Claude, GPT and Gemini. New accounts get free credits, so you can try gpt-image-1 for free first.
What is gpt-image-1
gpt-image-1 is OpenAI’s natively multimodal image generation model, called via the /v1/images/generations endpoint. Compared with the previous DALL·E 3, its strengths are:
- Better instruction following — multiple subjects, composition and relative positioning come out closer to the prompt;
- Cleaner in-image text — text in posters, UI and logos no longer turns to mush;
- Image-to-image and inpainting — pass a reference image plus a mask to the
images.editendpoint.
For live pricing and availability, see its successor’s gpt-image-2 model page.
⏳ Timeliness note (2026): gpt-image-1 is scheduled to be shut down on 2026-12-01 on the OpenAI API, with gpt-image-2 as the recommended replacement. The upside of GetModel’s aggregated endpoint: when that day comes, just change
modelfromgpt-image-1togpt-image-2— no changes to auth, SDK, or request shape.
Quick start: how to use gpt-image-1
First, create an API key on the “API Tokens” page of the GetModel console (it looks like sk-...). The endpoint is always https://getmodel.ai/v1.
⚠️ Key point: gpt-image-1 only returns base64 (
b64_json), never an image URL. Don’t readdata[0].url— it’s empty.
Python
from openai import OpenAI
import base64
client = OpenAI(
api_key="sk-your-key",
base_url="https://getmodel.ai/v1",
)
resp = client.images.generate(
model="gpt-image-1",
prompt="A shiba inu in an astronaut helmet floating in space, flat illustration",
size="1024x1024", # or 1536x1024 landscape / 1024x1536 portrait
quality="high", # low | medium | high
n=1,
)
img_b64 = resp.data[0].b64_json
with open("dog.png", "wb") as f:
f.write(base64.b64decode(img_b64))
Node.js
import OpenAI from 'openai';
import { writeFileSync } from 'node:fs';
const client = new OpenAI({
apiKey: 'sk-your-key',
baseURL: 'https://getmodel.ai/v1',
});
const resp = await client.images.generate({
model: 'gpt-image-1',
prompt: 'A neon cyberpunk street in the rain, cinematic lighting',
size: '1536x1024',
quality: 'medium',
});
const b64 = resp.data[0].b64_json!;
writeFileSync('city.png', Buffer.from(b64, 'base64'));
cURL
curl https://getmodel.ai/v1/images/generations \
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-1",
"prompt": "Close-up of a latte with leaf art, warm tones, 45-degree top-down",
"size": "1024x1024",
"quality": "high"
}'
In the returned JSON the image is in data[0].b64_json; base64-decode it and write to a file.
Common parameters
| Parameter | Values | Notes |
|---|---|---|
size | 1024x1024 / 1536x1024 / 1024x1536 | Square / landscape / portrait — pick one |
quality | low / medium / high | Higher is slower and pricier; default high |
n | integer | How many images per call |
output_format | png / jpeg / webp | Output format, default png |
background | transparent / opaque / auto | Transparent needs png/webp |
moderation | auto / low | Moderation strength; low is more permissive |
Pricing: official cost breakdown
gpt-image-1 is billed by token — generated images are counted as “image output tokens.” Official rates:
| Type | Price (per 1M tokens) |
|---|---|
| Text input | $5.00 (cached $1.25) |
| Image input | $10.00 (cached $2.50) |
| Image output | $40.00 |
Translated to “cost per image,” it’s more concrete:
| Quality | Square 1024×1024 | Landscape/Portrait 1536×1024 |
|---|---|---|
| low | $0.011 | $0.016 |
| medium | $0.042 | $0.063 |
| high | $0.167 | $0.25 |
So batch low-quality drafts run about 1 cent each, and high-quality finals about 17 cents each. GetModel passes official rates through with no markup, balance is shared across all models, and per-request usage is itemized in the console “Logs” page. See live prices and comparisons on the pricing page.
Troubleshooting common errors
| Symptom | Cause & fix |
|---|---|
401 invalid_api_key | Wrong key, or missing Authorization: Bearer sk-... |
400 about size/quality | size must be one of three values; quality must be low/medium/high |
content_policy_violation | Prompt tripped moderation — rephrase, or add "moderation": "low" |
| Image comes back empty | Don’t read data[0].url — gpt-image-1 only has data[0].b64_json |
429 rate limit | Rate limited — add exponential backoff; the gateway already fails over across channels |
| Request times out | high quality is slow — raise the client timeout above 120s |
FAQ
- Can it do image-to-image / inpainting? Yes. Use
client.images.edit(), passingimage(the source), an optionalmask(transparent areas get repainted), and aprompt. - Can I get a transparent background? Yes. Set
background="transparent"and setoutput_formattopngorwebp. - Can it return a URL directly? No. gpt-image-1 always returns base64 — upload it to your own object storage if you need a URL.
- How is this different from calling OpenAI directly? The call style, parameters and billing rules are identical (OpenAI-compatible). The only difference: one key covers Claude / GPT / Gemini / gpt-image-1, with a shared balance and free credits to start.
- How do I get free credits? They’re granted on signup — log in to the console to see your balance and create a key, then top up once it works.
Ready? Create an API key and start generating — just swap sk-your-key in any snippet above for your own.