← Back to Skills Marketplace
jasonboi

Banana Api

by jasonboi · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
301
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install banana-api
Description
Generate and edit images using Nano Banana (Gemini-3-Pro-Image-Preview) API. Handles automatic base64 encoding/decoding, image compression, and Discord integ...
README (SKILL.md)

Banana API - Nano Banana Image Generation

Streamlined client for Nano Banana's Gemini-3-Pro-Image-Preview API. Automatically handles the annoying base64 workflow, image compression, and Discord sending.

What This Skill Solves

The Problem with Gemini API:

  • Input/output is only base64 (no URLs)
  • Large images = massive base64 strings (2MB+)
  • Manual encoding/decoding is painful
  • No built-in Discord integration

This Skill Provides:

  • ✅ Automatic image compression (512px default)
  • ✅ Transparent base64 encoding/decoding
  • ✅ Smart filename generation
  • ✅ Auto-send to Discord
  • ✅ Both text-to-image and image-to-image editing

Quick Start

Text-to-Image

python3 scripts/banana_gen.py "a cute fluffy cat on a window sill"

Image Editing

python3 scripts/banana_gen.py "transform into rock concert scene with leather jacket" \
  --image /path/to/photo.png

With Discord Auto-Send

python3 scripts/banana_gen.py "cyberpunk cityscape at night" \
  --channel-id 1478746465328435412

Configuration

API Key (Choose One)

Option 1: Config File (Recommended - Persistent)

# Interactive setup (stores in ~/.openclaw/workspace/config/banana-api.json)
python3 scripts/banana_gen.py --setup

# Or manually create config file
echo '{"api_key": "sk-your-key-here"}' > ~/.openclaw/workspace/config/banana-api.json

Option 2: Environment Variable

export BANANA_API_KEY="sk-xxxxxxxx"

Option 3: Command Line (One-time)

python3 scripts/banana_gen.py "prompt" --api-key "sk-xxx"

Output Location

Generated images are saved to:

~/.openclaw/workspace/photos/{description}-{timestamp}.png

View Current Config

python3 scripts/banana_gen.py --show-config

Usage Examples

Basic Generation

# Simple prompt
python3 scripts/banana_gen.py "sunset over mountains"

# With aspect ratio hint
python3 scripts/banana_gen.py "portrait of a warrior" --ratio 2:3

# Custom filename tag
python3 scripts/banana_gen.py "cat playing piano" --name cat-piano

Image Editing (Inpainting/Restyle)

# Change setting/outfit
python3 scripts/banana_gen.py "wearing a red dress at the beach" \
  --image ~/photos/portrait.png

# Change background
python3 scripts/banana_gen.py "standing in front of Tokyo skyline at night" \
  --image ~/photos/selfie.png \
  --name tokyo-night

# Artistic transformation
python3 scripts/banana_gen.py "oil painting style, renaissance portrait" \
  --image ~/photos/photo.jpg

Discord Integration

# Auto-send to channel
python3 scripts/banana_gen.py "dragon breathing fire" \
  --channel-id 1478746465328435412

# Auto-send with custom name
python3 scripts/banana_gen.py "cute anime girl with blue hair" \
  --channel-id 1478746465328435412 \
  --name anime-girl

# Save locally only (no Discord)
python3 scripts/banana_gen.py "prompt" --no-send

Advanced Options

# Custom output path
python3 scripts/banana_gen.py "prompt" --output ~/Desktop/my-image.png

# Different model (if available)
python3 scripts/banana_gen.py "prompt" --model gemini-2.5-flash-image

# Full example
python3 scripts/banana_gen.py "wizard casting spell in ancient library" \
  --image ~/photos/me.png \
  --ratio 2:3 \
  --name wizard-me \
  --channel-id 1478746465328435412

Best Practices

Image Editing Tips

  1. Compress input automatically: Script resizes to 512px by default
  2. Be specific: "wearing black leather jacket" > "cool outfit"
  3. Preserve identity: Face features are usually maintained well
  4. Aspect ratio: Add to prompt, but actual output depends on model

Prompt Engineering

  • Style keywords: "oil painting", "anime style", "photorealistic"
  • Lighting: "dramatic lighting", "soft golden hour", "neon lights"
  • Quality: "high quality", "detailed", "8k"

File Naming

The script auto-generates filenames:

  • Format: banana-{description}-{timestamp}.png
  • Description is cleaned from prompt (first 30 chars)
  • Use --name for custom suffix: banana-{name}-{timestamp}.png

Technical Details

Image Processing Pipeline

Input Image → Resize to 512px → JPEG compress (85%) → Base64 encode → API
                                              ↓
Output ← Base64 decode ← PNG save ← Response

API Flow

1. Compress input image (if provided)
2. Build Gemini API request with base64 inlineData
3. POST to /v1beta/models/{model}:generateContent
4. Extract image from response.candidates[0].content.parts
5. Decode base64 and save to workspace/photos/
6. Send to Discord (if channel-id provided)

Error Handling

  • Input file not found → Clear error message
  • API key missing → Prompt to set BANANA_API_KEY
  • Image too large → Automatic compression
  • API error → JSON error details printed
  • Discord send fail → Warning but continues

Limitations

  • Output always base64: Cannot be changed (Gemini limitation)
  • No URL input: Must download images locally first
  • Single image output: Gemini returns one image per request
  • Response time: 10-60 seconds depending on complexity

When to Use This vs Other Tools

Use Case Recommended Tool
Quick Gemini image banana-api
ComfyUI workflows comfyui-gen
DALL-E / OpenAI Use their direct API
Stable Diffusion comfyui-gen

Troubleshooting

Problem Solution
"PIL not available" Install: pip install Pillow
"API key required" Run --setup to save key, or set BANANA_API_KEY env var
"No image data found" Model may have returned text only; try different prompt
Large output files Normal for high-res images (500KB-2MB)
Discord send fails Check channel ID and openclaw CLI access

Configuration Priority

API Key is loaded in this order (first found wins):

  1. --api-key command line argument
  2. BANANA_API_KEY environment variable
  3. ~/.openclaw/workspace/config/banana-api.json config file
  4. ❌ Error if none found

To persist the API key for future use:

python3 scripts/banana_gen.py --setup

Script Reference

python3 scripts/banana_gen.py [PROMPT] [OPTIONS]

Options:
  --image, -i PATH       Input image for editing
  --ratio, -r RATIO      Aspect ratio hint (e.g., 2:3, 16:9)
  --model, -m MODEL      Model name (default: gemini-3-pro-image-preview)
  --output, -o PATH      Custom output path
  --name, -n NAME        Filename suffix/tag
  --channel-id, -c ID    Discord channel ID to auto-send
  --no-send              Skip Discord sending
  --api-key, -k KEY      API key (or set BANANA_API_KEY)
  --setup                Interactive setup to save API key
  --show-config          Display current configuration

Integration with Workflows

As Part of a Larger Pipeline

# Generate + send + reference
IMAGE=$(python3 scripts/banana_gen.py "cute cat" --name kitty | grep "OUTPUT_PATH:" | cut -d: -f2-)
echo "Generated: $IMAGE"

From Another Skill

Call the script directly:

import subprocess
result = subprocess.run([
    'python3', 'scripts/banana_gen.py',
    'prompt here',
    '--image', input_path,
    '--channel-id', channel_id
], capture_output=True, text=True)
Usage Guidance
This skill appears to be a working Gemini-style image wrapper, but there are red flags you should consider before installing: - The script calls a non-obvious API host (https://nn.147ai.com). Verify that this endpoint is the official service you expect (Nano Banana/Gemini) — if you don't recognize the host, do not supply your API key. - The skill stores/reads an API key in ~/.openclaw/workspace/config/banana-api.json and also accepts BANANA_API_KEY via env/CLI. If you use it, understand that your key will be written to disk (and a temporary JSON file containing the key can briefly exist during curl fallback). - The code invokes a local 'openclaw' CLI to send images to Discord but the registry metadata does not list that binary as required. If you plan to use Discord sending, ensure the 'openclaw' tool is legitimate and properly configured. - The registry metadata and SKILL.md/code disagree about required env vars and binaries — treat that as a signal to audit the code before trusting it. Actions you can take: - Inspect the full script yourself (it's included) and confirm the API_BASE_URL and behavior are acceptable. - If you decide to run it, prefer providing the API key via a one-time CLI flag rather than persisting it, or secure the config file permissions after saving. - Consider testing with a throwaway API key or in an isolated environment first. If you want, I can help: (1) cross-check the host (nn.147ai.com) for reputation, (2) walk through the script line-by-line and point out exact spots that handle secrets/temp files, or (3) suggest a minimal hardening checklist before using this skill.
Capability Analysis
Type: OpenClaw Skill Name: banana-api Version: 1.0.0 The banana-api skill is a legitimate utility designed to interface with the Nano Banana (Gemini) image generation API. The script `scripts/banana_gen.py` implements the features described in `SKILL.md`, including image compression using PIL, base64 encoding/decoding, and Discord integration via the `openclaw` CLI. It handles API keys securely through environment variables or a local config file and includes input sanitization for file naming to prevent path traversal. No malicious behaviors, obfuscation, or unauthorized data exfiltration were detected.
Capability Assessment
Purpose & Capability
The SKILL.md and code describe a Nano Banana/Gemini image client, which matches the name. However the bundled code points to an undocumented third-party host (API_BASE_URL = https://nn.147ai.com) instead of an official Gemini endpoint; the metadata declares no required env vars/binaries but the code and README expect BANANA_API_KEY and an 'openclaw' CLI for Discord sending. These mismatches are unexplained and reduce trust.
Instruction Scope
Instructions and the script read/write configuration and image files under ~/.openclaw/workspace/, accept API keys via env/CLI/config, and will invoke a local 'openclaw' CLI to send images to Discord. The runtime steps are otherwise scoped to image compression/base64 and API calls, but use of a local CLI and writing a config file (including API keys) are notable behaviours that are not declared in the registry metadata.
Install Mechanism
No install spec (instruction-only) and the code is included in the package. There are no downloads from third-party URLs or archive extraction steps in the install metadata. This is lower risk than an external-install script, although embedded code will run on the user's machine.
Credentials
The registry lists no required env vars, but SKILL.md and the script expect BANANA_API_KEY (or config). The script may create or read ~/.openclaw/workspace/config/banana-api.json containing the API key. The API host is a non-obvious third-party domain (nn.147ai.com) — requiring an API key for that host is proportionate to contacting it, but the skill does not justify or document that host, which could be used to collect keys or image data.
Persistence & Privilege
The skill does not request always:true and does not modify other skills. It writes its own config and saves outputs under ~/.openclaw/workspace/, which is consistent with its stated purpose.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install banana-api
  3. After installation, invoke the skill by name or use /banana-api
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of Banana API skill for streamlined Gemini image generation and editing. - Provides a client for Nano Banana's Gemini-3-Pro-Image-Preview API, with automatic base64 handling and image compression. - Supports both text-to-image generation and image editing workflows. - Integrates optional Discord auto-sending for quick sharing. - Simplifies API key configuration (env, CLI, or config file) and smart file management. - Offers detailed usage examples, best practices, and troubleshooting steps.
Metadata
Slug banana-api
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Banana Api?

Generate and edit images using Nano Banana (Gemini-3-Pro-Image-Preview) API. Handles automatic base64 encoding/decoding, image compression, and Discord integ... It is an AI Agent Skill for Claude Code / OpenClaw, with 301 downloads so far.

How do I install Banana Api?

Run "/install banana-api" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Banana Api free?

Yes, Banana Api is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Banana Api support?

Banana Api is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Banana Api?

It is built and maintained by jasonboi (@jasonboi); the current version is v1.0.0.

💬 Comments