Text to image
Generate an image from a text prompt.
Not writing code? See Generate images in your own tools.
Before you start
https://api.ofox.io/v1openai/gpt-image-2.6-flarepip install openaiCode
Every sample below was run verbatim. The result is saved as output.png in the current directory.
cURL
curl -s https://api.ofox.io/v1/images/generations \
-H "Authorization: Bearer YOUR_OFOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-image-2.6-flare",
"prompt": "A red apple on a white table, soft natural light",
"size": "1024x1024",
"quality": "low"
}' \
-o response.json
# The image comes back as base64 — decode and save it (needs jq; on error, read response.json)
jq -r '.data[0].b64_json' response.json | base64 --decode > output.pngCommon tweaks
Change one parameter in the request above:
Size (size) and quality (quality)
- Size
size: width and height both multiples of 16, longest edge ≤ 3840, aspect ratio between 1:3 and 3:1, total pixels ≥ 655,360.768x768fails;1024x768works. If omitted, the model decides; in our tests it was 1254×1254. See Size. - Quality
quality: get it working withlowfirst, then go higher. Omitting it is not the same asmedium; the model picks a tier itself.gpt-image-2has noxhighormax. Usage per tier is in Quality.
Planning complexity (complexity)
high when omitted; lower it for faster images.complexity controls how much compute the model spends planning the image before generating it. It is independent of quality, which controls rendering detail, and the two can be set separately.
Changing complexity costs nothing extra. Higher values are slower and may introduce unwanted changes; for simple compositions low is enough. The edit endpoint supports this parameter too.
cURL
curl -s https://api.ofox.io/v1/images/generations \
-H "Authorization: Bearer YOUR_OFOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-image-2.6-flare",
"prompt": "A red apple on a white table, soft natural light",
"size": "1024x1024",
"quality": "low",
"complexity": "low"
}' \
-o response.json
jq -r '.data[0].b64_json' response.json | base64 --decode > output.pngSVG vector output
svg.model is required and n must be 1.Good for icons and illustrations whose paths, shapes and colors you want to edit afterwards. Generation takes two steps: the image model named in the outer model first generates a reference image, then the text model named in svg.model writes SVG code from it. quality and complexity affect only the reference image; reasoning effort while writing the SVG is controlled separately by svg.reasoning.effort.
cURL
curl -s https://api.ofox.io/v1/images/generations \
-H "Authorization: Bearer YOUR_OFOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-image-2.6-flare",
"prompt": "A flat-style icon of an orange fox, white background",
"size": "1024x1024",
"quality": "low",
"n": 1,
"output_format": "svg",
"svg": { "model": "gpt-6-luna" }
}' \
-o response.json
jq -r '.data[0].b64_json' response.json | base64 --decode > output.svgAnimated GIF
The frame count and per-frame size together must meet a minimum pixel requirement; frames that are too small return No supported sheet fits … GIF frames. For example, with 9 frames 256x256 is not enough but 512x512 works. Frame count, size and number of images together also cannot exceed an upper limit; if they do, lower frame_count, shrink the size or reduce n.
stream, partial_images and output_compression are not supported, and when editing it cannot be combined with mask. frame_count and frame_duration_ms only take effect for GIF output.
cURL
curl -s https://api.ofox.io/v1/images/generations \
-H "Authorization: Bearer YOUR_OFOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-image-2.6-flare",
"prompt": "An orange fox wagging its tail side to side, flat illustration style, seamless loop",
"size": "512x512",
"quality": "low",
"output_format": "gif",
"frame_count": 8,
"frame_duration_ms": 120
}' \
-o response.json
jq -r '.data[0].b64_json' response.json | base64 --decode > output.gifParameter values
Accepted values and measured defaults for this family. For size and quality, see Size and Quality on the overview page.
openai/gpt-image-2.6-flareopenai/gpt-image-2.6-sunburstopenai/gpt-image-2.5-flareopenai/gpt-image-2.5-sunburstopenai/gpt-image-2Case-sensitive; a wrong case returns 404. Write out the full ID with the openai/ prefix.
Each image is billed separately. Above 10 returns 400.
png, jpeg and webp all measured working. gif and svg are 2.6 only — see Animated GIF and SVG vector output.
2.6 only. How much planning happens before generation; independent of quality, at no extra cost. See complexity.
▶Advanced · 7svg · frame_count · frame_duration_ms · output_compression · background · moderation · partial_imagesExpand
2.6 only; required when output_format is svg. svg.model (required) is the OpenAI text model that writes the SVG, without the openai/ prefix; svg.reasoning.effort (optional) is the reasoning effort while writing the SVG. See SVG vector output.
2.6 only. Number of GIF frames; only takes effect when output_format is gif.
2.6 only. Milliseconds each GIF frame is shown, rounded to 10 ms; only takes effect when output_format is gif.
Only applies to jpeg and webp.
A transparent background needs png or webp; jpeg has no transparency.
How strict content moderation is.
Used with stream: true: how many intermediate images to send while generating.
Common errors
For other errors, see the full error table.
Official docs
OpenAI’s docs describe behavior when you call OpenAI directly. When you call through OfoxAI, the measured results in these pages take precedence. For example, you don’t need to pin a provider for editing.
- OpenAI image generation guide · Generate images
- OpenAI image generation guide · Size and quality options
- OpenAI Images API reference
- OpenAI image generation guide · SVG output
- OpenAI image generation guide · Animated GIF output
- OpenAI model page: gpt-image-2.6-flare
- OfoxAI Images API (shared request and response structure)