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.edit endpoint.

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 model from gpt-image-1 to gpt-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 read data[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

ParameterValuesNotes
size1024x1024 / 1536x1024 / 1024x1536Square / landscape / portrait — pick one
qualitylow / medium / highHigher is slower and pricier; default high
nintegerHow many images per call
output_formatpng / jpeg / webpOutput format, default png
backgroundtransparent / opaque / autoTransparent needs png/webp
moderationauto / lowModeration 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:

TypePrice (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:

QualitySquare 1024×1024Landscape/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

SymptomCause & fix
401 invalid_api_keyWrong key, or missing Authorization: Bearer sk-...
400 about size/qualitysize must be one of three values; quality must be low/medium/high
content_policy_violationPrompt tripped moderation — rephrase, or add "moderation": "low"
Image comes back emptyDon’t read data[0].url — gpt-image-1 only has data[0].b64_json
429 rate limitRate limited — add exponential backoff; the gateway already fails over across channels
Request times outhigh quality is slow — raise the client timeout above 120s

FAQ

  • Can it do image-to-image / inpainting? Yes. Use client.images.edit(), passing image (the source), an optional mask (transparent areas get repainted), and a prompt.
  • Can I get a transparent background? Yes. Set background="transparent" and set output_format to png or webp.
  • 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.