Hosted services
Generate an image
Generate an image from a text prompt. 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. |
aspectRatio | string | no | 1:1, 16:9, 9:16, 4:3, or 3:4. |
Response
{ "imageBase64": "iVBORw0KGgo…", "mimeType": "image/png", "text": "…" }| Field | Type | Notes |
|---|---|---|
imageBase64 | string | The image bytes, base64-encoded. |
mimeType | string | image/png, for instance. |
text | string | Optional descriptive text from the model. |
Example
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.png