Back to Claude Mem

Cursor + Gemini Setup

docs/public/cursor/gemini-setup.mdx

13.21.24.8 KB
Original Source

Cursor + Gemini Setup

This guide walks you through setting up Claude-Mem in Cursor using Google's Gemini API. Memory runs off-plan on your Gemini key; rate limits depend on the selected model and your Google Cloud project's billing status.

<Info> **No billing required:** You can create a Gemini API key without enabling billing. Projects without billing use Google's model-specific rate limits. </Info>

Step 1: Get a Gemini API Key

  1. Go to Google AI Studio
  2. Sign in with your Google account
  3. Accept the Terms of Service
  4. Click Create API key
  5. Choose or create a Google Cloud project
  6. Copy your API key - you'll need it in Step 3
<Tip> **Higher rate limits:** Enabling billing on your Google Cloud project can increase the available RPM. Review Google's current quota and billing terms before doing so. </Tip>

Step 2: Clone and Build Claude-Mem

bash
# Clone the repository
git clone https://github.com/thedotmack/claude-mem.git
cd claude-mem

# Install dependencies
bun install

# Build the project
bun run build

Step 3: Configure Gemini Provider

Run the setup wizard which guides you through everything:

bash
bun run cursor:setup

The wizard will:

  1. Detect you don't have Claude Code
  2. Ask you to choose Gemini as your provider
  3. Prompt for your API key
  4. Install hooks automatically
  5. Start the worker

Option B: Manual Configuration

Create the settings file manually:

bash
# Create settings directory
mkdir -p ~/.claude-mem

# Create settings file with Gemini configuration
cat > ~/.claude-mem/settings.json << 'EOF'
{
  "CLAUDE_MEM_PROVIDER": "gemini",
  "CLAUDE_MEM_GEMINI_API_KEY": "YOUR_GEMINI_API_KEY"
}
EOF

Replace YOUR_GEMINI_API_KEY with your actual API key.

Then install hooks and start the worker:

bash
bun run cursor:install
bun run worker:start

Step 4: Restart Cursor

Close and reopen Cursor IDE for the hooks to take effect.

Step 5: Verify Installation

bash
# Check worker is running
bun run worker:status

# Check hooks are installed
bun run cursor:status

Open the worker URL printed on startup to see the memory viewer.

Available Gemini Models

ModelRPM without billingNotes
gemini-flash-latest10 (1,000 with billing)Default. Google alias tracking the current GA Flash model
gemini-flash-lite-latest15 (4,000 with billing)Google alias tracking the current GA Flash-Lite model
gemini-3.5-flash10 (1,000 with billing)Pinned GA Flash model
gemini-3.1-flash-lite15 (4,000 with billing)Pinned GA Flash-Lite model
gemini-3-flash-preview5 (1,000 with billing)Preview model

To change the model, update your settings:

json
{
  "CLAUDE_MEM_PROVIDER": "gemini",
  "CLAUDE_MEM_GEMINI_API_KEY": "your-key",
  "CLAUDE_MEM_GEMINI_MODEL": "gemini-3.5-flash"
}

Rate Limiting

Claude-mem automatically handles rate limiting for keys without billing enabled:

  • Requests are spaced to stay within limits
  • Processing may be slightly slower but stays within quota
  • Provider errors leave observations pending for retry

To use billing-enabled limits: Enable billing on your Google Cloud project, then add to settings:

json
{
  "CLAUDE_MEM_GEMINI_BILLING_ENABLED": true
}

This disables claude-mem's conservative no-billing throttle; Google's provider-side quota still applies.

Troubleshooting

"Gemini API key not configured"

Ensure your settings file exists and has the correct format:

bash
cat ~/.claude-mem/settings.json

Should output something like:

json
{
  "CLAUDE_MEM_PROVIDER": "gemini",
  "CLAUDE_MEM_GEMINI_API_KEY": "AIza..."
}

Rate limit errors (HTTP 429)

You're exceeding the no-billing rate limits. Options:

  1. Wait a few minutes for the rate limit to reset
  2. Enable billing on Google Cloud to unlock higher limits
  3. Switch to OpenRouter for higher volume needs

API key invalid

  1. Verify your key at Google AI Studio
  2. Ensure there are no extra spaces or newlines in your settings.json
  3. Try generating a new API key

Worker not processing observations

Check the worker logs:

bash
bun run worker:logs

Look for error messages related to Gemini API calls.

Switching Providers Later

You can switch between Gemini, OpenRouter, and Claude SDK at any time by updating your settings. No restart required - changes take effect on the next observation.

json
{
  "CLAUDE_MEM_PROVIDER": "openrouter"
}

Next Steps