JSPM

claude-gemini-multimodal-bridge

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q41108F
  • License MIT

Enterprise-grade AI integration bridge connecting Claude Code, Gemini CLI, and Google AI Studio with intelligent routing and advanced multimodal processing capabilities

Package Exports

  • claude-gemini-multimodal-bridge
  • claude-gemini-multimodal-bridge/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (claude-gemini-multimodal-bridge) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Claude-Gemini Multimodal Bridge (CGMB)

🚀 Enterprise-grade AI integration bridge connecting Claude Code, Gemini CLI, and Google AI Studio with intelligent routing and advanced multimodal processing.

npm version License: MIT Node.js Version

✨ Key Features

🎯 Version 1.0.0 - Production Ready

  • 🔐 OAuth Authentication: Simplified OAuth file-based authentication for Claude Code compatibility
  • 🌐 Automatic Translation: Japanese to English translation for optimal image generation
  • 🔧 Intelligent URL Routing: PDF URLs to Claude Code, web pages to Gemini CLI
  • Performance Optimization: Reduced timeouts, lazy loading, and smart caching
  • 🛡️ Enterprise Reliability: 95% self-healing with exponential backoff
  • 📊 Complete Multimodal Support: Images, audio, PDFs, and documents

🏗️ Core Architecture

  • 🔗 3-Layer System: Claude Code ↔ Gemini CLI ↔ AI Studio
  • 🎯 Intelligent Routing: Automatically routes tasks to optimal AI layer
  • 📊 Multimodal Processing: Images, Audio, PDFs, Documents
  • Workflow Orchestration: Complex multi-step automation
  • 💰 Cost Optimization: Smart layer selection with caching

🚀 Quick Start

WSL Users

nvm use 22.17                        # Use correct Node.js version
nvm current                          # Verify version

Installation

# Install globally
npm install -g claude-gemini-multimodal-bridge

# The postinstall script automatically:
# ✅ Installs Gemini CLI
# ✅ Sets up Claude Code MCP integration
# ✅ Creates .env template
# ✅ Verifies system requirements

NPM Global Installation Setup

After installing with npm install -g claude-gemini-multimodal-bridge, create a .env file in your working directory:

# Create .env file in current directory
cat > .env << 'EOF'
# Claude-Gemini Multimodal Bridge Configuration
AI_STUDIO_API_KEY=your_api_key_here
EOF

# Edit the file to add your actual API key
nano .env  # or use your preferred editor

Note: The .env file should be created in the directory where you'll run CGMB commands.

Gemini CLI Authentication

Set up authentication using Gemini CLI:

# Gemini CLI authentication
gemini

This enables web search and current information retrieval through Gemini CLI.

First-time Setup with Claude Code

After NPM installation, help Claude Code discover CGMB with this initial prompt:

I installed CGMB via NPM. Please check my current environment for the cgmb command and help me use it.

Authentication Setup

# Get API key from: https://aistudio.google.com/app/apikey
# Add to .env file:
AI_STUDIO_API_KEY=your_api_key_here

⚠️ Important: API Costs

CGMB uses pay-per-use APIs:

  • Google AI Studio API: Gemini API (Generative Language API) Pricing details

Prerequisites

  • Node.js ≥ 22.0.0
  • Claude Code CLI installed and configured
  • Gemini CLI (auto-installed)

🎯 Usage with Claude Code

CGMB integrates seamlessly with Claude Code. Use the "CGMB" keyword for optimal tool selection:

Examples

# Image generation
"CGMB generate an image of a futuristic city"

# Document analysis (local files - use absolute paths)
"CGMB analyze the document at /full/path/to/report.pdf"

# URL analysis (direct web content processing)
"CGMB analyze https://example.com/document.pdf"

# Web search (current information)
"CGMB search for the latest AI developments"

# Audio generation
"CGMB create audio saying 'Welcome to our podcast'"

# Multi-file processing
"CGMB analyze the image at /path/to/image.png and the document at /path/to/document.pdf together"

How It Works

  1. Include "CGMB" in your Claude Code request
  2. CGMB automatically routes to the best AI layer:
    • Gemini CLI: Web search, current information
    • AI Studio: Images, audio, file processing
    • Claude Code: Complex reasoning, code analysis

🏗️ Architecture

flowchart TD
    A[Claude Code] --> B[CGMB]
    
    B --> C[Gemini CLI]
    B --> D[Claude Code]
    B --> E[AI Studio]

3-Layer System

Layer Primary Functions Best For Timeout
Claude Code Complex reasoning, code analysis Strategic planning, complex logic 300s
Gemini CLI Web search, current information Real-time data, quick queries 30s
AI Studio Multimodal processing, generation Images, documents, files 120s

Performance Features

  • Authentication Caching: 80% overhead reduction (Gemini 6h, AI Studio 24h, Claude 12h TTL)
  • Search Cache: 60-80% hit rates with 1-hour TTL
  • Intelligent Routing: Automatic optimal layer selection
  • Error Recovery: 95% automatic recovery with fallback strategies

📁 File Organization

Generated content is automatically organized:

output/
├── images/     # Generated images
├── audio/      # Generated audio files
└── documents/  # Processed documents

Access files through Claude Code:

  • get_generated_file: Retrieve specific files
  • list_generated_files: List all generated files
  • get_file_info: Get file metadata

🔧 Configuration

Environment Variables

# Required
AI_STUDIO_API_KEY=your_api_key_here

# Optional (OAuth preferred for Gemini)
GEMINI_API_KEY=your_api_key_here

# Performance settings
ENABLE_CACHING=true
CACHE_TTL=3600
LOG_LEVEL=info

MCP Integration

CGMB automatically configures Claude Code MCP integration:

  • Configuration path: ~/.claude-code/mcp_servers.json
  • Direct Node.js execution for 100% compatibility
  • Safe merge without overwriting existing servers

🐛 Troubleshooting

Debug Mode

# Enable comprehensive debugging
export CGMB_DEBUG=true
export LOG_LEVEL=debug
cgmb serve --debug

Project Structure

src/
├── core/           # Main MCP server and layer management
├── layers/         # AI layer implementations
├── auth/           # Authentication system
├── tools/          # Processing tools
├── workflows/      # Workflow implementations
├── utils/          # Utilities and helpers
└── mcp-servers/    # Custom MCP servers

Terms & Policies

📄 License

MIT License - see LICENSE file for details.