Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Generate text and images via the reverse-engineered Gemini Web API with multi-turn conversation support.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: baoyu-danger-gemini-web3description: 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.4version: 1.56.15metadata:6openclaw:7homepage: https://github.com/JimLiu/baoyu-skills#baoyu-danger-gemini-web8requires:9anyBins:10- bun11- npx12---1314# Gemini Web Client1516Text/image generation via Gemini Web API. Supports reference images and multi-turn conversations.1718## User Input Tools1920When this skill prompts the user, follow this tool-selection rule (priority order):21221. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent.232. **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.243. **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.2526Concrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes.2728## Script Directory2930**Important**: All scripts are located in the `scripts/` subdirectory of this skill.3132**Agent Execution Instructions**:331. Determine this SKILL.md file's directory path as `{baseDir}`342. Script path = `{baseDir}/scripts/<script-name>.ts`353. Resolve `${BUN_X}` runtime: if `bun` installed → `bun`; if `npx` available → `npx -y bun`; else suggest installing bun364. Replace all `{baseDir}` and `${BUN_X}` in this document with actual values3738**Script Reference**:39| Script | Purpose |40|--------|---------|41| `scripts/main.ts` | CLI entry point for text/image generation |42| `scripts/gemini-webapi/*` | TypeScript port of `gemini_webapi` (GeminiClient, types, utils) |4344## Consent Check (REQUIRED)4546Before first use, verify user consent for reverse-engineered API usage.4748**Consent file locations**:49- macOS: `~/Library/Application Support/baoyu-skills/gemini-web/consent.json`50- Linux: `~/.local/share/baoyu-skills/gemini-web/consent.json`51- Windows: `%APPDATA%\baoyu-skills\gemini-web\consent.json`5253**Flow**:541. Check if consent file exists with `accepted: true` and `disclaimerVersion: "1.0"`552. If valid consent exists → print warning with `acceptedAt` date, proceed563. If no consent → show disclaimer, ask user via `AskUserQuestion`:57- "Yes, I accept" → create consent file with ISO timestamp, proceed58- "No, I decline" → output decline message, stop594. Consent file format: `{"version":1,"accepted":true,"acceptedAt":"<ISO>","disclaimerVersion":"1.0"}`6061---6263## Preferences (EXTEND.md)6465Check EXTEND.md in priority order — the first one found wins:6667| Priority | Path | Scope |68|----------|------|-------|69| 1 | `.baoyu-skills/baoyu-danger-gemini-web/EXTEND.md` | Project |70| 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-danger-gemini-web/EXTEND.md` | XDG |71| 3 | `$HOME/.baoyu-skills/baoyu-danger-gemini-web/EXTEND.md` | User home |7273If none found, use defaults.7475**EXTEND.md supports**: Default model, proxy settings, custom data directory.7677## Usage7879```bash80# Text generation81${BUN_X} {baseDir}/scripts/main.ts "Your prompt"82${BUN_X} {baseDir}/scripts/main.ts --prompt "Your prompt" --model gemini-3-flash8384# Image generation85${BUN_X} {baseDir}/scripts/main.ts --prompt "A cute cat" --image cat.png86${BUN_X} {baseDir}/scripts/main.ts --promptfiles system.md content.md --image out.png8788# Vision input (reference images)89${BUN_X} {baseDir}/scripts/main.ts --prompt "Describe this" --reference image.png90${BUN_X} {baseDir}/scripts/main.ts --prompt "Create variation" --reference a.png --image out.png9192# Multi-turn conversation93${BUN_X} {baseDir}/scripts/main.ts "Remember: 42" --sessionId session-abc94${BUN_X} {baseDir}/scripts/main.ts "What number?" --sessionId session-abc9596# JSON output97${BUN_X} {baseDir}/scripts/main.ts "Hello" --json98```99100## Options101102| Option | Description |103|--------|-------------|104| `--prompt`, `-p` | Prompt text |105| `--promptfiles` | Read prompt from files (concatenated) |106| `--model`, `-m` | Model: gemini-3-pro (default), gemini-3-flash, gemini-3-flash-thinking, gemini-3.1-pro-preview |107| `--image [path]` | Generate image (default: generated.png) |108| `--reference`, `--ref` | Reference images for vision input |109| `--sessionId` | Session ID for multi-turn conversation |110| `--list-sessions` | List saved sessions |111| `--json` | Output as JSON |112| `--login` | Refresh cookies, then exit |113| `--cookie-path` | Custom cookie file path |114| `--profile-dir` | Chrome profile directory |115116## Models117118| Model | Description |119|-------|-------------|120| `gemini-3-pro` | Default, latest 3.0 Pro |121| `gemini-3-flash` | Fast, lightweight 3.0 Flash |122| `gemini-3-flash-thinking` | 3.0 Flash with thinking |123| `gemini-3.1-pro-preview` | 3.1 Pro preview (empty header, auto-routed) |124125## Authentication126127First run opens browser for Google auth. Cookies cached automatically.128129When 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.130Set `--profile-dir` or `GEMINI_WEB_CHROME_PROFILE_DIR` to force a dedicated profile and skip existing-session reuse.131This is a best-effort CDP session reuse path, not the Chrome DevTools MCP prompt-based `--autoConnect` flow described in Chrome's official docs.132133Supported browsers (auto-detected): Chrome, Chrome Canary/Beta, Chromium, Edge.134135Force refresh: `--login` flag. Override browser: `GEMINI_WEB_CHROME_PATH` env var.136137## Environment Variables138139| Variable | Description |140|----------|-------------|141| `GEMINI_WEB_DATA_DIR` | Data directory |142| `GEMINI_WEB_COOKIE_PATH` | Cookie file path |143| `GEMINI_WEB_CHROME_PROFILE_DIR` | Chrome profile directory |144| `GEMINI_WEB_CHROME_PATH` | Chrome executable path |145| `HTTP_PROXY`, `HTTPS_PROXY` | Proxy for Google access (set inline with command) |146147## Sessions148149Session files stored in data directory under `sessions/<id>.json`.150151Contains: `id`, `metadata` (Gemini chat state), `messages` array, timestamps.152153## Extension Support154155Custom configurations via EXTEND.md. See **Preferences** section for paths and supported options.156