A powerful integration tool that enables Claude Code to analyze large files and codebases using Google's Gemini AI model. Perfect for when you need to analyze files larger than Claude's context window or get a second perspective on complex code.
- Clone this repo in your project directory
- Run
pip install google-generativeai - Get a free API key from Google AI Studio
- Create
google_api.piwith:api_key=YOUR-KEY-HERE - Ask Claude: "Use gemini to analyze my large file"
That's it! Claude will handle the rest.
- 📁 Analyze files of any size (even 10,000+ line files)
- 🔍 Get intelligent summaries and insights from large codebases
- 🎯 Ask specific questions about code structure and patterns
- 🚀 Works seamlessly within Claude Code environment
- 💡 Plan complex features with AI assistance
- Python 3.8+
- Google Gemini API key (free tier available)
- Claude Code (claude.ai/code)
git clone https://github.com/MoonlightByte/claude-code-gemini-tool.git
cd claude-code-gemini-toolpip install google-generativeai- Get your free API key from: https://makersuite.google.com/app/apikey
- Copy the example file to create your API key file:
cp google_api.pi.example google_api.pi
- Edit
google_api.piand replace the fake key with your actual API key:api_key=AIzaSyD-YOUR-ACTUAL-API-KEY-HERE
-
Add this directory to your Claude Code workspace so Claude can access the tool.
-
The included CLAUDE.md file will automatically tell Claude about the Gemini tool.
-
(Optional) If you want to add this to an existing project's CLAUDE.md, just copy the contents of this repo's CLAUDE.md file into your project's CLAUDE.md.
Once set up, simply ask Claude naturally and the tool will be used automatically:
You don't need to write any code! Just ask Claude things like:
"Use the gemini tool to analyze this 5000-line HTML file and tell me about its structure"
"Use gemini to help plan how to implement authentication in this codebase"
"Can you use gemini to review these files for potential security issues?"
"Use the gemini tool to summarize what this module does"
The tool provides two main functions:
query_gemini(prompt, files=None)- Ask questions about files or get general assistanceplan_feature(feature_description, files=None)- Get implementation plans for new features
Claude Code will automatically use these functions when you mention "gemini" or when dealing with large files.
from gemini_tool import query_gemini
result = query_gemini(
"What does this code do?",
files=["main.py", "utils.py"]
)from gemini_tool import plan_feature
plan = plan_feature(
"Add user authentication with JWT tokens",
files=["app.py", "models.py", "routes/"]
)- Claude Code: ~2000 lines comfortably
- Gemini Tool: 100,000+ lines (practically unlimited for code files)
- Be specific in your prompts to Gemini
- Include relevant files when asking about code structure
- Use for planning before implementing complex features
- Combine with Claude - use Gemini for analysis, Claude for implementation
⚠️ Never commit your API key - always use google_api.pi (it's gitignored)- The tool only reads files you explicitly specify
- No data is stored - all analysis is done in real-time
Run: pip install google-generativeai
Check that your API key in google_api.pi is correct
Ensure you're providing correct relative paths from your working directory
Feel free to submit issues and enhancement requests!
MIT License - 100% open source, free to use, modify, and distribute in your own projects
- Built for use with Claude Code
- Powered by Google Gemini