Skip to main content
POST
Image API protocol
SnapGen exposes an OpenAI-compatible image generations endpoint. Select the exact model page under Image Series for its price and output rules.
string
required
An image model ID returned by GET /v1/models.
string
required
A clear description of the image to generate.
string
Use 1024x1024, 1536x1024, or 1024x1536 for an explicit square, landscape, or portrait frame. Omit it for automatic framing.
integer
default:"1"
Request one image. The current SnapGen image routes do not support batch generation.

Generate an image

Image generation is synchronous and can take 20 to 60 seconds. Set a client timeout of at least 120 seconds.

Decode the response

The response contains base64 image bytes at data[0].b64_json.
On macOS, replace base64 --decode with base64 -D.
gpt-image-2 costs 0.01persuccessfulgenerationandgptimage2allcosts0.01 per successful generation and `gpt-image-2-all` costs 0.02. See the individual model page before estimating cost.