Generate Image
generate_imagePut a REAL photo or illustration on the site by describing it — no image bytes to send. Give a vivid prompt and a public/ path (e.g. public/hero.jpg); Kleap generates it with Cloudflare FLUX.2 and stores it as a proper binary asset, exactly like write_files with encoding:"base64" but with NO base64 to transmit (a real image's base64 is too big for a model to emit reliably — this is the ONLY dependable way to add a generated picture). Use it for hero photos, section illustrations, onboarding images, OG images, or to replace a broken/ugly image. Square 768×768 by default; pass width/height (256–1440) for other ratios; hd:true uses the premium model (sharper, slower). ⚠️ To REPLACE an existing image, generate to a NEW filename (e.g. hero-2.jpg) and point the markup at it — overwriting the same path can be served stale from CDN/R2 cache. After it returns, call publish_app to deploy it live.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hd | No | true = premium model (flux-2-dev): sharper, slower. Default = fast klein model. | |
| path | Yes | public/ image path to create, ending .png/.jpg/.jpeg/.webp (e.g. public/hero.jpg). Use a NEW name to replace an image. | |
| width | No | Pixel width 256–1440 (default 768). | |
| app_id | Yes | The app ID | |
| height | No | Pixel height 256–1440 (default 768). | |
| prompt | Yes | Vivid description of the image to generate (subject, mood, lighting, style). | |
| context | Yes | Why this call, in one short sentence. Used to improve the connector; never include credentials or personal data. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | ||
| size | No | ||
| bytes | No | ||
| model | No |