byjimliu· 68 skills
Generates images and text via reverse-engineered Gemini Web API. Supports text generation, image generation from prompts, reference images for vision input, and multi-turn conversations. Use when other skills need image generation backend, or when user requests "generate image with Gemini", "Gemini text generation", or needs vision-capable AI generation.
$npx -y skills add jimliu/baoyu-skills --skill baoyu-danger-gemini-webInstalls into the current project.
Run `npx skills use "https://github.com/jimliu/baoyu-skills" --skill "jimliu/baoyu-skills/baoyu-danger-gemini-web"` and follow the generated skill instructions now. Read its complete output, redirecting it to a temporary file first if necessary. Resolve relative paths from the supporting-files directory it provides.
Use the skills in "https://github.com/jimliu/baoyu-skills" that are relevant to the current task. Run `npx skills add "https://github.com/jimliu/baoyu-skills"` and select the relevant skills, then follow their instructions.
| 1 | # Gemini Web Client |
| 2 | |
| 3 | Text/image generation via Gemini Web API. Supports reference images and multi-turn conversations. |
| 4 | |
| 5 | ## User Input Tools |
| 6 | |
| 7 | When this skill prompts the user, follow this tool-selection rule (priority order): |
| 8 | |
| 9 | 1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent. |
| 10 | 2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question. |
| 11 | 3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order. |
| 12 | |
| 13 | Concrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes. |
| 14 | |
| 15 | ## Script Directory |
| 16 | |
| 17 | **Important**: All scripts are located in the `scripts/` subdirectory of this skill. |
| 18 | |
| 19 | **Agent Execution Instructions**: |
| 20 | 1. Determine this SKILL.md file's directory path as `{baseDir}` |
| 21 | 2. Script path = `{baseDir}/scripts/<script-name>.ts` |
| 22 | 3. Resolve `${BUN_X}` runtime: if `bun` installed → `bun`; if `npx` available → `npx -y bun`; else suggest installing bun |
| 23 | 4. Replace all `{baseDir}` and `${BUN_X}` in this document with actual values |
| 24 | |
| 25 | **Script Reference**: |
| 26 | | Script | Purpose | |
| 27 | |--------|---------| |
| 28 | | `scripts/main.ts` | CLI entry point for text/image generation | |
| 29 | | `scripts/gemini-webapi/*` | TypeScript port of `gemini_webapi` (GeminiClient, types, utils) | |
| 30 | |
| 31 | ## Consent Check (REQUIRED) |
| 32 | |
| 33 | Before first use, verify user consent for reverse-engineered API usage. |
| 34 | |
| 35 | **Consent file locations**: |
| 36 | - macOS: `~/Library/Application Support/baoyu-skills/gemini-web/consent.json` |
| 37 | - Linux: `~/.local/share/baoyu-skills/gemini-web/consent.json` |
| 38 | - Windows: `%APPDATA%\baoyu-skills\gemini-web\consent.json` |
| 39 | |
| 40 | **Flow**: |
| 41 | 1. Check if consent file exists with `accepted: true` and `disclaimerVersion: "1.0"` |
| 42 | 2. If valid consent exists → print warning with `acceptedAt` date, proceed |
| 43 | 3. If no consent → show disclaimer, ask user via `AskUserQuestion`: |
| 44 | - "Yes, I accept" → create consent file with ISO timestamp, proceed |
| 45 | - "No, I decline" → output decline message, stop |
| 46 | 4. Consent file format: `{"version":1,"accepted":true,"acceptedAt":"<ISO>","disclaimerVersion":"1.0"}` |
| 47 | |
| 48 | --- |
| 49 | |
| 50 | ## Preferences (EXTEND.md) |
| 51 | |
| 52 | Check EXTEND.md in priority order — the first one found wins: |
| 53 | |
| 54 | | Priority | Path | Scope | |
| 55 | |----------|------|-------| |
| 56 | | 1 | `.baoyu-skills/baoyu-danger-gemini-web/EXTEND.md` | Project | |
| 57 | | 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-danger-gemini-web/EXTEND.md` | XDG | |
| 58 | | 3 | `$HOME/.baoyu-skills/baoyu-danger-gemini-web/EXTEND.md` | User home | |
| 59 | |
| 60 | If none found, use defaults. |
| 61 | |
| 62 | **EXTEND.md supports**: Default model, proxy settings, custom data directory. |
| 63 | |
| 64 | ## Usage |
| 65 | |
| 66 | ```bash |
| 67 | # Text generation |
| 68 | ${BUN_X} {baseDir}/scripts/main.ts "Your prompt" |
| 69 | ${BUN_X} {baseDir}/scripts/main.ts --prompt "Your prompt" --model gemini-3-flash |
| 70 | |
| 71 | # Image generation |
| 72 | ${BUN_X} {baseDir}/scripts/main.ts --prompt "A cute cat" --image cat.png |
| 73 | ${BUN_X} {baseDir}/scripts/main.ts --promptfiles system.md content.md --image out.png |
| 74 | |
| 75 | # Vision input (reference images) |
| 76 | ${BUN_X} {baseDir}/scripts/main.ts --prompt "Describe this" --reference image.png |
| 77 | ${BUN_X} {baseDir}/scripts/main.ts --prompt "Create variation" --reference a.png --image out.png |
| 78 | |
| 79 | # Multi-turn conversation |
| 80 | ${BUN_X} {baseDir}/scripts/main.ts "Remember: 42" --sessionId session-abc |
| 81 | ${BUN_X} {baseDir}/scripts/main.ts "What number?" --sessionId session-abc |
| 82 | |
| 83 | # JSON output |
| 84 | ${BUN_X} {baseDir}/scripts/main.ts "Hello" --json |
| 85 | ``` |
| 86 | |
| 87 | ## Options |
| 88 | |
| 89 | | Option | Description | |
| 90 | |--------|-------------| |
| 91 | | `--prompt`, `-p` | Prompt text | |
| 92 | | `--promptfiles` | Read prompt from files (concatenated) | |
| 93 | | `--model`, `-m` | Model: gemini-3-pro (default), gemini-3-flash, gemini-3-flash-thinking, gemini-3.1-pro-preview | |
| 94 | | `--image [path]` | Generate image (default: generated.png) | |
| 95 | | `--reference`, `--ref` | Reference images for vision input | |
| 96 | | `--sessionId` | Session ID for multi-turn conversation | |
| 97 | | `--list-sessions` | List saved sessions | |
| 98 | | `--json` | Output as JSON | |
| 99 | | `--login` | Refresh cookies, then exit | |
| 100 | | `--cookie-path` | Custom cookie file path | |
| 101 | | `--profile-dir` | Chrome profile directory | |
| 102 | |
| 103 | ## Models |
| 104 | |
| 105 | | Model | Description | |
| 106 | |-------|-------------| |
| 107 | | `gemini-3-pro` | Default, latest 3.0 Pro | |
| 108 | | `gemini-3-flash` | Fast, lightweight 3.0 Flash | |
| 109 | | `gemini-3-flash-thinking` | 3.0 Flash with thinking | |
| 110 | | `gemini-3.1-pro-preview` | 3.1 Pro preview (empty header, auto-routed) | |
| 111 | |
| 112 | ## Authentication |
| 113 | |
| 114 | First run opens browser for Google auth. Cookies cached automatically. |
| 115 | |
| 116 | When no explicit profile dir is set, cookie refresh may reuse an already-running local Chrome/Chromium debugging session tied to a standard user-data dir. |
| 117 | Set `--profile-dir` or `GEMINI_WEB_CHROME_PROFILE_DIR` to force a dedicated profile and skip existing-session reuse. |
| 118 | This is a best-effort CDP session reuse path, not the Chrome DevTools MCP prompt-based `--autoConnect` flow described in Chrome's official docs. |
| 119 | |
| 120 | Supported browsers (auto-detected): Chrome, Chrome Canary/Beta, Chromium, Edge. |
| 121 | |
| 122 | Force refresh: `--login` flag. Override browser: `GEMINI_WEB_CHROME_PATH` env var. |
| 123 | |
| 124 | ## Environment Variables |
| 125 | |
| 126 | | Variable | Description | |
| 127 | |----------|-------------| |
| 128 | | `GEMINI_WEB_DATA_DIR` | Data directory | |
| 129 | | `GEMINI_WEB_COOKIE_PATH` | Cookie file path | |
| 130 | | `GEMINI_WEB_CHROME_PROFILE_DIR` | Chrome profile directory | |
| 131 | | `GEMINI_WEB_CHROME_PATH` | Chrome executable path | |
| 132 | | `HTTP_PROXY`, `HTTPS_PROXY` | Proxy for Google access (set inline with command) | |
| 133 | |
| 134 | ## Sessions |
| 135 | |
| 136 | Session files stored in data directory under `sessions/<id>.json`. |
| 137 | |
| 138 | Contains: `id`, `metadata` (Gemini chat state), `messages` array, timestamps. |
| 139 | |
| 140 | ## Extension Support |
| 141 | |
| 142 | Custom configurations via EXTEND.md. See **Preferences** section for paths and supported options. |