/v1/images/generations and /v1/images/edits) for text-to-image and reference-image editing. Compatible with the OpenAI SDK.
Supported Models
Authentication
Text-to-image /v1/images/generations
Method: POST
Base URL: https://api.gregapi.com/v1/images/generations
Request Parameters
Aspect ratio values:
gemini-3.1-flash-image additionally supports 1:4, 4:1, 1:8, 8:1, 9:21.
Example
Response (response_format=b64_json)
Response (response_format=url)
Billed-but-blocked error response
usage is only returned when the failure already incurred billable prompt/input tokens. Ordinary failures (parameter validation, quota, network) do not return usage.
Image editing /v1/images/edits
Method: POST (multipart/form-data)
Base URL: https://api.gregapi.com/v1/images/edits
Request Parameters
Notes
- The first
image_urls[]serves as the base image, the rest are references; up to 14 total. - Only public HTTP/HTTPS image URLs are supported; localhost and private IPs are not.
- Without
size, it is inferred from the base image (forgemini-3-pro-image-previewonly). - An explicit
aspect_ratiotakes precedence when provided.