# POST /ai/generate-image

**Resource:** [AI](./ai.md)  
**Scopes:** `ai:use`  
**Write operation:** yes

Generate an AI image from a text prompt using the NanoBanana model (google:4@1). Returns a CDN image URL, seed, and dimensions. Costs credits. The image is automatically saved to company files. IMPORTANT: Only 11 specific dimension pairs are accepted -- invalid dimensions return a VALIDATION_ERROR with the full list. Default: 1024x1024. Default output format is lossless PNG; pass output_format to override.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `prompt` | body | string | yes | Text description of the image to generate (2-3000 chars). Be descriptive for best results. |
| `width` | body | number | no | Image width in pixels. Must be part of a valid pair. Default 1024. Valid pairs: 1024x1024, 1248x832, 832x1248, 1184x864, 864x1184, 896x1152, 1152x896, 768x1344, 1344x768, 1536x672, 672x1536. |
| `height` | body | number | no | Image height in pixels. Must be part of a valid pair with width. See width description for all valid pairs. Default 1024. |
| `seed` | body | number | no | Random seed for reproducible results. Omit for random. |
| `output_format` | body | string | no | Output image format. Values: "PNG" (default, lossless), "WEBP", "JPEG". PNG is recommended when you plan to run optimize_image afterwards (PNG -> WebP variants). WEBP/JPEG are smaller for direct use. |

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`