$npx -y skills add JimLiu/baoyu-skills --skill baoyu-danger-gemini-webGenerates 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 wi
| 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- |