Gemini研究工具

一个通过Gemini API进行高效网络搜索的工具,用于节省Claude Code中的研究令牌消耗。

  • by MichaelGagnon13
  • Python
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 MichaelGagnon13/gemini-research

使用说明

双子座研究

节省约95%的Claude Code研究代币 通过将网络搜索委托给Gemini的免费API。

每 WebSearch/WebFetch 克劳德代码消耗5000-20000个上下文令牌。该工具通过Gemini路由研究查询(每天250个免费请求),并返回简洁的答案(约200-400个令牌)。

快速开始

# Install
git clone https://github.com/MichaelGagnon13/gemini-research.git
cd gemini-research
pip3 install --user -e .

# Setup API key (free at https://aistudio.google.com/apikey)
gemini-research --setup

# Use it
gemini-research "latest stable Tauri v2 release"

特性

  • 谷歌搜索停飞 --Gemini为您搜索网络,返回最新信息
  • 4种研究模式 — general, versions, github, deps
  • 文件缓存 带可配置TTL(默认4h)
  • 速率限制器 --追踪每天250个需求的免费套餐
  • MCP服务器 --作为3个工具直接集成到Claude Code中
  • 命令行界面 --从终端或Claude Code的Bash工具中使用

命令行用法

# General research
gemini-research "What is the latest Python version?"

# Check package versions
gemini-research -m versions "React, Vue, Svelte, Tauri"

# Verify a GitHub repo
gemini-research -m github "anthropics/claude-code"

# Check dependency compatibility
gemini-research -m deps "Is React 19 compatible with Next.js 14?"

# JSON output (for scripts)
gemini-research --json "latest Go version"

# Skip cache
gemini-research --no-cache "breaking news today"

# Without Google Search grounding
gemini-research --no-grounding "explain SOLID principles"

# Check usage
gemini-research --status

MCP集成(克劳德代码)

添加到您的 .claude.json (根据您的项目 mcpServers):

{
  "gemini-research": {
    "type": "stdio",
    "command": "python3",
    "args": ["/path/to/gemini-research/mcp_server/server.py"]
  }
}

重启Claude Code后,您将获得3个MCP工具:

工具 说明
research 模式选择的一般研究
check_versions 包版本查找
verify_github_repo 回购存在+统计数据

运作原理

Claude Code                    gemini-research              Gemini API
    │                               │                           │
    ├── MCP tool call ──────────►   │                           │
    │   (query + mode)              ├── check cache             │
    │                               ├── check rate limit        │
    │                               ├── build prompt            │
    │                               ├── API call ───────────►   │
    │                               │   (with grounding)        ├── Google Search
    │                               │                           ├── synthesize
    │                               │◄── concise response ──────┤
    │◄── ~300 tokens ──────────────┤   (cache result)           │
    │                               │                           │

之前:网络搜索→ 10,000+个上下文中的原始令牌 之后:MCP工具→ ~300 上下文中的焦点标记

配置

配置文件: ~/.config/gemini-research/config.json

{
  "api_key": "your_key_here",
  "model": "gemini-2.0-flash",
  "cache_ttl_hours": 4,
  "daily_limit": 250
}

环境变量 GEMINI_API_KEY 优先于配置文件。

需求

  • Python 3.10+
  • google-generativeai (自动安装)
  • mcp (对于MCP服务器,可选)
  • 免费Gemini API密钥来自 谷歌AI工作室

许可证

麻省理工学院


双子座研究(FR)

节省约95%的Claude代码搜索令牌 通过将web搜索委托给Gemini的免费API。

每个 WebSearch/WebFetch 在Claude代码中,它消耗5000到20000个代币。该工具通过Gemini路由请求(每天250个免费请求),并返回简明响应(~200-400个令牌)。

安装速度快

git clone https://github.com/MichaelGagnon13/gemini-research.git
cd gemini-research
pip3 install --user -e .
gemini-research --setup   # Clé API gratuite: https://aistudio.google.com/apikey

MCP Claude代码集成

添加到您的 .claude.json (苏 mcpServers 您的项目):

{
  "gemini-research": {
    "type": "stdio",
    "command": "python3",
    "args": ["/chemin/vers/gemini-research/mcp_server/server.py"]
  }
}