Browse the docs
Developers / Docs / AI tools
Generate images
Generates 1-4 images with an AI Studio model (Nano Banana, Seedream, Flux, Imagen). Spends credits: about 6 credits for one 1-megapixel Nano Banana image; bigger sizes, more images and premium models cost more (list_models has every price). Run with dryRun: true (or estimate_cost) first and confirm the cost. Returns a job; get_job with waitSeconds returns the image URLs, usually within a minute.
Paste it into any AI assistant. The shortcuts open with the prompt typed in; nothing is sent until you press enter.
At a glance
- REST
POST https://api.clippie.ai/v1/ai/images
- MCP tool
generate_image
- Scope
create
- Cost
- Spends credits or minutes, at the same prices as the app. Send
"dryRun": true(or call estimate_cost) first to see the exact cost without spending anything.
- Spends credits or minutes, at the same prices as the app. Send
- Limit bucket
ai_image(see Rate limits)
Parameters
model- In:
- body
- Type:
- string
- Required:
- No
- Default:
"nano-banana"- Description:
- Image model id from list_models (type image). One of
flux-dev,flux-2-dev,flux-2-pro,flux-2-flex,flux-2-max,imagen-4,imagen-4-fast,imagen-4-ultra,seedream-4.0,seedream-4.5,seedream-5.0-lite,seedream-5.0-flash,nano-banana,nano-banana-2.1,nano-banana-pro.
prompt- In:
- body
- Type:
- string
- Required:
- Yes
- Description:
- What to draw. 1-4000 chars.
aspectRatio- In:
- body
- Type:
- string
- Required:
- No
- Default:
"1:1"- Description:
- Image shape. Not every model takes every ratio (list_models). One of
1:1,16:9,9:16,4:3,3:4,21:9,9:21,3:2,2:3.
resolution- In:
- body
- Type:
- string
- Required:
- No
- Default:
"1"- Description:
- Megapixels. Not every model takes every size. One of
0.5,1,2,4.
count- In:
- body
- Type:
- integer
- Required:
- No
- Default:
1- Description:
- How many images, 1-4. Each is charged. 1-4.
referenceImages- In:
- body
- Type:
- array of string
- Required:
- No
- Description:
- Images to work from, for the models that take them (maxReferenceImages in list_models). Up to 14 items.
dryRun- In:
- body
- Type:
- boolean
- Required:
- No
- Description:
- Check the request and return { estimate } (credits and minutes) without spending anything.
webhookUrl- In:
- body
- Type:
- string (URL)
- Required:
- No
- Description:
- https URL that receives job.completed / job.failed, signed with your webhook secret. Up to 2048 chars.
Idempotency-Key- In:
- header
- Type:
- string
- Required:
- No
- Description:
- Retry-safe key: a retry with the same key and body within 24 hours returns the first job instead of starting (and charging) again. The same key with a different body is a 409. MCP clients pass it as the idempotencyKey argument. 1-255 chars. MCP:
idempotencyKey.
Example
# 1. Dry run: the exact cost, nothing is spent.
curl https://api.clippie.ai/v1/ai/images \
-H "Authorization: Bearer $CLIPPIE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana",
"prompt": "A red fox in a snowy forest at golden hour",
"aspectRatio": "9:16",
"dryRun": true
}'
# => { "dryRun": true, "estimate": { "credits": ..., "minutes": { ... }, "wouldSucceed": true } }
# 2. The real call. Keep the key and send the same one if you retry, so it is never charged twice.
KEY=$(uuidgen)
curl https://api.clippie.ai/v1/ai/images \
-H "Authorization: Bearer $CLIPPIE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $KEY" \
-d '{
"model": "nano-banana",
"prompt": "A red fox in a snowy forest at golden hour",
"aspectRatio": "9:16"
}'
# => 202 { "job": { "id": "job_...", "status": "queued", ... } }import { randomUUID } from 'node:crypto';
const auth = { Authorization: `Bearer ${process.env.CLIPPIE_API_KEY}` };
const input = {
"model": "nano-banana",
"prompt": "A red fox in a snowy forest at golden hour",
"aspectRatio": "9:16"
};
async function call(body, headers = {}) {
const res = await fetch('https://api.clippie.ai/v1/ai/images', {
method: 'POST',
headers: { ...auth, 'Content-Type': 'application/json', ...headers },
body: JSON.stringify(body),
});
const json = await res.json();
if (!res.ok) throw new Error(`${json.error.type}: ${json.error.message}`);
return json;
}
// 1. Dry run: the exact cost, nothing is spent. Confirm it before going on.
const { estimate } = await call({ ...input, dryRun: true });
console.log(estimate); // { credits, minutes, wouldSucceed, reason }
// 2. Create. Keep the key and reuse it on retries, so a retry never charges twice.
let { job } = await call(input, { 'Idempotency-Key': randomUUID() });
// 3. Wait. Each call holds for up to 30 seconds until the job changes.
while (!['completed', 'failed', 'canceled'].includes(job.status)) {
const res = await fetch(`https://api.clippie.ai/v1/jobs/${job.id}?wait=30`, { headers: auth });
({ job } = await res.json());
}
console.log(job.status, job.output);Response
202 { job }: the job, straight away. Wait for it with Get job (?wait=30) or a webhookUrl; see Jobs and waiting. With "dryRun": true the answer is 200 { dryRun: true, estimate } and nothing is started.
{
"job": {
"id": "job_abc123",
"object": "job",
"kind": "generate_image",
"status": "queued",
"step": null,
"progress": null,
"input": {
"prompt": "The lost library of Alexandria"
},
"output": null,
"cost": {
"credits": 0,
"minutes": {
"voiceover": 1,
"captions": 1,
"export": 1
}
},
"error": null,
"source": "api",
"webhookUrl": null,
"createdAt": "2026-10-24T12:00:00.000Z",
"startedAt": null,
"completedAt": null
}
}{
"dryRun": true,
"estimate": {
"credits": 0,
"minutes": {
"voiceover": 0,
"captions": 0,
"export": 0
},
"wouldSucceed": true
}
}From an MCP client
Your AI calls generate_image with the same fields as JSON arguments, plus idempotencyKey instead of the header. See MCP server to connect one.
{
"name": "generate_image",
"arguments": {
"model": "nano-banana",
"prompt": "A red fox in a snowy forest at golden hour",
"aspectRatio": "9:16",
"idempotencyKey": "a-unique-key-per-thing-you-make"
}
}