Gemini for Claude Code banner
coffeegrind123 coffeegrind123

Gemini for Claude Code

Development community intermediate

Description

This server acts as a bridge, enabling you to use **Claude Code** with Google's powerful **Gemini models**. It translates API requests and responses between the Anthropic format (used by Claude Code) and the Gemini format (via LiteLLM), allowing seamless integration.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

FOR OFFICIAL GOOGLE AI CLI TOOL SEE https://github.com/google-gemini/gemini-cli

Gemini for Claude Code: An Anthropic-Compatible Proxy

This server acts as a bridge, enabling you to use **Claude Code** with Google's powerful **Gemini models**. It translates API requests and responses between the Anthropic format (used by Claude Code) and the Gemini format (via LiteLLM), allowing seamless integration.

Features

  • Claude Code Compatibility with Gemini: Directly use the Claude Code CLI with Google Gemini models.
  • Seamless Model Mapping: Intelligently maps Claude Code model requests (e.g., haiku, sonnet, opus aliases) to your chosen Gemini models.
  • LiteLLM Integration: Leverages LiteLLM for robust and flexible interaction with the Gemini API.
  • Enhanced Streaming Support: Handles streaming responses from Gemini with robust error recovery for malformed chunks and API errors.
  • Complete Tool Use for Claude Code: Translates Claude Code's tool usage (function calling) to and from Gemini's format, with robust handling of tool results.
  • Advanced Error Handling: Provides specific and actionable error messages for common Gemini API issues with automatic fallback strategies.
  • Resilient Architecture: Gracefully handles Gemini API instability with smart retry logic and fallback to non-streaming modes.
  • Diagnostic Endpoints: Includes /health and /test-connection for easier troubleshooting of your setup.
  • Token Counting: Offers a /v1/messages/count_tokens endpoint compatible with Claude Code.

Recent Improvements (v2.5.0)

🛡️ Enhanced Error Resilience

  • Malformed Chunk Recovery: Automatically detects and handles malformed JSON chunks from Gemini streaming
  • Smart Retry Logic: Exponential backoff with configurable retry limits for streaming errors
  • Graceful Fallback: Seamlessly switches to non-streaming mode when streaming fails

...