Generate (or edit) an image with AI
generate_imageGenerate an image from a text prompt and return a durable public URL ready to pass to create_post as media. To change an image you already have, edit_image is the direct route (image plus instruction); baseImageUrl here does the same edit when it also needs an aspect ratio, product photos or characters. Synchronous: the URL comes back in the same call. Costs 20 AI credits per image, or 40 when reference images are attached (from the monthly pool, see get_image_quota; nothing with the organization's own key, and nothing if it fails). If the workspace speaks as a person or a character and has reference images on file, they are attached so the result looks like them — that is why some images cost more than others. By default a character appears in every image and a person only in photo-like images; set speaker when you know. Write the prompt following get_shot_guide (image_people, image_scene, image_product or place); with shot the server composes it and checks the minimum fields. SPENDS AI CREDITS ONLY WITH confirm: true. Call it first without confirm: nothing runs and nothing is charged, you get the quote (what it will do and the credits). Tell the user, in your own words, exactly that — including the options you chose, so they can change them — and wait for a clear yes before calling again with the same arguments and confirm: true. One yes covers the plan they approved (e.g. every line of an approved voice-over with the chosen voice); anything new or different needs a new yes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| shot | No | Optional structured shot: the server composes the prompt from it (after `prompt`, if any) and checks the minimum fields of its type (get_shot_guide). | |
| aspect | No | Aspect ratio of the image: 3:4 for Instagram/TikTok/Pinterest feed posts and carousels, 9:16 for stories and reels, 1:1 for X/LinkedIn/Facebook, 16:9 for landscape. Omit to let the model infer it from the prompt. | |
| prompt | No | What to draw, in detail: subject, style, composition, colours, aspect. Vague prompts give generic images. Optional with `shot`. | |
| confirm | No | true ONLY after the user said yes to the quote (what it does and the credits). Without it nothing runs and nothing is charged. | |
| speaker | No | Whether the person or character this workspace speaks as appears in the image (their reference images are attached): `include` when they are in the scene even if the prompt does not read like a photo, `exclude` when they are not (a product, a place, a quote card), `auto` (default) to infer it. No effect for a brand. | |
| characters | No | Optional. Other people or characters of this workspace who appear in the image, by name or id (list_characters): their reference photos are attached so each one looks like themselves. Any of them named in the prompt is added on its own. Up to 3 besides the person or character the workspace speaks as. | |
| workspaceId | No | Workspace to work on (an id from list_workspaces). Not needed when this connection is tied to one workspace, or when you pass an account: the account's workspace is used. | |
| baseImageUrl | No | Public https URL of an image to edit/vary instead of creating one from scratch. | |
| reservationId | No | Optional. A credit reservation (from an approved production) to pay this image from, instead of the monthly pool. | |
| idempotencyKey | No | Optional. A unique id for this action (16-128 chars: letters, digits, _ : . -). If you are unsure whether a call went through (timeout, network error), repeat it with the SAME idempotencyKey and the same arguments: you get the original result and nothing is done twice. | |
| productImageUrls | No | Optional. Up to 3 public https URLs of photos of a real product that must appear exactly as it is (same packaging, label, logo, colours): a review, a UGC-style shot, someone holding or using it. They are attached as references, so the image costs the same as one with references. Upload local files first with upload_media. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Durable public URL of the generated image. | |
| promptTip | No | ||
| quotaUsed | No | ||
| quotaLimit | No | ||
| confirmToken | No | ||
| promptWarnings | No | What the server checked and found missing (warnings: it still generated). needs_customer_fact = ask the person before the next one. | |
| estimatedCredits | No | ||
| needsConfirmation | No | true = this is only the quote: nothing was done or charged. |