Using NadirClaw with Cursor
Cursor is a VS Code fork built for AI-assisted coding. It supports GPT-5, Claude Sonnet 4.5, Gemini, and custom models. Problem: if you're using it 8 hours a day, those API calls add up fast.
NadirClaw cuts those costs 40-70% by routing simple prompts to cheap models and complex ones to premium. Here's how to set it up.
I'm Dor, author of NadirClaw. This is the setup I actually use.
Prerequisites
- Cursor installed (https://cursor.sh)
- Python 3.10+
- API keys for at least one LLM provider (Anthropic, OpenAI, or Gemini)
Install NadirClaw
curl -fsSL https://raw.githubusercontent.com/doramirdor/NadirClaw/main/install.sh | sh
Or via pip:
pip install nadirclaw
Configure Your Models
Run the interactive setup:
nadirclaw setup
This walks you through:
- Which providers you want to use
- Your API keys
- Which model handles simple prompts
- Which model handles complex prompts
Example config (what I use):
- Simple:
gemini-2.5-flash(free tier, fast) - Complex:
claude-sonnet-4-5(premium, best quality)
Save this to ~/.nadirclaw/.env:
GEMINI_API_KEY=AIza...
ANTHROPIC_API_KEY=sk-ant-...
NADIRCLAW_SIMPLE_MODEL=gemini-2.5-flash
NADIRCLAW_COMPLEX_MODEL=claude-sonnet-4-5
Start NadirClaw
nadirclaw serve --verbose
NadirClaw runs on http://localhost:8856. Keep this terminal open.
Configure Cursor
Open Cursor settings (Cmd+, or Ctrl+,), then:
- Go to Models → Model Settings
- Select OpenAI API (or add a custom provider)
- Set:
-
Base URL:
http://localhost:8856/v1 -
API Key:
local(NadirClaw doesn't require auth for local use) -
Model:
auto
-
Base URL:
Cursor will now route all requests through NadirClaw.
What Happens
Every prompt you send gets classified in ~10ms:
- Simple prompts (docstrings, quick fixes, "what does this do?") → routed to Gemini Flash
- Complex prompts (refactoring, architecture, multi-file edits) → routed to Claude Sonnet
NadirClaw handles:
- Streaming (works like normal Cursor chat)
- Tool use (codebase search, terminal commands)
- Multi-turn conversations (sticks to the same model)
- Context window overflow (auto-swaps to a larger model if needed)
Real Numbers
Here's a week of my actual Cursor usage (tracked via nadirclaw report):
Before NadirClaw:
- 847 requests, all to Claude Sonnet 4.5
- Prompt tokens: 621,400
- Completion tokens: 284,100
- Cost: $127.30
After NadirClaw:
- Simple tier (64%): 542 requests to Gemini Flash → $8.20
- Complex tier (36%): 305 requests to Claude Sonnet → $54.80
- Total: $63.00
- Savings: $64.30 (50%)
Your mileage will vary based on what you build and which models you choose.
See Your Stats
# Full report
nadirclaw report
# Last 24 hours
nadirclaw report --since 24h
# Live dashboard
nadirclaw dashboard
# How much you saved
nadirclaw savings --since 7d
Cost Optimization Tips
Maximum Savings (65%+)
NADIRCLAW_SIMPLE_MODEL=ollama/llama3.1:8b # free, runs locally
NADIRCLAW_COMPLEX_MODEL=claude-sonnet-4-5
Requires Ollama installed. Simple prompts cost nothing.
Balanced (50-60% savings)
NADIRCLAW_SIMPLE_MODEL=gemini-2.5-flash # free tier
NADIRCLAW_COMPLEX_MODEL=claude-sonnet-4-5
This is what I use. Gemini's free tier covers most simple prompts.
All-Claude (30-40% savings)
NADIRCLAW_SIMPLE_MODEL=claude-haiku-4-5
NADIRCLAW_COMPLEX_MODEL=claude-sonnet-4-5
Keeps you in the Anthropic ecosystem but still saves on simple prompts.
Troubleshooting
Cursor says "API key invalid"
Make sure NadirClaw is running (nadirclaw serve). The API key field should be exactly local.
All prompts route to complex model
Check classification with:
nadirclaw classify "Add a docstring to this function"
If the confidence is low, try lowering the threshold:
NADIRCLAW_CONFIDENCE_THRESHOLD=0.04 nadirclaw serve
Model not found
NadirClaw uses LiteLLM under the hood. Check supported models at https://docs.litellm.ai/docs/providers.
For Gemini, NadirClaw calls the native API directly (faster, better streaming).
Source
NadirClaw: https://github.com/doramirdor/NadirClaw
Cursor docs: https://docs.cursor.com
License
MIT
Top comments (0)