Nano Banana 2.1
Generate or edit hosted images through POST /gemini/image/generate. The script fixes provider gemini and model gemini-nano-banana-2.1; do not pass routing overrides. This model uses the server's Interactions API path, so the older Nano Banana 2 config fields do not apply.
Workflow
- Require a user-provided image prompt or editing instruction. Prefer
scripts/generate_image.sh over ad hoc API requests.
- Map local references to repeatable
--image, remote HTTP(S) references to --image-url, and directories to --image-dir. Up to 14 PNG/JPEG/WebP references are supported in total, each under 50MB.
- Use
FREVANA_TOKEN, or a one-time --token override. Send it as Authorization: Bearer; ignore FREVANA_API_KEY. Missing credentials fail fast in non-interactive runs. Never print credentials.
- The script sends
x-frevana-agent-app-instance-id when FREVANA_AGENT_APP_INSTANCE_ID is present. It also supports X_FREVANA_AGENT_APP_INSTANCE_ID and the explicit --agent-app-instance-id override.
- Return a concise result and the primary hosted URL at
data[0].image_url (or generated_images[0].image_url for compatible responses). Preserve API fields and URLs; return full JSON when requested. --output saves the validated response JSON locally.
- If
--job-id is supplied, the response acknowledges an asynchronous job; it does not confirm successful generation. Follow the async instructions below before claiming completion.
Options
--prompt / --contents: required text, both map to backend prompt.
--thinking-level: minimal, medium, high; omitted by default so the backend chooses.
--aspect-ratio: 1:1, 1:4, 1:8, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16, 16:9, 21:9.
--image-size: 1K, 2K, 4K; omitted by default. Numeric pixel sizes are not supported.
--candidate-count / --n: 1 only, for both generation and editing.
--system-instruction: optional system prompt.
--seed: nonnegative integer.
--image, --image-url, --image-dir: repeatable reference inputs; directory discovery is recursive and sorted.
--job-id: client UUID for async execution and seven-day deduplication. Empty or malformed values are rejected before any network request.
--output: response JSON save path.
--token, --agent-app-instance-id: auth and attribution overrides.
Do not pass --temperature, --top-p, --top-k, --max-output-tokens, or --response-modality. Nano Banana 2.1 does not support those options on this endpoint. FREVANA_API_BASE_URL optionally overrides the API base (default https://ai-factory.frevana.com).
Examples
Text-to-image:
bash <skill-path>/scripts/generate_image.sh \
--prompt "A ceramic coffee cup on a sunlit wooden table" \
--thinking-level high --aspect-ratio 16:9 --image-size 2K \
--output ./out/nano-banana-2-1-result.json
Reference editing:
bash <skill-path>/scripts/generate_image.sh \
--prompt "Keep the product intact and replace the background with a sunny beach" \
--image ./refs/product.png --thinking-level medium --image-size 1K \
--output ./out/nano-banana-2-1-edit.json
Asynchronous jobs
Omit --job-id for synchronous generation. When async execution is requested, generate a UUID (for example with python3 -c 'import uuid; print(uuid.uuid4())') and keep it for recovery. Poll GET /gemini/image/jobs/{id} with the same credentials until status becomes completed, failed, or unknown. The returned job uses id, not job_id, and completed image output is under data. Extract data[0].image_url from the completed job. Report failed or unknown without automatically submitting a new paid generation. Job data is retained for seven days.
Response
Synchronous response example:
{
"created": 1791417600,
"data": [{"image_url": "https://static.frevana.com/images/example.png", "mime_type": "image/png"}],
"credits_consumed": 1
}
The script validates response structure and preserves the returned JSON values. An HTTP error, empty body, malformed JSON, or invalid image result is a failure; do not claim a hosted image was generated.
1---2name: nano-banana-2-13description: Use when the user asks for Nano Banana 2.1 or gemini-nano-banana-2.1 image generation or editing through Frevana, including reference images and thinking-level control.4metadata:5 source: https://skillmd.com/skills/finpeakinc/nano-banana-2-16---78# Nano Banana 2.1910Generate or edit hosted images through `POST /gemini/image/generate`. The script fixes provider `gemini` and model `gemini-nano-banana-2.1`; do not pass routing overrides. This model uses the server's Interactions API path, so the older Nano Banana 2 config fields do not apply.1112## Workflow13141. Require a user-provided image prompt or editing instruction. Prefer `scripts/generate_image.sh` over ad hoc API requests.152. Map local references to repeatable `--image`, remote HTTP(S) references to `--image-url`, and directories to `--image-dir`. Up to 14 PNG/JPEG/WebP references are supported in total, each under 50MB.163. Use `FREVANA_TOKEN`, or a one-time `--token` override. Send it as `Authorization: Bearer`; ignore `FREVANA_API_KEY`. Missing credentials fail fast in non-interactive runs. Never print credentials.174. The script sends `x-frevana-agent-app-instance-id` when `FREVANA_AGENT_APP_INSTANCE_ID` is present. It also supports `X_FREVANA_AGENT_APP_INSTANCE_ID` and the explicit `--agent-app-instance-id` override.185. Return a concise result and the primary hosted URL at `data[0].image_url` (or `generated_images[0].image_url` for compatible responses). Preserve API fields and URLs; return full JSON when requested. `--output` saves the validated response JSON locally.196. If `--job-id` is supplied, the response acknowledges an asynchronous job; it does not confirm successful generation. Follow the async instructions below before claiming completion.2021## Options2223- `--prompt` / `--contents`: required text, both map to backend `prompt`.24- `--thinking-level`: `minimal`, `medium`, `high`; omitted by default so the backend chooses.25- `--aspect-ratio`: `1:1`, `1:4`, `1:8`, `2:3`, `3:2`, `3:4`, `4:1`, `4:3`, `4:5`, `5:4`, `8:1`, `9:16`, `16:9`, `21:9`.26- `--image-size`: `1K`, `2K`, `4K`; omitted by default. Numeric pixel sizes are not supported.27- `--candidate-count` / `--n`: `1` only, for both generation and editing.28- `--system-instruction`: optional system prompt.29- `--seed`: nonnegative integer.30- `--image`, `--image-url`, `--image-dir`: repeatable reference inputs; directory discovery is recursive and sorted.31- `--job-id`: client UUID for async execution and seven-day deduplication. Empty or malformed values are rejected before any network request.32- `--output`: response JSON save path.33- `--token`, `--agent-app-instance-id`: auth and attribution overrides.3435Do not pass `--temperature`, `--top-p`, `--top-k`, `--max-output-tokens`, or `--response-modality`. Nano Banana 2.1 does not support those options on this endpoint. `FREVANA_API_BASE_URL` optionally overrides the API base (default `https://ai-factory.frevana.com`).3637## Examples3839Text-to-image:4041```bash42bash <skill-path>/scripts/generate_image.sh \43 --prompt "A ceramic coffee cup on a sunlit wooden table" \44 --thinking-level high --aspect-ratio 16:9 --image-size 2K \45 --output ./out/nano-banana-2-1-result.json46```4748Reference editing:4950```bash51bash <skill-path>/scripts/generate_image.sh \52 --prompt "Keep the product intact and replace the background with a sunny beach" \53 --image ./refs/product.png --thinking-level medium --image-size 1K \54 --output ./out/nano-banana-2-1-edit.json55```5657## Asynchronous jobs5859Omit `--job-id` for synchronous generation. When async execution is requested, generate a UUID (for example with `python3 -c 'import uuid; print(uuid.uuid4())'`) and keep it for recovery. Poll `GET /gemini/image/jobs/{id}` with the same credentials until `status` becomes `completed`, `failed`, or `unknown`. The returned job uses `id`, not `job_id`, and completed image output is under `data`. Extract `data[0].image_url` from the completed job. Report `failed` or `unknown` without automatically submitting a new paid generation. Job data is retained for seven days.6061## Response6263Synchronous response example:6465```json66{67 "created": 1791417600,68 "data": [{"image_url": "https://static.frevana.com/images/example.png", "mime_type": "image/png"}],69 "credits_consumed": 170}71```7273The script validates response structure and preserves the returned JSON values. An HTTP error, empty body, malformed JSON, or invalid image result is a failure; do not claim a hosted image was generated.