---
title: "Generate one image with GPT Image 2"
method: POST
path: "/v1/images/generations"
tags: ["Generation"]
---

# Generate one image with GPT Image 2

`POST /v1/images/generations`

## Request

- Base URL: `https://infer.flow7.org`
- URL: `https://infer.flow7.org/v1/images/generations`
- Auth: HTTP bearer

Native image generation with exact per-image reservation before dispatch. The Stable generation price matrix is published in /api/public/catalog. Provider identity and provider asset URLs remain private. URL results use short-lived Infer-signed content URLs; b64_json bytes are returned once and are not retained. Infer performs no automatic paid generation retry. A post-dispatch transport ambiguity leaves the reservation locked rather than guessing about provider spend.

## Headers

- `Idempotency-Key` string

## Request body

- ImageGenerationRequest
  - `model` string, required: gpt-image-2 or infer/gpt-image-2:stable. Native image generation is currently Stable-only.
  - `prompt` string, required
  - `n` 1
  - `quality` 'medium' | 'high'
  - `size` string: Must match a currently priced GPT Image 2 size in /api/public/catalog.
  - `response_format` 'url' | 'b64_json'
  - `output_format` 'png'
  - `stream` false: Image SSE is not currently exposed by Infer.
  - `idempotency_key` string

## Response `200`

Completed image generation

- ImageGenerationResponse
  - `created` integer, required
  - `data` object[], required
    - `url` string, uri: Short-lived Infer-signed content URL. Supplier URLs are never returned.
    - `b64_json` string: PNG base64 when response_format=b64_json. Infer does not retain the generated bytes.
  - `relay` GenerationRelayMetadata
    - `request_id` string
    - `receipt_id` string
    - `price_version` string: Opaque reference (pv_…) to the immutable price version that priced this generation.
    - `tier` 'stable'
    - `customer_cost_usd` number
    - `reserved_cost_usd` number
    - `provider_disclosed` false

## Other responses

- `400`: The request could not be processed.
- `401`: A valid Bearer API key is required.
- `402`: The wallet cannot cover the request's reservation.
- `403`: The key, organization, environment, or scope cannot perform this operation.
- `404`: No active price exists for the requested selector in this environment.
- `409`: The idempotency key is in progress, expired, or otherwise cannot be replayed.
- `413`: The input or request body exceeds a configured limit.
- `422`: A selector, input, output limit, session identifier, or routing option is invalid.
- `429`: The request rate limit or an API-key spend ceiling was reached.
- `500`: Infer could not complete the operation.
- `503`: Live inference is disabled, no eligible route has capacity, or no route completed within the retry budget.

---

[API](https://skmtc.dev/flow7/apis/infer-by-flow7-public-api.md) · [All operations](https://skmtc.dev/flow7/apis/infer-by-flow7-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/flow7/apis/infer-by-flow7-public-api/revisions/e73ecffd3cf3?raw)
