canghe-danger-gemini-web

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Gemini Web Client

Gemini Web Client

Text/image generation via Gemini Web API. Supports reference images and multi-turn conversations.
通过Gemini Web API实现文本/图像生成,支持参考图与多轮对话。

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
    SKILL_DIR
  2. Script path =
    ${SKILL_DIR}/scripts/<script-name>.ts
  3. Replace all
    ${SKILL_DIR}
    in this document with the actual path
Script Reference:
ScriptPurpose
scripts/main.ts
CLI entry point for text/image generation
scripts/gemini-webapi/*
TypeScript port of
gemini_webapi
(GeminiClient, types, utils)
重要提示:所有脚本都位于此skill的
scripts/
子目录中。
Agent执行说明:
  1. 确定此SKILL.md文件的目录路径为
    SKILL_DIR
  2. 脚本路径 =
    ${SKILL_DIR}/scripts/<script-name>.ts
  3. 将本文档中所有
    ${SKILL_DIR}
    替换为实际路径
脚本参考:
脚本用途
scripts/main.ts
文本/图像生成的CLI入口
scripts/gemini-webapi/*
gemini_webapi
的TypeScript移植版(包含GeminiClient、类型定义、工具函数)

Consent Check (REQUIRED)

同意检查(必填)

Before first use, verify user consent for reverse-engineered API usage.
Consent file locations:
  • macOS:
    ~/Library/Application Support/canghe-skills/gemini-web/consent.json
  • Linux:
    ~/.local/share/canghe-skills/gemini-web/consent.json
  • Windows:
    %APPDATA%\canghe-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"}

首次使用前,请确认用户同意使用逆向工程的API。
同意文件位置:
  • macOS:
    ~/Library/Application Support/canghe-skills/gemini-web/consent.json
  • Linux:
    ~/.local/share/canghe-skills/gemini-web/consent.json
  • Windows:
    %APPDATA%\canghe-skills\gemini-web\consent.json
流程:
  1. 检查是否存在包含
    accepted: true
    disclaimerVersion: "1.0"
    的同意文件
  2. 若存在有效同意记录 → 打印包含
    acceptedAt
    日期的警告信息,继续执行
  3. 若无同意记录 → 显示免责声明,通过
    AskUserQuestion
    询问用户:
    • "Yes, I accept" → 创建包含ISO时间戳的同意文件,继续执行
    • "No, I decline" → 输出拒绝提示,终止执行
  4. 同意文件格式:
    {"version":1,"accepted":true,"acceptedAt":"<ISO>","disclaimerVersion":"1.0"}

Preferences (EXTEND.md)

偏好设置(EXTEND.md)

Use Bash to check EXTEND.md existence (priority order):
bash
undefined
使用Bash检查EXTEND.md的存在性(优先级顺序):
bash
undefined

Check project-level first

优先检查项目级

test -f .canghe-skills/canghe-danger-gemini-web/EXTEND.md && echo "project"
test -f .canghe-skills/canghe-danger-gemini-web/EXTEND.md && echo "project"

Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)

然后检查用户级(跨平台: $HOME适用于macOS/Linux/WSL)

test -f "$HOME/.canghe-skills/canghe-danger-gemini-web/EXTEND.md" && echo "user"

┌──────────────────────────────────────────────────────────┬───────────────────┐
│                           Path                           │     Location      │
├──────────────────────────────────────────────────────────┼───────────────────┤
│ .canghe-skills/canghe-danger-gemini-web/EXTEND.md          │ Project directory │
├──────────────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.canghe-skills/canghe-danger-gemini-web/EXTEND.md    │ User home         │
└──────────────────────────────────────────────────────────┴───────────────────┘

┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│  Result   │                                  Action                                   │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Found     │ Read, parse, apply settings                                               │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Not found │ Use defaults                                                              │
└───────────┴───────────────────────────────────────────────────────────────────────────┘

**EXTEND.md Supports**: Default model | Proxy settings | Custom data directory
test -f "$HOME/.canghe-skills/canghe-danger-gemini-web/EXTEND.md" && echo "user"

┌──────────────────────────────────────────────────────────┬───────────────────┐
│ 路径 │ 位置 │
├──────────────────────────────────────────────────────────┼───────────────────┤
│ .canghe-skills/canghe-danger-gemini-web/EXTEND.md          │ 项目目录 │
├──────────────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.canghe-skills/canghe-danger-gemini-web/EXTEND.md    │ 用户主目录 │
└──────────────────────────────────────────────────────────┴───────────────────┘

┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│ 结果 │ 操作 │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ 找到 │ 读取、解析并应用设置 │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ 未找到 │ 使用默认设置 │
└───────────┴───────────────────────────────────────────────────────────────────────────┘

**EXTEND.md支持**: 默认模型 | 代理设置 | 自定义数据目录

Usage

使用方法

bash
undefined
bash
undefined

Text generation

文本生成

npx -y bun ${SKILL_DIR}/scripts/main.ts "Your prompt" npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Your prompt" --model gemini-2.5-pro
npx -y bun ${SKILL_DIR}/scripts/main.ts "你的提示词" npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "你的提示词" --model gemini-2.5-pro

Image generation

图像生成

npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cute cat" --image cat.png npx -y bun ${SKILL_DIR}/scripts/main.ts --promptfiles system.md content.md --image out.png
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "一只可爱的猫" --image cat.png npx -y bun ${SKILL_DIR}/scripts/main.ts --promptfiles system.md content.md --image out.png

Vision input (reference images)

视觉输入(参考图)

npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Describe this" --reference image.png npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Create variation" --reference a.png --image out.png
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "描述这张图" --reference image.png npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "创建变体" --reference a.png --image out.png

Multi-turn conversation

多轮对话

npx -y bun ${SKILL_DIR}/scripts/main.ts "Remember: 42" --sessionId session-abc npx -y bun ${SKILL_DIR}/scripts/main.ts "What number?" --sessionId session-abc
npx -y bun ${SKILL_DIR}/scripts/main.ts "记住:42" --sessionId session-abc npx -y bun ${SKILL_DIR}/scripts/main.ts "那个数字是多少?" --sessionId session-abc

JSON output

JSON输出

npx -y bun ${SKILL_DIR}/scripts/main.ts "Hello" --json
undefined
npx -y bun ${SKILL_DIR}/scripts/main.ts "你好" --json
undefined

Options

选项

OptionDescription
--prompt
,
-p
Prompt text
--promptfiles
Read prompt from files (concatenated)
--model
,
-m
Model: gemini-3-pro (default), gemini-2.5-pro, gemini-2.5-flash
--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
选项描述
--prompt
,
-p
提示文本
--promptfiles
从文件读取提示词(多个文件内容会拼接)
--model
,
-m
模型:gemini-3-pro(默认)、gemini-2.5-pro、gemini-2.5-flash
--image [path]
生成图像(默认输出:generated.png)
--reference
,
--ref
视觉输入用的参考图
--sessionId
多轮对话的会话ID
--list-sessions
列出已保存的会话
--json
以JSON格式输出结果
--login
刷新Cookie,然后退出
--cookie-path
自定义Cookie文件路径
--profile-dir
Chrome配置文件目录

Models

模型

ModelDescription
gemini-3-pro
Default, latest
gemini-2.5-pro
Previous pro
gemini-2.5-flash
Fast, lightweight
模型说明
gemini-3-pro
默认模型,最新版本
gemini-2.5-pro
上一代专业版模型
gemini-2.5-flash
快速、轻量型模型

Authentication

认证

First run opens browser for Google auth. Cookies cached automatically.
Supported browsers (auto-detected): Chrome, Chrome Canary/Beta, Chromium, Edge.
Force refresh:
--login
flag. Override browser:
GEMINI_WEB_CHROME_PATH
env var.
首次运行时会打开浏览器进行Google认证,Cookie会自动缓存。
支持的浏览器(自动检测):Chrome、Chrome Canary/Beta、Chromium、Edge。
强制刷新认证:使用
--login
参数。指定浏览器:设置环境变量
GEMINI_WEB_CHROME_PATH

Environment Variables

环境变量

VariableDescription
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)
变量描述
GEMINI_WEB_DATA_DIR
数据目录
GEMINI_WEB_COOKIE_PATH
Cookie文件路径
GEMINI_WEB_CHROME_PROFILE_DIR
Chrome配置文件目录
GEMINI_WEB_CHROME_PATH
Chrome可执行文件路径
HTTP_PROXY
,
HTTPS_PROXY
访问Google的代理(可随命令一起设置)

Sessions

会话

Session files stored in data directory under
sessions/<id>.json
.
Contains:
id
,
metadata
(Gemini chat state),
messages
array, timestamps.
会话文件存储在数据目录的
sessions/<id>.json
下。
包含内容:
id
metadata
(Gemini对话状态)、
messages
数组、时间戳。

Extension Support

扩展支持

Custom configurations via EXTEND.md. See Preferences section for paths and supported options.
通过EXTEND.md实现自定义配置。请查看偏好设置部分了解路径与支持的选项。