Cursor + OpenRouter Setup
This guide walks you through setting up Claude-Mem in Cursor using OpenRouter. OpenRouter provides access to 100+ AI models from various providers, including several free options.Model variety: Access Claude, GPT-4, Gemini, Llama, Mistral, and many more through a single API key.
Step 1: Get an OpenRouter API Key
- Go to OpenRouter
- Sign up or sign in
- Navigate to API Keys
- Click Create Key
- Copy your API key - you’ll need it in Step 3
Step 2: Clone and Build Claude-Mem
Step 3: Configure OpenRouter Provider
Option A: Interactive Setup (Recommended)
Run the setup wizard which guides you through everything:Option B: Manual Configuration
Create the settings file manually:YOUR_OPENROUTER_API_KEY with your actual API key.
Then install hooks and start the worker:
Step 4: Restart Cursor
Close and reopen Cursor IDE for the hooks to take effect.Step 5: Verify Installation
Recommended Models
Free Models
Paid Models (Low Cost)
To specify a model, add to your settings:
Custom OpenAI-Compatible Endpoints
The OpenRouter provider is a generic OpenAI-compatible client. SetCLAUDE_MEM_OPENROUTER_BASE_URL to point it at any endpoint that speaks the OpenAI /chat/completions API — DeepSeek, a local LM Studio server, or any custom gateway. The model id you set in CLAUDE_MEM_OPENROUTER_MODEL is sent verbatim.
Base URL resolution: When
CLAUDE_MEM_OPENROUTER_BASE_URL is empty (default), requests go to OpenRouter unchanged. When set, claude-mem POSTs to <base_url>/chat/completions — you can supply either a base like https://api.deepseek.com/v1 (the /chat/completions path is appended automatically) or a full .../chat/completions URL (used verbatim). Trailing slashes are normalized. The environment variable OPENROUTER_BASE_URL is honored as a fallback.DeepSeek
LM Studio (local model)
LM Studio exposes an OpenAI-compatible server. No API key is required for local use, and you can use any model id you have loaded.Generic custom endpoint
Any OpenAI-compatible gateway works the same way:Cost Management
OpenRouter charges per token. To manage costs:- Use free models: Several high-quality free models are available
- Monitor usage: Check your OpenRouter dashboard
- Set spending limits: Configure limits in OpenRouter settings
Troubleshooting
”OpenRouter API key not configured”
Ensure your settings file exists with the correct format:Model not found
- Check the model ID is correct at OpenRouter Models
- Some models may require payment - check if you have credits
- Free models have
:freesuffix in their ID
Rate limits
OpenRouter rate limits vary by model and your account tier. If you hit limits:- Wait briefly and retry
- Consider upgrading your OpenRouter account tier
- Switch to a less popular model
API errors
Check the worker logs for details:- Invalid API key (regenerate at OpenRouter)
- Insufficient credits for paid models
- Model temporarily unavailable
Switching Providers Later
You can switch between OpenRouter, Gemini, and Claude SDK at any time by updating your settings. No restart required - changes take effect on the next observation.Next Steps
- Cursor Integration Overview - All Cursor features
- Gemini Setup - Alternative free provider
- Configuration Reference - All settings options

