$npx -y skills add freestylefly/canghe-skills --skill canghe-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 | ## Script Directory |
| 6 | |
| 7 | **Important**: All scripts are located in the `scripts/` subdirectory of this skill. |
| 8 | |
| 9 | **Agent Execution Instructions**: |
| 10 | 1. Determine this SKILL.md file's directory path as `SKILL_DIR` |
| 11 | 2. Script path = `${SKILL_DIR}/scripts/<script-name>.ts` |
| 12 | 3. Replace all `${SKILL_DIR}` in this document with the actual path |
| 13 | |
| 14 | **Script Reference**: |
| 15 | | Script | Purpose | |
| 16 | |--------|---------| |
| 17 | | `scripts/main.ts` | CLI entry point for text/image generation | |
| 18 | | `scripts/gemini-webapi/*` | TypeScript port of `gemini_webapi` (GeminiClient, types, utils) | |
| 19 | |
| 20 | ## Consent Check (REQUIRED) |
| 21 | |
| 22 | Before first use, verify user consent for reverse-engineered API usage. |
| 23 | |
| 24 | **Consent file locations**: |
| 25 | - macOS: `~/Library/Application Support/canghe-skills/gemini-web/consent.json` |
| 26 | - Linux: `~/.local/share/canghe-skills/gemini-web/consent.json` |
| 27 | - Windows: `%APPDATA%\canghe-skills\gemini-web\consent.json` |
| 28 | |
| 29 | **Flow**: |
| 30 | 1. Check if consent file exists with `accepted: true` and `disclaimerVersion: "1.0"` |
| 31 | 2. If valid consent exists → print warning with `acceptedAt` date, proceed |
| 32 | 3. If no consent → show disclaimer, ask user via `AskUserQuestion`: |
| 33 | - "Yes, I accept" → create consent file with ISO timestamp, proceed |
| 34 | - "No, I decline" → output decline message, stop |
| 35 | 4. Consent file format: `{"version":1,"accepted":true,"acceptedAt":"<ISO>","disclaimerVersion":"1.0"}` |
| 36 | |
| 37 | --- |
| 38 | |
| 39 | ## Preferences (EXTEND.md) |
| 40 | |
| 41 | Use Bash to check EXTEND.md existence (priority order): |
| 42 | |
| 43 | ```bash |
| 44 | # Check project-level first |
| 45 | test -f .canghe-skills/canghe-danger-gemini-web/EXTEND.md && echo "project" |
| 46 | |
| 47 | # Then user-level (cross-platform: $HOME works on macOS/Linux/WSL) |
| 48 | test -f "$HOME/.canghe-skills/canghe-danger-gemini-web/EXTEND.md" && echo "user" |
| 49 | ``` |
| 50 | |
| 51 | ┌──────────────────────────────────────────────────────────┬───────────────────┐ |
| 52 | │ Path │ Location │ |
| 53 | ├──────────────────────────────────────────────────────────┼───────────────────┤ |
| 54 | │ .canghe-skills/canghe-danger-gemini-web/EXTEND.md │ Project directory │ |
| 55 | ├──────────────────────────────────────────────────────────┼───────────────────┤ |
| 56 | │ $HOME/.canghe-skills/canghe-danger-gemini-web/EXTEND.md │ User home │ |
| 57 | └──────────────────────────────────────────────────────────┴───────────────────┘ |
| 58 | |
| 59 | ┌───────────┬───────────────────────────────────────────────────────────────────────────┐ |
| 60 | │ Result │ Action │ |
| 61 | ├───────────┼───────────────────────────────────────────────────────────────────────────┤ |
| 62 | │ Found │ Read, parse, apply settings │ |
| 63 | ├───────────┼───────────────────────────────────────────────────────────────────────────┤ |
| 64 | │ Not found │ Use defaults │ |
| 65 | └───────────┴───────────────────────────────────────────────────────────────────────────┘ |
| 66 | |
| 67 | **EXTEND.md Supports**: Default model | Proxy settings | Custom data directory |
| 68 | |
| 69 | ## Usage |
| 70 | |
| 71 | ```bash |
| 72 | # Text generation |
| 73 | npx -y bun ${SKILL_DIR}/scripts/main.ts "Your prompt" |
| 74 | npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Your prompt" --model gemini-2.5-pro |
| 75 | |
| 76 | # Image generation |
| 77 | npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cute cat" --image cat.png |
| 78 | npx -y bun ${SKILL_DIR}/scripts/main.ts --promptfiles system.md content.md --image out.png |
| 79 | |
| 80 | # Vision input (reference images) |
| 81 | npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Describe this" --reference image.png |
| 82 | npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Create variation" --reference a.png --image out.png |
| 83 | |
| 84 | # Multi-turn conversation |
| 85 | npx -y bun ${SKILL_DIR}/scripts/main.ts "Remember: 42" --sessionId session-abc |
| 86 | npx -y bun ${SKILL_DIR}/scripts/main.ts "What number?" --sessionId session-abc |
| 87 | |
| 88 | # JSON output |
| 89 | npx -y bun ${SKILL_DIR}/scripts/main.ts "Hello" --json |
| 90 | ``` |
| 91 | |
| 92 | ## Options |
| 93 | |
| 94 | | Option | Description | |
| 95 | |--------|-------------| |
| 96 | | `--prompt`, `-p` | Prompt text | |
| 97 | | `--promptfiles` | Read prompt from files (concatenated) | |
| 98 | | `--model`, `-m` | Model: gemini-3-pro (default), gemini-2.5-pro, gemini-2.5-flash | |
| 99 | | `--image [path]` | Generate image (default: generated.png) | |
| 100 | | `--reference`, `--ref` | Reference images for vision input | |
| 101 | | `--sessionId` | Session ID for multi-turn conversation | |
| 102 | | `--list-sessions` | List saved sessions | |
| 103 | | `--json` | Output as JSON | |
| 104 | | `--login` | Refresh cookies, then exit | |
| 105 | | `--cookie-path` | Custom cookie file path | |
| 106 | | `--profile-dir` | Chrome profil |