API reference and CLI guide for Google Gemini 3 Pro Image generation.

Install

mkdir -p .claude/skills/gemini-api && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/5115" && unzip -o skill.zip -d .claude/skills/gemini-api && rm skill.zip

Installs to .claude/skills/gemini-api

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Google Gemini 3 Pro Image API reference. Covers text-to-image, editing, reference images, aspect ratios, and error handling.
124 charsno explicit “when” trigger
Beginner

Key capabilities

  • Configures Gemini Image API requests
  • Sets aspect ratios for specific platforms
  • Handles API retries and error codes
  • Applies image style templates

How it works

It acts as a configuration interface for the Gemini Image API, translating CLI flags into valid API parameters and managing network retries.

Inputs & outputs

You give it
Prompt and API configuration flags
You get back
Image generation response or error log

When to use gemini-api

  • Generate image from text
  • Edit existing images via API
  • Configure image aspect ratios
  • Handle API error codes

About this skill

plugin: nanobanana updated: 2026-01-20

Gemini Image API Reference

Quick Start

# Set API key
export GEMINI_API_KEY="your-key"

# Generate image
uv run python main.py output.png "A minimal 3D cube"

API Key Setup

  1. Visit: https://makersuite.google.com/app/apikey
  2. Create new API key
  3. Set environment variable:
    export GEMINI_API_KEY="your-api-key"
    

Supported Models

ModelResolutionBest For
gemini-3-pro-image-previewUp to 4KHigh quality
gemini-2.5-flash-imageUp to 1KQuick iterations

Aspect Ratios

RatioUse Case
1:1Social media, icons
3:4Portrait photos
4:3Traditional photos
4:5Instagram portrait
5:4Landscape photos
9:16Mobile, stories
16:9YouTube, desktop
21:9Cinematic, ultrawide

CLI Flags

FlagDescriptionExample
--styleApply style template--style styles/glass.md
--editEdit existing image--edit photo.jpg
--refReference image--ref style.png
--aspectAspect ratio--aspect 16:9
--modelModel ID--model gemini-2.5-flash-image
--max-retriesRetry attempts--max-retries 5

Error Codes

CodeMeaningRecovery
SUCCESSOperation completedN/A
API_KEY_MISSINGGEMINI_API_KEY not setExport the variable
FILE_NOT_FOUNDReferenced file missingCheck path
INVALID_INPUTBad prompt or argumentFix input
RATE_LIMITEDToo many requestsWait, uses auto-retry
NETWORK_ERRORConnection failedCheck network, auto-retry
API_ERRORGemini API errorCheck logs
CONTENT_POLICYBlocked promptAdjust content
TIMEOUTRequest timed outRetry
PARTIAL_FAILURESome batch items failedCheck individual results

Retry Behavior

The script automatically retries on transient errors:

  • Rate limits (429)
  • Server errors (502, 503)
  • Connection timeouts
  • Network errors

Retry uses exponential backoff: 1s, 2s, 4s, 8s, etc. Maximum retries configurable with --max-retries (default: 3)

Best Practices

  1. Prompts: Be specific about style, lighting, composition
  2. Styles: Use markdown templates for consistent results
  3. References: Provide visual examples for style matching
  4. Batch: Generate variations to pick the best
  5. Iteration: Edit results to refine
  6. Retries: Increase --max-retries for unreliable connections

When not to use it

  • Video generation tasks
  • Real-time interactive image processing
  • Non-Gemini image editing models

Prerequisites

Gemini API key

Limitations

  • Strict reliance on Gemini 3 Pro model availability
  • Limited by current Gemini API output resolution caps
  • Does not provide local image processing

How it compares

It provides a centralized reference for platform-specific aspect ratios and standardizes error recovery behavior.

Compared to similar skills

gemini-api side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
gemini-api (this skill)16moReviewBeginner
ideogram-hello-world125dCautionBeginner
fastapi-templates5202moNo flagsIntermediate
mcp-builder1363moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

More by MadAppGang

View all by MadAppGang

claudish-usage

MadAppGang

CRITICAL - Guide for using Claudish CLI ONLY through sub-agents to run Claude Code with any AI model (OpenRouter, Gemini, OpenAI, local models). NEVER run Claudish directly in main context unless user explicitly requests it. Use when user mentions external AI models, Claudish, OpenRouter, Gemini, OpenAI, Ollama, or alternative models. Includes mandatory sub-agent delegation patterns, agent selection guide, file-based instructions, and strict rules to prevent context window pollution.

442

golang-performance

MadAppGang

Use when profiling Go applications (pprof), running benchmarks, optimizing memory/CPU usage, or debugging performance bottlenecks in production Go code.

47

golang

MadAppGang

Use when building Go backend services, implementing goroutines/channels, handling errors idiomatically, writing tests with testify, or following Go best practices for APIs/CLI tools.

313

schemas

MadAppGang

YAML frontmatter schemas for Claude Code agents and commands. Use when creating or validating agent/command files.

34

external-model-selection

MadAppGang

Choose optimal external AI models for code analysis, bug investigation, and architectural decisions. Use when consulting multiple LLMs via claudish, comparing model perspectives, or investigating complex Go/LSP/transpiler issues. Provides empirically validated model rankings (91/100 for MiniMax M2, 83/100 for Grok Code Fast) and proven consultation strategies based on real-world testing.

218

adr-documentation

MadAppGang

Architecture Decision Records (ADR) documentation practice. Use when documenting architectural decisions, recording technical trade-offs, creating decision logs, or establishing architectural patterns. Trigger keywords - "ADR", "architecture decision", "decision record", "trade-offs", "architectural decision", "decision log".

12

You might also like

ideogram-hello-world

jeremylongshore

Create a minimal working Ideogram example. Use when starting a new Ideogram integration, testing your setup, or learning basic Ideogram API patterns. Trigger with phrases like "ideogram hello world", "ideogram example", "ideogram quick start", "simple ideogram code".

10

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

5201,086

mcp-builder

anthropics

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

136215

fastapi-pro

sickn33

Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2. Master microservices, WebSockets, and modern Python async patterns. Use PROACTIVELY for FastAPI development, async optimization, or API architecture.

79181

telegram-bot-builder

davila7

Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.

106130

stripe-integration

wshobson

Implement Stripe payment processing for robust, PCI-compliant payment flows including checkout, subscriptions, and webhooks. Use when integrating Stripe payments, building subscription systems, or implementing secure checkout flows.

48165

Search skills

Search the agent skills registry