GPT Image 2.6 API: OpenAI integration guide
Connect your application directly to OpenAI’s Images API. Start with a still image, inspect the returned file, then add editing, GIF or SVG output. This guide explains the official API separately from this website’s browser generator.
Set up OpenAI authentication
Use an OpenAI API key with access to the selected model. Set OPENAI_API_KEY on your server; send it as a Bearer token. Keep it out of browser bundles and public environment variables. Model access, verification requirements and rate limits depend on your OpenAI account.
GPT Image 2.6 Flare and Sunburst model IDs
Set model to gpt-image-2.6-flare or gpt-image-2.6-sunburst. Use POST /v1/images/generations for a new image and POST /v1/images/edits for edits with image inputs. Compare the models with the same prompt and settings.
| Model | OpenAI model ID |
|---|---|
| flare | gpt-image-2.6-flare |
| sunburst | gpt-image-2.6-sunburst |
Server-side JavaScript example
Install the official openai Node.js SDK and set OPENAI_API_KEY in the server environment. This example saves the base64 response as a PNG. Executing it makes a paid OpenAI request.
// npm install openai
import OpenAI from "openai";
import { writeFile } from "node:fs/promises";
const client = new OpenAI(); // reads OPENAI_API_KEY
const result = await client.images.generate({
model: "gpt-image-2.6-flare",
prompt: "A blue ceramic mug on a pale stone table, soft window light",
size: "1024x1024",
quality: "medium",
complexity: "medium",
output_format: "png",
n: 1,
});
const encoded = result.data?.[0]?.b64_json;
if (!encoded) throw new Error("No image returned");
await writeFile("mug.png", Buffer.from(encoded, "base64"));Images, GIFs, SVGs and reference inputs
| Parameter | What to send |
|---|---|
prompt | Describe the subject, composition and constraints. For an edit, say what must stay unchanged. |
size | Use size, for example 1024x1024. Check the current model’s dimension and total-pixel limits. |
quality | Rendering detail: low, medium, high, xhigh or max for these models. |
complexity | Use complexity: low, medium or high. This planning control is separate from rendering quality. |
output_format | Choose a supported output format such as png, gif or svg. Inspect the actual downloaded file rather than assuming the requested format succeeded. |
image | Send image files to /v1/images/edits using multipart form data; describe the intended change and what must remain unchanged. |
frame_count / frame_duration_ms | For GIF output, frame_count accepts 2–16; frame_duration_ms accepts 20–2000 ms, rounded to 10 ms. Both defaults and pixel limits are documented by OpenAI. |
For a GIF, set output_format to gif and save decoded bytes as .gif. For SVG, request svg and save as .svg. Inspect dimensions, transparency and frame timing in the actual file. Do not interpret the browser generator’s presets as the official API’s maximum capabilities.
GPT Image 2.6 API pricing vs studio credits
OpenAI bills API usage separately from this website. The official pricing page lists model token rates; output cost depends on the tokens used, and input tokens can add to the total. Review usage after a representative request instead of assuming a fixed per-image price. This website charges 20 credits per successful browser generation; its packs and subscriptions do not fund your OpenAI API account.
Handle authentication, limits and failed requests
For 401, check the OpenAI key and authorization header. For access errors, confirm project permissions and model availability. For 400, inspect the error message and request parameters. For 429, distinguish rate limits from exhausted quota before retrying with backoff. For 5xx or timeouts, keep request IDs for diagnosis and avoid blindly resubmitting paid requests.
Can I call this website as a public API?
This is an OpenAI API tutorial, not a public API service offered by this website. Use OpenAI credentials for your own application. If you prefer a browser workflow, our generator keeps prompts, settings and original files together without asking you to write integration code.
Documentation and next steps
- OpenAI GPT Image 2.6 Flare model
- OpenAI image-generation documentation
- OpenAI API pricing
- OpenAI Images API reference
- OpenAI API error codes
Documentation checked November 6, 2026. The code sample is an integration example, not an additional generation run tested for this guide.