canghe-danger-gemini-web by freestylefly/canghe-skills
npx skills add https://github.com/freestylefly/canghe-skills --skill canghe-danger-gemini-web通过 Gemini Web API 进行文本/图像生成。支持参考图像和多轮对话。
重要提示:所有脚本都位于此技能的 scripts/ 子目录中。
代理执行说明:
SKILL_DIR${SKILL_DIR}/scripts/<脚本名称>.ts${SKILL_DIR} 替换为实际路径脚本参考:
| 脚本 | 用途 |
|---|---|
scripts/main.ts | 用于文本/图像生成的 CLI 入口点 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
scripts/gemini-webapi/* |
gemini_webapi 的 TypeScript 移植版本(GeminiClient、类型、工具) |
首次使用前,请验证用户是否同意使用逆向工程 API。
同意文件位置:
~/Library/Application Support/canghe-skills/gemini-web/consent.json~/.local/share/canghe-skills/gemini-web/consent.json%APPDATA%\canghe-skills\gemini-web\consent.json流程:
accepted: true 和 disclaimerVersion: "1.0"acceptedAt 日期的警告,继续执行AskUserQuestion 询问用户:
{"version":1,"accepted":true,"acceptedAt":"<ISO>","disclaimerVersion":"1.0"}使用 Bash 检查 EXTEND.md 是否存在(优先级顺序):
# 首先检查项目级别
test -f .canghe-skills/canghe-danger-gemini-web/EXTEND.md && echo "project"
# 然后检查用户级别(跨平台:$HOME 适用于 macOS/Linux/WSL)
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 支持:默认模型 | 代理设置 | 自定义数据目录
# 文本生成
npx -y bun ${SKILL_DIR}/scripts/main.ts "您的提示"
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "您的提示" --model gemini-2.5-pro
# 图像生成
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
# 视觉输入(参考图像)
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
# 多轮对话
npx -y bun ${SKILL_DIR}/scripts/main.ts "记住:42" --sessionId session-abc
npx -y bun ${SKILL_DIR}/scripts/main.ts "什么数字?" --sessionId session-abc
# JSON 输出
npx -y bun ${SKILL_DIR}/scripts/main.ts "你好" --json
| 选项 | 描述 |
|---|---|
--prompt, -p | 提示文本 |
--promptfiles | 从文件读取提示(拼接) |
--model, -m | 模型:gemini-3-pro(默认)、gemini-2.5-pro、gemini-2.5-flash |
--image [路径] | 生成图像(默认:generated.png) |
--reference, --ref | 用于视觉输入的参考图像 |
--sessionId | 用于多轮对话的会话 ID |
--list-sessions | 列出已保存的会话 |
--json | 输出为 JSON 格式 |
--login | 刷新 cookie,然后退出 |
--cookie-path | 自定义 cookie 文件路径 |
--profile-dir | Chrome 配置文件目录 |
| 模型 | 描述 |
|---|---|
gemini-3-pro | 默认,最新 |
gemini-2.5-pro | 上一代专业版 |
gemini-2.5-flash | 快速、轻量级 |
首次运行会打开浏览器进行 Google 认证。Cookie 会自动缓存。
支持的浏览器(自动检测):Chrome、Chrome Canary/Beta、Chromium、Edge。
强制刷新:使用 --login 标志。覆盖浏览器:使用 GEMINI_WEB_CHROME_PATH 环境变量。
| 变量 | 描述 |
|---|---|
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/<id>.json 中。
包含:id、metadata(Gemini 聊天状态)、messages 数组、时间戳。
通过 EXTEND.md 进行自定义配置。有关路径和支持的选项,请参阅偏好设置部分。
每周安装量
106
仓库
GitHub 星标数
182
首次出现
2026年2月24日
安全审计
安装于
github-copilot105
gemini-cli105
codex105
kimi-cli105
cursor105
opencode105
Text/image generation via Gemini Web API. Supports reference images and multi-turn conversations.
Important : All scripts are located in the scripts/ subdirectory of this skill.
Agent Execution Instructions :
SKILL_DIR${SKILL_DIR}/scripts/<script-name>.ts${SKILL_DIR} in this document with the actual pathScript Reference :
| Script | Purpose |
|---|---|
scripts/main.ts | CLI entry point for text/image generation |
scripts/gemini-webapi/* | TypeScript port of gemini_webapi (GeminiClient, types, utils) |
Before first use, verify user consent for reverse-engineered API usage.
Consent file locations :
~/Library/Application Support/canghe-skills/gemini-web/consent.json~/.local/share/canghe-skills/gemini-web/consent.json%APPDATA%\canghe-skills\gemini-web\consent.jsonFlow :
accepted: true and disclaimerVersion: "1.0"acceptedAt date, proceedAskUserQuestion:
{"version":1,"accepted":true,"acceptedAt":"<ISO>","disclaimerVersion":"1.0"}Use Bash to check EXTEND.md existence (priority order):
# Check project-level first
test -f .canghe-skills/canghe-danger-gemini-web/EXTEND.md && echo "project"
# Then user-level (cross-platform: $HOME works on 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
# 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
# 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
# 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
# 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
# JSON output
npx -y bun ${SKILL_DIR}/scripts/main.ts "Hello" --json
| Option | Description |
|---|---|
--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, |
| Model | Description |
|---|---|
gemini-3-pro | Default, latest |
gemini-2.5-pro | Previous pro |
gemini-2.5-flash | Fast, lightweight |
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.
| 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) |
Session files stored in data directory under sessions/<id>.json.
Contains: id, metadata (Gemini chat state), messages array, timestamps.
Custom configurations via EXTEND.md. See Preferences section for paths and supported options.
Weekly Installs
106
Repository
GitHub Stars
182
First Seen
Feb 24, 2026
Security Audits
Gen Agent Trust HubWarnSocketWarnSnykWarn
Installed on
github-copilot105
gemini-cli105
codex105
kimi-cli105
cursor105
opencode105
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
67,500 周安装
--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 |