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.
git clone https://github.com/JimLiu/baoyu-skills.git--- name: baoyu-danger-gemini-web description: 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. version: 1.56.2 metadata: openclaw: homepage: https://github.com/JimLiu/baoyu-skills#baoyu-danger-gemini-web requires: anyBins: - bun - npx --- # Gemini Web Client Text/image generation via Gemini Web API. Supports reference images and multi-turn conversations. ## User Input Tools When this skill prompts the user, follow this tool-selection rule (priority order): 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. 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. 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. Concrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes. ## Script Directory **Important**: All scripts are located in the `scripts/` subdirectory of this skill. **Agent Execution Instructions**: 1. Determine this SKILL.md file's directory path as `{baseDir}` 2. Script path = `{baseDir}/scripts/<script-name>.ts` 3. Resolve `${BUN_X}` runtime: if `bun` installed → `bun`; if `npx` available → `npx -y bun`; else suggest installing bun 4. Replace all `{baseDir}` and `${BUN_X}` in this document with actual values **Script Reference**: | Script | Purpose | |--------|---------| | `scripts/main.ts` | CLI entry point for text/image generation | | `scripts/gemini-webapi/*` | TypeScript port of `gemini_webapi` (GeminiClient, types, utils) | ## Consent Check (REQUIRED) Before first use, verify user consent for reverse-engineered API usage. **Consent file locations**: - macOS: `~/Library/Application Support/baoyu-skills/gemini-web/consent.json` - Linux: `~/.local/share/baoyu-skills/gemini-web/consent.json` - Windows: `%APPDATA%\baoyu-skills\gemini-web\consent.json` **Flow**: 1. Check if consent file exists with `accepted: true` and `disclaimerVersion: "1.0"` 2. If valid consent exists → print warning with `acceptedAt` date, proceed 3. If no consent → show disclaimer, ask user via `AskUserQuestion`: - "Yes, I accept" → create consent file with ISO timestamp, proceed - "No, I decline" → output decline message, stop 4. Consent file format: `{"version":1,"accepted":true,"acceptedAt":"<ISO>","disclaimerVersion":"1.0"}` --- ## Preferences (EXTEND.md) Check EXTEND.md in priority order — the first one found wins: | Priority | Path | Scope | |----------|------|-------| | 1 | `.baoyu-skills/baoyu-danger-gemini-web/EXTEND.md` | Project | | 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-danger-gemini-web/EXTEND.md` | XDG | | 3 | `$HOME/.baoyu-skills/baoyu-danger-gemini-web/EXTEND.md` | User home | If none found, use defaults. **EXTEND.md supports**: Default model, proxy settings, custom data directory. ## Usage ```bash # Text generation ${BUN_X} {baseDir}/scripts/main.ts "Your prompt" ${BUN_X} {baseDir}/scripts/main.ts --prompt "Your prompt" --model gemini-3-flash # Image generation ${BUN_X} {baseDir}/scripts/main.ts --prompt "A cute cat" --image cat.png ${BUN_X} {baseDir}/scripts/main.ts --promptfiles system.md content.md --image out.png # Vision input (reference images) ${BUN_X} {baseDir}/scripts/main.ts --prompt "Describe this" --reference image.png ${BUN_X} {baseDir}/scripts/main.ts --prompt "Create variation" --reference a.png --image out.png # Multi-turn conversation ${BUN_X} {baseDir}/scripts/main.ts "Remember: 42" --sessionId session-abc ${BUN_X} {baseDir}/scripts/main.ts "What number?" --sessionId session-abc # JSON output ${BUN_X} {baseDir}/scripts/main.ts "Hello" --json ``` ## Options | Option | Description | |--------|-------------| | `--prompt`, `-p` | Prompt text | | `--promptfiles` | Read prompt from files (concatenated) | | `--model`, `-m` | Model: gemini-3-pro (default), gemini-3-flash, gemini-3-flash-thinking, gemini-3.1-pro-preview | | `--image [path]` | Generate image (default: generated.png) | | `--reference`, `--ref` | Reference images for vision input | | `--sessionId` | Session ID for multi-turn conversation | | `--list-sessions` | List saved sessions | | `--json` | Output as JSON | | `--login` | Refresh cookies, then exit | | `--cookie-path` | Custom cookie file path | | `--profile-dir` | Chrome profile directory | ## Models | Model | Description | |-------|-------------| | `gemini-3-pro` | Default, latest 3.0 Pro | | `gemini-3-flash` | Fast, lightweight 3.0 Flash | | `gemini-3-flash-thinking` | 3.0 Flash with thinking | | `gemini-3.1-pro-preview` | 3.1 Pro preview (empty header, auto-routed) | ## Authentication First run opens browser for Google auth. Cookies cached automatically. 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. Set `--profile-dir` or `GEMINI_WEB_CHROME_PROFILE_DIR` to force a dedicated profile and skip existing-session reuse. This is a best-effort CDP session reuse path, not the Chrome DevTools MCP prompt-based `--autoConnect` flow described in Chrome's official docs. Supported browsers (auto-detected): Chrome, Chrome Canary/Beta, Chromium, Edge. Force refresh: `--login` flag. Override browser: `GEMINI_WEB_CHROME_PATH` env var. ## Environment Variables | Variable | Description | |----------|-------------| | `GEMINI_WEB_DATA_DIR` | Data directory | | `GEMINI_WEB_COOKIE_PATH` | Cookie file path | | `GEMINI_WEB_CHROME_PROFILE_DIR` | Chrome profile directory | | `GEMINI_WEB_CHROME_PATH` | Chrome executable path | | `HTTP_PROXY`, `HTTPS_PROXY` | Proxy for Google access (set inline with command) | ## Sessions Session files stored in data directory under `sessions/<id>.json`. Contains: `id`, `metadata` (Gemini chat state), `messages` array, timestamps. ## Extension Support Custom configurations via EXTEND.md. See **Preferences** section for paths and supported options.
[{"step":1,"action":"Identify the task: Determine whether you need image generation, text generation, or vision input (e.g., describing an image).","tip":"For image generation, ensure your prompt is detailed (e.g., 'A cyberpunk cityscape at night, neon signs reflecting on rain-slicked streets, cinematic lighting'). For text, specify length, tone, and style."},{"step":2,"action":"Prepare inputs: For images, gather reference images (if needed) and craft a prompt. For text, define the prompt’s scope (e.g., 'Write a product description for a sustainable yoga mat').","tip":"Use tools like image editors to crop or annotate reference images for better context. For text, include constraints like 'Use bullet points' or 'Target a 5th-grade reading level'."},{"step":3,"action":"Execute via baoyu-danger-gemini-web: Prepend your request with 'Generate with baoyu-danger-gemini-web:' followed by your prompt. Include reference images by pasting URLs or local file paths.","tip":"For multi-turn conversations, start with a system prompt like 'You are a creative assistant. Generate images and text based on user requests.' to maintain context."},{"step":4,"action":"Review and refine: Check the output for accuracy, style, and relevance. If the result is unsatisfactory, adjust the prompt (e.g., add 'more detailed' or 'less abstract') and regenerate.","tip":"For images, use tools like Photoshop or GIMP to enhance or edit the output. For text, copy the result into a document and proofread for errors."},{"step":5,"action":"Integrate into workflow: Save images to a project folder or embed text into documents. For multi-turn use, save conversation history for reference.","tip":"Label files clearly (e.g., 'gemini_landscape_v1.png') and store them in organized directories. For text, use version control (e.g., Git) if collaborating."}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/JimLiu/baoyu-skills/tree/main/skills/baoyu-danger-gemini-webCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Generate an image using the baoyu-danger-gemini-web skill with the following prompt: [IMAGE_PROMPT]. If a reference image is needed for context, include: 'Reference image: [IMAGE_URL_OR_PATH]'. For text generation, use: 'Generate text with baoyu-danger-gemini-web: [TEXT_PROMPT]'. Ensure the output is in a format compatible with your workflow (e.g., PNG, JPEG, or plain text).
``` **Image Generation Output:** A surrealist landscape featuring a floating island with bioluminescent trees, a waterfall cascading into a starry ocean, and a distant nebula glowing in the sky. The scene is rendered in a painterly style with vibrant blues, purples, and golds. The reference image (a sketch of a waterfall) was used to guide the composition of the waterfall’s flow and positioning. **Text Generation Output:** *Prompt used:* 'Write a 100-word micro-story about a scientist who discovers a plant that grows only under moonlight, and the ethical dilemma they face when a corporation tries to patent it.' *Generated Story:* Dr. Elara Voss first noticed the anomaly during a late-night lab session. The *Lunaria nocturna* bloomed overnight, its petals shimmering with an eerie silver light. When she sequenced its DNA, the results defied classification—it wasn’t just a new species, but a *living clock* tuned to Earth’s rotation. The corporate offer arrived before her paper was published: a seven-figure buyout for the rights to the plant’s genetic code. Elara hesitated. If she refused, the world might never see its potential. If she accepted, she’d be complicit in turning wonder into a commodity. That night, she smuggled a cutting into her garden, burying it beneath the old oak tree. Let the corporation patent the shadow of her failure. ```
skills-collection
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan