GPT Image 2 / 2.5 API
These facts describe the OpenAI-compatible Images surface at https://argolink.io/v1 (checked 2026-10-07). Other compatible endpoints are similar but can differ in sizes, quality values and price; check theirs.
Endpoints
| Call | Body | Use |
|---|---|---|
POST /v1/images/generations | JSON | text to image |
POST /v1/images/edits | JSON with images: [{"image_url": …}], or multipart with repeated image[] files | image to image, reference edits, masked edits |
Auth: Authorization: Bearer <key>. Both calls return only when every image is finished: set the client timeout to 600 seconds or more and do not retry on a short timeout, or you may pay twice.
Fields
| Field | Values | Notes |
|---|---|---|
model | gpt-image-2, gpt-image-2.5-flare, gpt-image-2.5-sunburst | same fields for all three |
prompt | text | required; also state the aspect ratio in words |
size | WIDTHxHEIGHT, e.g. 1024x1024, 2048x1152, 3840x2160 | pixels only: never 1K, 4K or 16:9; there is no aspect_ratio field |
quality | auto, low, medium, high | the values documented on this endpoint |
n | 1–7 | each returned image is billed; use the length of data as the real count |
response_format | url or b64_json | URLs are temporary: download them right away |
images / image[] | 1–16 references | JSON links (HTTPS or data URLs) or multipart files; one format per request |
mask | mask.image_url in JSON, a mask file in multipart | applies to the first reference |
Recommended sizes (python scripts/gptimage.py sizes): 1:1 1024x1024 / 1440x1440 / 2160x2160; 16:9 1024x576 / 2048x1152 / 3840x2160; 9:16 576x1024 / 1152x2048 / 2160x3840; 3:4, 4:3, 2:3, 3:2, 21:9 and 5:2 also have a row. The returned image can differ from the requested pixels; check it when exact size matters.
Billing
Per returned image, by the returned image's longest edge: up to 1024 px is 1K ($0.015), 1025–2048 is 2K ($0.015), above 2048 is 4K ($0.02). Quality does not change the price here. 2560x1440 is a valid request but bills as 4K. python scripts/gptimage.py cost --size 3840x2160 -n 3 prints the arithmetic.
SDK usage
Pass the key and base URL explicitly so an OPENAI_API_KEY meant for OpenAI is never sent to another host.
pythonimport base64, os from openai import OpenAI client = OpenAI(api_key=os.environ["GPT_IMAGE_API_KEY"], base_url="https://argolink.io/v1", timeout=600) result = client.images.generate(model="gpt-image-2", prompt="A lighthouse at dusk, 16:9 composition", size="2048x1152", quality="high", n=1, response_format="b64_json") open("lighthouse.png", "wb").write(base64.b64decode(result.data[0].b64_json)) with open("room.png", "rb") as room, open("sofa.png", "rb") as sofa: edited = client.images.edit(model="gpt-image-2.5-sunburst", image=[room, sofa], # sent as image[] parts prompt="Put the sofa from the second image into the room in the first image", size="1728x1152", response_format="b64_json")
tsimport OpenAI, { toFile } from "openai"; import { readFile } from "node:fs/promises"; const client = new OpenAI({ apiKey: process.env.GPT_IMAGE_API_KEY, baseURL: "https://argolink.io/v1", timeout: 600_000 }); const result = await client.images.generate({ model: "gpt-image-2", prompt: "A lighthouse at dusk, 16:9 composition", size: "2048x1152", quality: "high", response_format: "b64_json" }); const edit = await client.images.edit({ model: "gpt-image-2", prompt: "Make it winter", image: [await toFile(await readFile("lighthouse.png"), "lighthouse.png", { type: "image/png" })] });
If your TypeScript version of the SDK types size as a fixed list, add // @ts-expect-error on that line: the SDK sends extra values unchanged.
Errors and what to do
| Symptom | Likely cause | Action |
|---|---|---|
| 401 | missing or wrong key | fix the key; don't retry |
Rejected, message names size | 1K, 16:9 or a malformed value | send pixels from the table |
| Rejected, message names the images | more than 16, or JSON and multipart mixed | split or pick one format |
429, or 503 with Retry-After | rate limit or no free capacity | wait as told, then retry |
| Client timeout | the image was still rendering | raise the timeout to 600 s; don't blindly resend |
| Square result for a wide request | ratio missing from the prompt | add "16:9 composition" to the prompt |
data shorter than n | fewer images returned | bill and handle what came back |
Script
scripts/gptimage.py wraps the SDK: generate, edit (--image up to 16 times, --mask), sizes and cost. Run it with GPT_IMAGE_API_KEY set; GPT_IMAGE_BASE_URL points it at another compatible endpoint.


