Run Claude Code using your Gemini CLI subscription.
No Anthropic subscription. No Gemini API key. No Vertex AI. Just your Google login.
CodeWeaver is a local compatibility layer that enables Claude Code to use an authenticated Gemini CLI session (Google OAuth) as its backend model provider. It translates Anthropic-compatible requests into Gemini CLI requests while preserving streaming, tool use, and the full Claude Code workflow.
Claude Code is one of the best AI coding agents available, but it normally requires an Anthropic subscription. CodeWeaver lets you use it with the subscription you already have.
| Feature | Anthropic | This Project |
|---|---|---|
| Claude Code UX | Yes | Yes |
| Gemini CLI OAuth | No | Yes |
| Gemini API Key | Required | No |
| Google Login | No | Yes |
| Local Execution | No | Yes |
Claude Code
│
▼
CodeWeaver
│
▼
Gemini CLI (OAuth)
│
▼
Google Gemini
🎥 Demo coming soon! Run
codeweaver --loginto see it in action.
Install CodeWeaver instantly:
curl -fsSL https://raw.githubusercontent.com/whysooraj/CodeWeaver/main/claude-gemini-proxy/install.sh | bashThis installs CodeWeaver to ~/.codeweaver and creates an executable symlink in ~/.local/bin/codeweaver.
Alternatively, clone the repository and run the setup commands:
git clone https://github.com/whysooraj/CodeWeaver.git
cd CodeWeaver/claude-gemini-proxy
node proxy.js --login
node proxy.js
claudeRun the setup authentication flow to log in to your Google Account:
codeweaver --login(If manual install: node proxy.js --login)
This spins up a local server on port 8085, displays a Google sign-in link, and writes your credentials to a local config file upon authentication.
Launch the server to listen for local agent traffic:
codeweaver(If manual install: node proxy.js)
To redirect Claude Code's traffic to the proxy, configure the required environment variables:
Set the variables in your terminal session before starting Claude:
macOS / Linux / WSL:
export ANTHROPIC_BASE_URL="http://127.0.0.1:8099/v1"
export ANTHROPIC_AUTH_TOKEN="sk-dummy-key-for-local-proxy"
claudeWindows (PowerShell):
$env:ANTHROPIC_BASE_URL="http://127.0.0.1:8099/v1"
$env:ANTHROPIC_AUTH_TOKEN="sk-dummy-key-for-local-proxy"
claude- Ensure the Claude configuration directory exists:
- macOS / Linux / WSL:
mkdir -p ~/.claude - Windows (PowerShell):
New-Item -ItemType Directory -Path "$HOME\.claude" -Force
- macOS / Linux / WSL:
- Create or write to
~/.claude/settings.json(or%USERPROFILE%\.claude\settings.jsonon Windows):
{
"env": {
"ANTHROPIC_BASE_URL": "http://127.0.0.1:8099/v1",
"ANTHROPIC_AUTH_TOKEN": "sk-dummy-key-for-local-proxy",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
},
"model": "claude-3-5-sonnet-20241022",
"smallFastModel": "claude-3-5-sonnet-20241022"
}Now, launch Claude Code:
claudeCodeWeaver acts as a stateless, light, local translator intercepting HTTP requests:
Claude Code ──> Anthropic API request ──> CodeWeaver (Local Translator) ──> Gemini Request ──> Google ──> Response Translation ──> Claude Code
- Protocol Translation: Standardizes the nested, multi-turn role structures (user, assistant, tool_use, tool_result) from Anthropic format to Google Cloud Code Assist format.
- Schema Sanitization: Rewrites JSON parameters for tool declaration on the fly to meet strict OpenAPI schema rules, stripping keywords like
$schema,exclusiveMinimum, andpropertyNameswhich cause API calls to fail. - Automatic Fallbacks: If a query hits Google's strict model quotas (
429 Rate Limit), CodeWeaver immediately and silently redirects the chunk request to a high-capacity Flash model (gemini-2.5-flash) within milliseconds.
- Google OAuth Support: Full integration with Gemini CLI credentials.
- No API Keys Needed: Operates completely inside your standard CLI subscription session.
- Streaming Responses: Near-instant token-by-token streaming delivery.
- Automatic Token Refreshing: Keeps OAuth tokens valid by refreshing sessions transparently in the background.
- Zero Runtime Dependencies: Built 100% using native Node.js core libraries.
- Cross-Platform: Works natively on macOS, Linux, and Windows.
- Claude Code to Gemini CLI translation
- Plugin-based provider architecture
- Multiple Gemini account support
- Ollama backend support
- OpenAI backend support
- OpenRouter backend support
- DeepSeek backend support
- Qwen backend support
- LM Studio backend support
- Auto provider failover
- Native platform installer binaries
- Docker image containerization
- Web settings dashboard
CodeWeaver aims to become a universal backend compatibility layer for AI coding agents, allowing developers to choose their preferred agent UX and LLM provider independently.
CodeWeaver defaults to gemini-2.5-pro with a seamless rate-limit fallback to gemini-2.5-flash. You can change these targets depending on your quota limits using any of the following options:
- Interactively inside Claude Code (Recommended): Because Claude Code enforces a strict client-side model whitelist for its visual menu, CodeWeaver maps those official options directly to Gemini models:
- Selecting Sonnet (default) maps to Gemini 2.5 Pro
- Selecting Haiku maps to Gemini 2.5 Flash
- Selecting Opus maps to Gemini 3.1 Pro Preview
- Selecting Fable maps to Gemini 3.1 Flash Lite
- Via the
--modelCLI Option: Start your session with custom aliases or specific Gemini IDs directly:claude --model claude-gemini-3.1-pro-preview
- Via settings.json: Set the
"model"field in your~/.claude/settings.jsonto any valid Gemini model ID starting withgemini-or any of the mapped Claude aliases:"model": "gemini-3.1-pro-preview"
- Via local config.json properties: Add custom model mappings in the local
config.jsonfile:{ "geminiModel": "gemini-3.1-pro-preview", "geminiFallbackModel": "gemini-3.1-flash-lite" } - Via Environment Variables: Export overrides in your terminal session before starting CodeWeaver:
export GEMINI_MODEL="gemini-3.1-pro-preview" export GEMINI_FALLBACK_MODEL="gemini-3.1-flash-lite"
The proxy resolves authentication credentials automatically based on your host operating system:
| Operating System | Default Configuration Location |
|---|---|
| Linux | $HOME/.pi/agent/auth.json |
| macOS | $HOME/.pi/agent/auth.json |
| Windows | %USERPROFILE%\.pi\agent\auth.json |
Placing a config.json file in the same directory as proxy.js overrides these paths to run CodeWeaver in a local, self-contained workspace.
Create a systemd service file at ~/.config/systemd/user/codeweaver.service:
[Unit]
Description=CodeWeaver Local Proxy Server
After=network.target
[Service]
ExecStart=/usr/bin/node /path/to/CodeWeaver/claude-gemini-proxy/proxy.js
Restart=on-failure
[Install]
WantedBy=default.targetEnable and start the service:
systemctl --user daemon-reload
systemctl --user enable --now codeweaver.serviceCreate an agent Plist at ~/Library/LaunchAgents/com.user.codeweaver.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.codeweaver</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/node</string>
<string>/path/to/claude-gemini-proxy/proxy.js</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>Load and start the agent:
launchctl load ~/Library/LaunchAgents/com.user.codeweaver.plistTo run the proxy silently on startup, create a VBScript file named codeweaver.vbs:
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "node C:\path\to\claude-gemini-proxy\proxy.js", 0, falsePlace this file in your Windows Startup folder (shell:startup in run command).
If port 8099 is bound by another active process, find and kill it:
Linux / macOS:
kill $(lsof -t -i:8099)Windows (PowerShell):
Stop-Process -Id (Get-NetTCPConnection -LocalPort 8099).OwningProcess -ForceGoogle Code Assist Pro models have strict quotas. If you hit this limit, the proxy's self-healing fallback will automatically retry the request using gemini-2.5-flash in the background, allowing the operation to succeed.
Distributed under the MIT License. See LICENSE for more information.