/v1/tools/generate_imagepricedGenerate an image
Creates an image from a description (text to image), upright, square, portrait or wide, as a JPEG. Reference images, optional, keep a person, a product, a place or a look from images you give (image to image).
Takes prompt (text), references (a list of files, up to 3, optional). Returns image (the image, a JPEG).
$0.07 to $0.27 an image: Recommended $0.07, Nano Banana 2 $0.14, Nano Banana Pro $0.27, GPT Image 2 $0.11. Recommended picks by what the words ask: for words in the picture Nano Banana Pro; for a drawn style Recommended; for many people moving GPT Image 2; for people and faces GPT Image 2; for a product shot Recommended; for a landscape Recommended.
Fields
| Field | Type | Default | What it is |
|---|---|---|---|
references | array | None | A list: A file_id from create_upload, accepting image/jpeg, image/png, image/webp, up to 20 MB. Get one with create_upload. Or the job_id of a finished job that made a file of this kind: that file is used. Pass the job_id rather than retyping its result. All of them are one job. |
prompt | string | Required | What the image shows and how it looks, in a sentence or a few; any language. It has no words in it unless you ask for them. |
model | one of | recommended | The model that draws it. Recommended is Scrub's pick for what the words ask, the best scored for the price; the others by name, each at its own price. Recommended may run Nano Banana Pro at $0.27 an image or GPT Image 2 at $0.11 an image, by what the words ask. The words choose the model, and so the price: a quote holds for the exact words it priced.recommendedNano Banana 2Nano Banana ProGPT Image 2 |
aspect_ratio | one of | 1:1 | Its aspect ratio, width to height.9:161:14:516:9 |
style | one of | none | A style it is drawn in, the same for every picture of a set so they belong together. Papercraft is layered cut-paper shapes in soft greens and ochre. None draws it as the prompt says.nonepapercraft |
goes_with | string | | For a video, what goes with the line the prompt says, such as what the video is about. Scrub picks what to show, never words. Empty, it draws the prompt. |
Call it
Request
curl -X POST https://app.scrub.app/v1/tools/generate_image \
-H "Authorization: Bearer $SCRUB_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"…"}'Answer
{
"ok": true,
"result": {
"job_id": "job_…",
"status": "running",
"price_usd": "$…"
}
}It starts at once and answers running. Ask job_status with the job_id for its result. quote gives its price first, free.
Every call can also answer an error: what comes back. Try it with your key from Account.