Image generations
POST /v1/images/generations
Request fields
Send application/json with model and a nonempty prompt (up to 32,000 characters). Choose a published size and quality combination. Input images belong on /v1/images/edits. Use n: 1 except for the documented two-JPEG Sunburst mode.
Generate an image
Set QUANTEEX_API_KEY in your server environment. This example creates one native 1K image; Python and JavaScript also decode and save the result.
curl "https://api.quanteex.com/v1/images/generations" \
-H "Authorization: Bearer $QUANTEEX_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "gpt-image-2.6-flare",
"prompt": "A watercolor city at sunrise",
"size": "1k",
"n": 1
}'4K square example
This request returns one 2880×2880 PNG at max quality and cannot reserve more than $0.060.
curl --fail-with-body https://api.quanteex.com/v1/images/generations \
-H "Authorization: Bearer $QUANTEEX_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Quanteex-Max-Cost-USD: 0.060" \
--data '{"model":"gpt-image-2.6-flare","prompt":"A ceramic mug in soft daylight","size":"2880x2880","quality":"max","n":1}'Read the response
Each completed image in the JSON data array contains b64_json. Decode it to bytes using the selected output encoding. Save x-request-id for support. The receipt uses the size and quality price; token usage does not add a charge.
Streaming
Add stream: true and parse SSE records. For generation, wait for image_generation.completed and decode its b64_json. For edits and variations, the final type is image_edit.completed. Progress and heartbeat records are not final images. Handle explicit errors and unexpected EOF; a partial or missing result must not be treated as success.
curl --no-buffer "https://api.quanteex.com/v1/images/generations" \
-H "Authorization: Bearer $QUANTEEX_API_KEY" \
-H "Content-Type: application/json" \
--data '{"model":"gpt-image-2.5-flare","prompt":"A watercolor city at sunrise","size":"1k","n":1,"stream":true}'Cost and request ceiling
Set X-Quanteex-Max-Cost-USD to cap the total cost of the image request, for example 0.060 for one 4K max image on Standard. A smaller ceiling rejects the request before generation. Project and API-key budgets still apply.



