@vitorcen/gemini-cli-anthropic
v1.3.2
Published
Proxy server that enables Claude Code to use Gemini Pro models via gemini-cli
Readme
gemini-cli-anthropic
Proxy server that enables Claude Code to use Gemini Pro models via gemini-cli, leveraging Google's affordable monthly subscription plans. Bridges Anthropic's Claude API format to Google's Gemini API.
Setup Instructions
Quick Install (Recommended)
Install globally via npm:
npm install -g @vitorcen/gemini-cli-anthropicStart the server:
gemini-cli-anthropicThe server will start on port 41242 (configurable via PORT environment variable).
Install from Source
1. Clone with submodules
Option 1: Clone with submodules in one command
git clone --recurse-submodules [email protected]:vitorcen/gemini-cli-anthropic.git
cd gemini-cli-anthropicOption 2: Clone then initialize submodules
git clone [email protected]:vitorcen/gemini-cli-anthropic.git
cd gemini-cli-anthropic
git submodule update --init --recursive2. Install dependencies
Install main project dependencies:
npm installInstall gemini-cli submodule dependencies:
cd gemini-cli
npm install
cd ..3. Run the server
npm startThe server will listen on port 41242 by default (configurable via PORT environment variable).
Authentication
By default, the server authenticates using Google Cloud Platform (GCP) credentials (USE_CCPA=true). Ensure your environment is configured for GCP authentication (e.g., by running gcloud auth application-default login).
Alternatively, you can use a Gemini API key by setting the GEMINI_API_KEY environment variable.
Environment Variables
PORT: Server port (default: 41242 )GEMINI_API_KEY: Your Google Gemini API key. If provided, this will be used for authentication instead of the default GCP method.GOOGLE_APPLICATION_CREDENTIALS: Path to your Google Cloud credentials file (if needed).DEBUG_LOG: Set totrueto enable detailed request/response logging.TEXT_LOG: Set totrueto enable logging of text content streaming (default: false).
Usage with Claude Code
Once the proxy server is running, configure Claude Code to use Gemini models by setting these environment variables:
ANTHROPIC_BASE_URL=http://127.0.0.1:41242 \
ANTHROPIC_MODEL=gemini-3-pro-preview \
ANTHROPIC_DEFAULT_OPUS_MODEL=gemini-3-pro-preview \
ANTHROPIC_DEFAULT_SONNET_MODEL=gemini-2.5-flash \
ANTHROPIC_DEFAULT_HAIKU_MODEL=gemini-2.5-flash \
claudeThis configuration:
- Routes all Claude API calls through the proxy server
- Maps Opus requests to Gemini 2.5 Pro (high capability)
- Maps Sonnet/Haiku requests to Gemini 2.5 Flash (fast, cost-effective)
You can customize the model mappings based on your needs and available Gemini models.
Update Submodule (if needed)
git submodule update --remote gemini-cliSubmodule Info
- Path:
gemini-cli/ - Repository: https://github.com/google-gemini/gemini-cli
- Version: v0.15.4 (commit 40fa8136e)
