IMA Nano Banana Image Generator

Nano Banana-only image generation on IMA Open API. Supports text_to_image and image_to_image with gemini-3.1-flash-image (budget) and gemini-3-pro-image (premium). Deterministic size/ratio mapping, 512/1K/2K/4K resolution. Requires IMA_API_KEY.

3,891 stars

Best use case

IMA Nano Banana Image Generator is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Nano Banana-only image generation on IMA Open API. Supports text_to_image and image_to_image with gemini-3.1-flash-image (budget) and gemini-3-pro-image (premium). Deterministic size/ratio mapping, 512/1K/2K/4K resolution. Requires IMA_API_KEY.

Teams using IMA Nano Banana Image Generator should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/ai-nano-banana-ima/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/allenfancy-gan/ai-nano-banana-ima/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/ai-nano-banana-ima/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How IMA Nano Banana Image Generator Compares

Feature / AgentIMA Nano Banana Image GeneratorStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Nano Banana-only image generation on IMA Open API. Supports text_to_image and image_to_image with gemini-3.1-flash-image (budget) and gemini-3-pro-image (premium). Deterministic size/ratio mapping, 512/1K/2K/4K resolution. Requires IMA_API_KEY.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# IMA Nano Banana Image Generator

## Scope

This skill is for IMA Open API image generation with strict Nano Banana scope:

- Task types: `text_to_image`, `image_to_image`
- Allowed model IDs only:
  - `gemini-3.1-flash-image`
  - `gemini-3-pro-image`
- Always execute through bundled script: `scripts/ima_image_create.py`

Out of scope:

- Video or non-image tasks
- Non-IMA providers
- Non-Nano-Banana model families (for example SeeDream, Midjourney)
- Handcrafted API requests (do not bypass script)

## Quick Runbook (Authoritative)

If any later section conflicts with this runbook, follow this runbook.

1. Confirm request is in scope (IMA + Nano Banana image generation/editing).
2. Resolve `task_type`:
   - No reference image -> `text_to_image`
   - With reference image/edit request -> `image_to_image`
3. Resolve model:
   - Premium/best quality -> `gemini-3-pro-image`
   - Cheapest/budget -> `gemini-3.1-flash-image` + `--size 512`
   - Otherwise -> `gemini-3.1-flash-image`
4. Resolve parameters:
   - Size -> `--size` (`512`,`1K`,`2K`,`4K`)
   - Ratio -> `--extra-params` JSON (for example `{"aspect_ratio":"16:9"}`)
5. If user asks `8K`, explain unsupported and downgrade to `4K`.
6. For `image_to_image`, require at least one input image.
7. For remote image URLs:
   - Prefer `https://`
   - If user gives `http://`, ask for `https://` URL or local file
8. Endpoint policy is fixed:
    - Main API: `https://api.imastudio.com`
    - Upload API: `https://imapi.liveme.com`
    - No CLI/env override for these domains in this skill.
9. Run only `scripts/ima_image_create.py`; do not call API endpoints manually.
10. Use messaging Step 0-4 flow. If `message` tool is unavailable, use normal replies with same content.
11. On success, prefer rendered media output; if media unsupported, return URL + model + elapsed/credit summary.

## FAQ (For Ambiguous Inputs)

### Q1) How to map intent to `task_type`?

| Situation | `task_type` |
|---|---|
| Prompt-only generation | `text_to_image` |
| Edit/transform from URL/local image | `image_to_image` |

### Q2) How to map user wording to model?

| User wording | model_id | Extra rule |
|---|---|---|
| 默认 / 平衡 / Banana2 / NB2 | `gemini-3.1-flash-image` | none |
| 最便宜 / budget / cheap | `gemini-3.1-flash-image` | force `--size 512` |
| 最好 / 高质量 / Pro / premium | `gemini-3-pro-image` | none |

### Q3) How to set ratio and size?

| Target | Setting |
|---|---|
| Size (`512`,`1K`,`2K`,`4K`) | `--size` |
| Aspect ratio (`1:1`,`16:9`,`9:16`,`4:3`,`3:4`) | `--extra-params '{"aspect_ratio":"16:9"}'` |

`8K` is not supported; downgrade to `4K`.

### Q4) What placeholder substitutions are required?

- `{baseDir}` -> current skill root path
- `{user_id}` -> real user/session id string

## User-Facing Messaging Protocol

### Step 0: Acknowledge immediately

Use a short warm reply in user language, for example:

- `收到,马上开始生成。`
- `OK, generating now.`

### Step 1: Start notification

```text
🎨 开始生成图片,请稍候…
• 模型:[Model Name]
• 预计耗时:[X~Y 秒]
• 消耗积分:[N pts]
```

### Step 2: Progress notification

| Model | Typical Duration | Poll Interval | Push Interval |
|---|---:|---:|---:|
| `gemini-3.1-flash-image` | 20–40s | 5s | 15s |
| `gemini-3-pro-image` | 60–120s | 5s | 30s |

Progress format:

```text
⏳ 正在生成中… [P]%
已等待 [elapsed]s,预计最长 [max]s
```

`P = min(95, floor(elapsed / max * 100))` until success.

### Step 3: Success notification

```text
✅ 图片生成成功!
• 模型:[Model Name]
• 耗时:预计 [X~Y]s,实际 [actual]s
• 消耗积分:[N pts]
🔗 原始链接:{image_url}
```

Prefer media attachment; fallback to plain text message if media is not supported.

### Step 4: Failure notification

```text
❌ 图片生成失败
• 原因:[natural language reason]
• 建议:[retry strategy or model switch]
需要我帮你重试吗?
```

After Step 4, stop. Do not send duplicate completion messages.

## Command Templates (Minimal)

```bash
# 1) List models
python3 {baseDir}/scripts/ima_image_create.py \
  --api-key "$IMA_API_KEY" \
  --task-type text_to_image \
  --list-models

# 2) text_to_image (default/premium/budget/ratio via params)
python3 {baseDir}/scripts/ima_image_create.py \
  --api-key "$IMA_API_KEY" \
  --task-type text_to_image \
  --model-id gemini-3.1-flash-image \
  --prompt "a cute puppy on grass" \
  --size 1K \
  --extra-params '{"aspect_ratio":"1:1"}' \
  --user-id {user_id} \
  --output-json
# Notes:
# - Premium: set --model-id gemini-3-pro-image
# - Cheapest: keep flash model and set --size 512

# 3) image_to_image with remote URL input
python3 {baseDir}/scripts/ima_image_create.py \
  --api-key "$IMA_API_KEY" \
  --task-type image_to_image \
  --model-id gemini-3.1-flash-image \
  --prompt "turn into oil painting" \
  --input-images "https://example.com/photo.jpg" \
  --user-id {user_id} \
  --output-json

# 4) image_to_image with local file input
python3 {baseDir}/scripts/ima_image_create.py \
  --api-key "$IMA_API_KEY" \
  --task-type image_to_image \
  --model-id gemini-3.1-flash-image \
  --prompt "turn into oil painting" \
  --input-images "./local-photo.jpg" \
  --user-id {user_id} \
  --output-json
```

## Security And Data Handling

### Network domains

| Domain | Usage | Trigger |
|---|---|---|
| `api.imastudio.com` | Product list, create task, poll detail | All generation tasks |
| `imapi.liveme.com` | Upload token + file upload | `image_to_image` with local files |

**Why two domains?**
- `api.imastudio.com`: IMA's image generation API (handles task orchestration)
- `imapi.liveme.com`: IMA's media storage infrastructure (handles large file uploads)
- Both services are **owned and operated by IMA Studio**

### Credential flow

| Credential | Where Sent | Why |
|---|---|---|
| `IMA_API_KEY` | `api.imastudio.com` | Open API auth (`Authorization: Bearer ...`) |
| `IMA_API_KEY` | `imapi.liveme.com` | Upload-token auth for local image uploads |

Notes:
- Upload signing uses shared built-in credentials (same as ima-image-ai skill).
- No API key is sent to presigned upload hosts during binary upload.
- API domains are fixed in script and not user-overridable.
- Never print or persist raw API keys in chat or repo files.

### Local persistence

| Path | Purpose | Retention |
|---|---|---|
| `~/.openclaw/memory/ima_prefs.json` | Per-user model preference cache | Until removed |
| `~/.openclaw/logs/ima_skills/` | Operational logs | Auto-cleaned after 7 days |

## Error Handling Playbook

| Error pattern | User-facing explanation | Suggested action |
|---|---|---|
| `401` / unauthorized | API key invalid or unauthorized | Regenerate key: https://www.imaclaw.ai/imaclaw/apikey |
| `4008` / insufficient points | Credits are insufficient | Recharge: https://www.imaclaw.ai/imaclaw/subscription |
| `6009` / `6010` / invalid attribute | Parameter-rule mismatch | Retry with defaults or lower complexity |
| timeout | Task took too long | Retry with faster/lower-cost setup |
| network / rate limit | Temporary connectivity/limit issue | Wait and retry |

Fallback messages:

- Chinese: `图片生成遇到问题,请稍后重试或换个模型试试。`
- English: `Image generation encountered an issue, please retry or switch model.`

## Quick Defaults

1. Default model: `gemini-3.1-flash-image`
2. Premium model: `gemini-3-pro-image`
3. Cheapest profile: flash model + `--size 512`
4. Max output: `4K`
5. Recommended ratios: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`

Related Skills

Invoice Generator

3891
from openclaw/skills

Creates professional invoices in markdown and HTML

Workflow & Productivity

Incident Postmortem Generator

3891
from openclaw/skills

Generate blameless incident postmortems from raw notes, Slack threads, or bullet points.

DevOps & Infrastructure

Partnership Agreement Generator

3891
from openclaw/skills

Generate comprehensive partnership agreements, joint venture frameworks, and strategic alliance documents for B2B relationships.

Legal Documents & Agreements

Employee Onboarding Generator

3891
from openclaw/skills

Build a structured 90-day onboarding plan for any role. Covers pre-boarding, Day 1, Week 1, 30/60/90-day milestones, buddy assignments, and success metrics.

Workflow & Productivity

Employee Handbook Generator

3891
from openclaw/skills

Build a complete, customized employee handbook for your company. Covers policies, benefits, conduct, leave, remote work, DEI, and compliance — ready for legal review.

Content & Documentation

IT Disaster Recovery Plan Generator

3891
from openclaw/skills

Build production-ready disaster recovery plans that actually get followed when things break.

DevOps & Infrastructure

Compliance Audit Generator

3891
from openclaw/skills

Run internal compliance audits against major frameworks without hiring a consultant.

Security

API Documentation Generator

3891
from openclaw/skills

Generate production-ready API documentation from endpoint descriptions. Outputs OpenAPI 3.0, markdown reference docs, and SDK quickstart guides.

Coding & Development

Annual Report Generator

3891
from openclaw/skills

Build a complete annual business report from raw data. Covers financial performance, operational metrics, strategic highlights, and forward-looking guidance.

Workflow & Productivity

daily-report-generator

3891
from openclaw/skills

Automatically generate daily/weekly work reports from git commits, calendar events, and task lists. Use when you need to quickly create professional work reports without manual effort.

Workflow & Productivity

hr-policy-generator

3891
from openclaw/skills

Comprehensive HR policy development covering attendance, time-off, overtime, remote work, and compliance. Generates structured policy documents, legal checklists, exception handling frameworks, and employee communication plans tailored to company size, work arrangement, and jurisdiction.

Workflow & Productivity

hr-policy-generator-cn

3891
from openclaw/skills

综合性 HR 政策设计工具,覆盖考勤、休假、加班、远程办公及合规要求。根据公司规模、办公模式、适用法律等输入,生成完整的政策文档、法律合规清单、例外处理机制及员工沟通方案。

Workflow & Productivity