Hosted services
Generate an image
Generate or edit an image from a text prompt on the model you choose. Returns base64 image data with its MIME type.
POST
https://cloud.generalinput.com/v1/platform/generate-imageAuthenticationRequires
platform:use on a platform API key. A CLI session always passes.Body
| Field | Type | Required | Notes |
|---|---|---|---|
prompt | string | yes | What to draw, or what to change in the reference images. |
model | string | no | One of the models below. Defaults to vertex/gemini-nano-banana-2.1. |
aspectRatio | string | no | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, or 2:3. |
resolution | string | no | 1K (default), 2K, or 4K, where the model draws it. |
quality | string | no | low, medium, or high, where the model has a quality setting. |
referenceImages | string[] | no | Base64 image bytes (PNG, JPEG, or WebP) to edit or draw from. Not URLs. |
A setting the chosen model cannot take is refused with a 400.
Models
model | Best for | resolution | quality | Most referenceImages |
|---|---|---|---|---|
vertex/gemini-nano-banana-2.1 | Fast and low cost, with legible text in images. | 1K, 2K, 4K | none | 14 |
openai/gpt-image-2.5-sunburst | The highest quality and the most precise edits of references. | 1K | low, medium (default), high | 16 |
Response
{
"imageBase64": "iVBORw0KGgo…",
"mimeType": "image/png",
"model": "vertex/gemini-nano-banana-2.1",
"promptTokens": 12,
"outputTokens": 1913
}| Field | Type | Notes |
|---|---|---|
imageBase64 | string | The image bytes, base64-encoded. |
mimeType | string | image/png, for instance. |
model | string | The model that drew it. |
promptTokens | number | Tokens the prompt and references used. |
outputTokens | number | Tokens the image and the model's thinking used. |
A model that declines the prompt answers 422 with code: "rejected". A provider failure answers 502.
Examples
curl -s -X POST https://cloud.generalinput.com/v1/platform/generate-image \
-H "Authorization: Bearer $GI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"a line drawing of a lighthouse","aspectRatio":"1:1"}' \
| jq -r .imageBase64 | base64 -d > lighthouse.pngEdit that image on GPT Image. An image is too long for a shell argument, so jq reads it from a file:
jq -n --rawfile image <(base64 < lighthouse.png) \
'{prompt:"paint the lighthouse red", model:"openai/gpt-image-2.5-sunburst", referenceImages:[$image]}' \
| curl -s -X POST https://cloud.generalinput.com/v1/platform/generate-image \
-H "Authorization: Bearer $GI_API_KEY" \
-H "Content-Type: application/json" \
-d @- \
| jq -r .imageBase64 | base64 -d > lighthouse-red.png