$npx -y skills add proyecto26/sherlock-ai-plugin --skill genimg-gemini-webImage generation skill using Gemini Web. Generates images from text prompts via Google Gemini. Also supports text generation. Use as the image generation backend for other skills like cover-image, xhs-images, article-illustrator.
| 1 | # Gemini Web Client |
| 2 | |
| 3 | Supports: |
| 4 | - Text generation |
| 5 | - Image generation (download + save) |
| 6 | - Reference image upload (attach images for vision tasks) |
| 7 | - Multi-turn conversations within the same executor instance (`keepSession`) |
| 8 | - Experimental video generation (`generateVideo`) — Gemini may return an async placeholder; download might require Gemini web UI |
| 9 | |
| 10 | ## Quick start |
| 11 | |
| 12 | ```bash |
| 13 | npx -y bun scripts/main.ts "Hello, Gemini" |
| 14 | npx -y bun scripts/main.ts --prompt "Explain quantum computing" |
| 15 | npx -y bun scripts/main.ts --prompt "A cute cat" --image cat.png |
| 16 | npx -y bun scripts/main.ts --promptfiles system.md content.md --image out.png |
| 17 | |
| 18 | # Multi-turn conversation (agent generates unique sessionId) |
| 19 | npx -y bun scripts/main.ts "Remember this: 42" --sessionId my-unique-id-123 |
| 20 | npx -y bun scripts/main.ts "What number?" --sessionId my-unique-id-123 |
| 21 | ``` |
| 22 | |
| 23 | ## Executor options (programmatic) |
| 24 | |
| 25 | This skill is typically consumed via `createGeminiWebExecutor(geminiOptions)` (see `scripts/executor.ts`). |
| 26 | |
| 27 | Key options in `GeminiWebOptions`: |
| 28 | - `referenceImages?: string | string[]` Upload local images as references (vision input). |
| 29 | - `keepSession?: boolean` Reuse Gemini `chatMetadata` to continue the same conversation across calls (required if you want reference images to persist across multiple messages). |
| 30 | - `generateVideo?: string` Generate a video and (best-effort) download to the given path. Gemini may return `video_gen_chip` (async); in that case you must open Gemini web UI to download the result. |
| 31 | |
| 32 | Notes: |
| 33 | - `generateVideo` cannot be combined with `generateImage` / `editImage`. |
| 34 | - When `keepSession=true` and `referenceImages` is set, reference images are uploaded once per executor instance. |
| 35 | |
| 36 | ## Commands |
| 37 | |
| 38 | ### Text generation |
| 39 | |
| 40 | ```bash |
| 41 | # Simple prompt (positional) |
| 42 | npx -y bun scripts/main.ts "Your prompt here" |
| 43 | |
| 44 | # Explicit prompt flag |
| 45 | npx -y bun scripts/main.ts --prompt "Your prompt here" |
| 46 | npx -y bun scripts/main.ts -p "Your prompt here" |
| 47 | |
| 48 | # With model selection |
| 49 | npx -y bun scripts/main.ts -p "Hello" -m gemini-2.5-pro |
| 50 | |
| 51 | # Pipe from stdin |
| 52 | echo "Summarize this" | npx -y bun scripts/main.ts |
| 53 | ``` |
| 54 | |
| 55 | ### Image generation |
| 56 | |
| 57 | ```bash |
| 58 | # Generate image with default path (./generated.png) |
| 59 | npx -y bun scripts/main.ts --prompt "A sunset over mountains" --image |
| 60 | |
| 61 | # Generate image with custom path |
| 62 | npx -y bun scripts/main.ts --prompt "A cute robot" --image robot.png |
| 63 | |
| 64 | # Shorthand |
| 65 | npx -y bun scripts/main.ts "A dragon" --image=dragon.png |
| 66 | ``` |
| 67 | |
| 68 | ### Output formats |
| 69 | |
| 70 | ```bash |
| 71 | # Plain text (default) |
| 72 | npx -y bun scripts/main.ts "Hello" |
| 73 | |
| 74 | # JSON output |
| 75 | npx -y bun scripts/main.ts "Hello" --json |
| 76 | ``` |
| 77 | |
| 78 | ## Options |
| 79 | |
| 80 | | Option | Description | |
| 81 | |--------|-------------| |
| 82 | | `--prompt <text>`, `-p` | Prompt text | |
| 83 | | `--promptfiles <files...>` | Read prompt from files (concatenated in order) | |
| 84 | | `--model <id>`, `-m` | Model: gemini-3-pro (default), gemini-2.5-pro, gemini-2.5-flash | |
| 85 | | `--image [path]` | Generate image, save to path (default: generated.png) | |
| 86 | | `--sessionId <id>` | Session ID for multi-turn conversation (agent generates unique ID) | |
| 87 | | `--list-sessions` | List saved sessions (max 100, sorted by update time) | |
| 88 | | `--json` | Output as JSON | |
| 89 | | `--login` | Refresh cookies only, then exit | |
| 90 | | `--cookie-path <path>` | Custom cookie file path | |
| 91 | | `--profile-dir <path>` | Chrome profile directory | |
| 92 | | `--help`, `-h` | Show help | |
| 93 | |
| 94 | CLI note: `scripts/main.ts` supports text generation, image generation, and multi-turn conversations via `--sessionId`. Reference images and video generation are exposed via the executor API. |
| 95 | |
| 96 | ## Models |
| 97 | |
| 98 | - `gemini-3-pro` - Default, latest model |
| 99 | - `gemini-2.5-pro` - Previous generation pro |
| 100 | - `gemini-2.5-flash` - Fast, lightweight |
| 101 | |
| 102 | ## Authentication |
| 103 | |
| 104 | First run opens Chrome to authenticate with Google. Cookies are cached for subsequent runs. |
| 105 | |
| 106 | ```bash |
| 107 | # Force cookie refresh |
| 108 | npx -y bun scripts/main.ts --login |
| 109 | ``` |
| 110 | |
| 111 | ## Environment variables |
| 112 | |
| 113 | | Variable | Description | |
| 114 | |----------|-------------| |
| 115 | | `GEMINI_WEB_DATA_DIR` | Data directory | |
| 116 | | `GEMINI_WEB_COOKIE_PATH` | Cookie file path | |
| 117 | | `GEMINI_WEB_CHROME_PROFILE_DIR` | Chrome profile directory | |
| 118 | | `GEMINI_WEB_CHROME_PATH` | Chrome executable path | |
| 119 | |
| 120 | ## Examples |
| 121 | |
| 122 | ### Generate text response |
| 123 | ```bash |
| 124 | npx -y bun scripts/main.ts "What is the capital of France?" |
| 125 | ``` |
| 126 | |
| 127 | ### Generate image |
| 128 | ```bash |
| 129 | npx -y bun scripts/main.ts "A photorealistic image of a golden retriever puppy" --image puppy.png |
| 130 | ``` |
| 131 | |
| 132 | ### Get JSON output for parsing |
| 133 | ```bash |
| 134 | npx -y bun scripts/main.ts "Hello" --json | jq '.text' |
| 135 | ``` |
| 136 | |
| 137 | ### Generate image from prompt files |
| 138 | ```bash |
| 139 | # Concatenate system.md + content.md as prompt |
| 140 | npx -y bun scripts/main.ts --promptfiles system.md content.md --image output.png |
| 141 | ``` |
| 142 | |
| 143 | ### Multi-turn conversation |
| 144 | ```bash |
| 145 | # Start a session with unique ID (agent generates this) |
| 146 | npx -y b |