Skip to main content
POST
Image API protocol
FreeModel 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
default:"medium"
For gpt-image-2, use low, medium, or high. Quality and size determine the final charge.
string
Use 1024x1024, 1536x1024, or 1024x1536 for an explicit square, landscape, or portrait frame.
integer
default:"1"
Request one image. The current FreeModel 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.021 to $0.26 per successful generation depending on quality and size. See the model page for the full matrix. gpt-image-2-all remains $0.02 per successful generation.