tuzi-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)
重要提示: 所有脚本都位于本技能的
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/tuzi-skills/gemini-web/consent.json
  • Linux:
    ~/.local/share/tuzi-skills/gemini-web/consent.json
  • Windows:
    %APPDATA%\tuzi-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/tuzi-skills/gemini-web/consent.json
  • Linux:
    ~/.local/share/tuzi-skills/gemini-web/consent.json
  • Windows:
    %APPDATA%\tuzi-skills\gemini-web\consent.json
流程:
  1. 检查是否存在同意书文件,且文件中
    accepted: true
    disclaimerVersion: "1.0"
  2. 如果存在有效同意书 → 打印包含
    acceptedAt
    日期的提示,继续执行
  3. 如果不存在同意书 → 展示免责声明,通过
    AskUserQuestion
    询问用户:
    • "是的,我同意" → 创建带有ISO时间戳的同意书文件,继续执行
    • "不,我拒绝" → 输出拒绝信息,停止执行
  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 .tuzi-skills/tuzi-danger-gemini-web/EXTEND.md && echo "project"
test -f .tuzi-skills/tuzi-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/.tuzi-skills/tuzi-danger-gemini-web/EXTEND.md" && echo "user"

┌──────────────────────────────────────────────────────────┬───────────────────┐
│                           Path                           │     Location      │
├──────────────────────────────────────────────────────────┼───────────────────┤
│ .tuzi-skills/tuzi-danger-gemini-web/EXTEND.md          │ Project directory │
├──────────────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.tuzi-skills/tuzi-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/.tuzi-skills/tuzi-danger-gemini-web/EXTEND.md" && echo "user"

┌──────────────────────────────────────────────────────────┬───────────────────┐
│                           路径                           │        位置       │
├──────────────────────────────────────────────────────────┼───────────────────┤
│ .tuzi-skills/tuzi-danger-gemini-web/EXTEND.md          │     项目目录      │
├──────────────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.tuzi-skills/tuzi-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-3-flash
npx -y bun ${SKILL_DIR}/scripts/main.ts "Your prompt" npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Your prompt" --model gemini-3-flash

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 "A cute cat" --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 "Describe this" --reference image.png npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Create variation" --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 "Remember: 42" --sessionId session-abc npx -y bun ${SKILL_DIR}/scripts/main.ts "What number?" --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 "Hello" --json
undefined

Options

参数选项

OptionDescription
--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
参数描述
--prompt
,
-p
提示词文本
--promptfiles
从文件读取提示词(自动拼接)
--model
,
-m
模型: gemini-3-pro(默认), gemini-3-flash, gemini-3-flash-thinking, gemini-3.1-pro-preview
--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 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)
模型描述
gemini-3-pro
默认,最新3.0 Pro版本
gemini-3-flash
快速轻量的3.0 Flash版本
gemini-3-flash-thinking
具备思考能力的3.0 Flash版本
gemini-3.1-pro-preview
3.1 Pro预览版(空请求头,自动路由)

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自定义配置,路径和支持的配置项见偏好设置章节。