A high-performance proxy that lets Claude Code use Google Gemini models.
# Build
cargo build --release
# Set API key and start
export GEMINI_API_KEY="your-gemini-api-key"
RUST_LOG=info cargo run --releaseThe proxy starts on http://127.0.0.1:8111 by default.
# In a new terminal
export ANTHROPIC_BASE_URL=http://localhost:8111
export ANTHROPIC_AUTH_TOKEN="your-gemini-api-key"
export ANTHROPIC_MODEL=gemini-2.0-flash-exp
# Optional: Fine-tune model selection
export ANTHROPIC_DEFAULT_OPUS_MODEL=gemini-2.0-flash-exp
export ANTHROPIC_DEFAULT_SONNET_MODEL=gemini-2.0-flash-exp
export ANTHROPIC_DEFAULT_HAIKU_MODEL=gemini-2.0-flash-exp
export CLAUDE_CODE_SUBAGENT_MODEL=gemini-2.0-flash-exp
# Use Claude Code normally!
claude-code- ๐ฐ Save Money: Gemini has a free tier, Claude doesn't
- ๐ Larger Context: Gemini supports 2M tokens vs Claude's 200K
- โก Fast: Gemini 2.0 Flash is blazingly fast
- ๐ง Same Tools: Keep using Claude Code's excellent interface
- ๐ง Thinking Mode: Full support for Gemini 3 Pro Preview with thinking
- โ Zero Config - Just set API key
- โ Transparent - Claude Code works normally
- โ Streaming - Real-time SSE responses
- โ Thinking Support - Handles Gemini 3 Pro Preview thinking mode
- โ Fast - Built with Axum and Reqwest
- โ Production Ready - 76 tests passing
Built with modern Rust async stack:
handler.rs- Request routing and SSE streamingclient.rs- Gemini API clienttransform/- Claude โ Gemini protocol translationstreaming/- SSE event generation and parsingmodels/- Type-safe API models
v0.2.1 (2025-11-19) - CRITICAL FIX: Thought Signature Handling
- โ Fixed "Unknown name thoughtSignature" errors - Correctly identified that thoughtSignature is response-only
- โ Proper API compliance - thoughtSignature is never included in requests (only in responses)
- โ Simplified implementation - Removed complex fallback logic that was unnecessary
- โ Prevents 400 errors - No more "Invalid JSON payload received. Unknown name 'thoughtSignature'" errors
- โ Production tested - All 137 tests passing
v0.2.0 (2025-11-19) - MAJOR UPDATE: Full Tool Calling Support
- โ Complete tool calling implementation (Phases 1-7)
- โ All 11 Claude Code tools now work (TodoWrite, Task, Bash, Read, Edit, Write, Glob, Grep, AskUserQuestion, WebFetch, WebSearch)
- โ State management for multi-turn tool conversations
- โ Schema caching for 10x performance boost
- โ Performance metrics and monitoring
- โ Comprehensive schema validation
- โ Thought signature handling for Gemini 3 Pro
- โ 137 tests passing (was 76)
- โ Zero clippy warnings
The proxy now fully supports Claude Code's tool calling system:
Supported Tools (11 total):
- โ TodoWrite - Task tracking
- โ Task - Subagent spawning
- โ Bash - Shell commands
- โ Read/Edit/Write - File operations
- โ Glob/Grep - Search operations
- โ AskUserQuestion - User interaction
- โ WebFetch/WebSearch - Web access
Features:
- Bidirectional transformation (Claude โ Gemini)
- Multi-turn conversations with state tracking
- Schema caching (<0.2ms overhead)
- Automatic validation
- Performance metrics
- Thought signature management (Gemini 3 Pro requirement)
For Gemini 3 Pro, the proxy correctly handles thought signatures at the Part level:
- Response Processing: When Gemini returns function calls with
thoughtSignature, it's cached in DashMap state - Request Processing: When resending conversation history,
thoughtSignatureis included at the Part level (not inside functionCall) - Correct Structure:
{ "functionCall": {"name": "tool", "args": {...}}, "thoughtSignature": "<signature>" } - Smart Fallback: Uses cached signature when available, or
"context_engineering_is_the_way_to_go"as fallback
Key Insight: thoughtSignature is a sibling field to functionCall at the Part level, NOT a field inside the functionCall object itself.
See TOOL_CALLING_GUIDE.md for testing guide.
- README_EN.md - Complete English guide
- README_CN.md - ๅฎๆดไธญๆๆๅ
- TOOL_CALLING_GUIDE.md - Tool calling testing guide
- specs/0005-tool-use.md - Technical specification
- DEPLOYMENT.md - Production deployment
- Version: 0.2.1
- Tests: 137/137 Passing โ (+2 ignored for global state)
- Tool Calling: Full Support โ
- Gemini 3 Pro: Full Compatibility โ
- Quality: Production Ready โ
- License: MIT
Visit: https://aistudio.google.com/apikey
Free tier includes:
- 15 requests per minute
- 1 million tokens per day
- Perfect for development!