Reverse Engineering Cursor's LLM Client
a year ago
- #AI Coding Assistant
- #LLM
- #Reverse Engineering
- TensorZero was used to reverse engineer Cursor's LLM client by acting as a proxy between Cursor and LLM providers.
- Cursor initially sends requests to its own servers before making LLM calls, requiring a reverse proxy (Ngrok) to intercept traffic.
- CORS issues were encountered and resolved by configuring Nginx to handle OPTIONS requests with appropriate headers.
- The setup allowed observation of Cursor's prompts and responses, revealing a 642-token system prompt driving its AI coding assistant.
- Cursor uses a hierarchy of models, including a 'less intelligent' apply model for code edits, which is explicitly mentioned in the system prompt.
- A/B testing with different LLMs (Claude 4.0 Sonnet, GPT-4.1, o4 Mini, Gemini 2.5 Pro) showed no noticeable latency impact.
- The project is open-source, with instructions available on GitHub for replicating the setup.