A simple proxy that caches and restores DeepSeek `reasoning_content` across tool-call turns in Cursor, making thinking models like `deepseek-v4-pro` and `deepseek-v4-flash` work correctly.
## Why This Exists
DeepSeek thinking mode returns `reasoning_content` separately from final `content`. After an assistant turn with tool calls, DeepSeek requires that same `reasoning_content` to be sent back in later requests. Cursor can omit it in custom OpenAI-compatible flows, causing `The reasoning_content in the thinking mode must be passed back to the API.` This proxy caches reasoning by conversation prefix, message signature, and tool-call IDs, then restores it before forwarding to DeepSeek.
Thi repo fixes the following error:

```txt
⚠️ Connection Error
Provider returned error: {"error":{"message":"The reasoning_content in the thinking mode must be passed back to the
`.env.example` is only a safe template. The proxy loads `~/.deepseek-cursor-proxy/.env` automatically, and that file should stay outside this repository because it contains your keys.
Edit `~/.deepseek-cursor-proxy/.env`:
```bash
DEEPSEEK_API_KEY=sk-your-deepseek-key
PROXY_API_KEY=cursor-local-token
```
Keep `PROXY_API_KEY` set when using ngrok because the proxy will be reachable from the public internet.
Override it with `REASONING_CONTENT_PATH` or `deepseek-cursor-proxy --reasoning-content-path <path>` only when you need a custom location.
## 3. Set Up Ngrok Once
- Create/login to an ngrok account: https://dashboard.ngrok.com/signup
- Copy your authtoken from the dashboard: https://dashboard.ngrok.com/get-started/your-authtoken
```bash
brew install ngrok
ngrok config add-authtoken <your-ngrok-token>
```
## 4. Run
```bash
deepseek-cursor-proxy --verbose
```
The proxy prints a line like:
```text
Cursor Base URL: https://example.ngrok-free.app/v1
```
Use that URL in Cursor. If you do not use ngrok and point Cursor at `localhost` or `127.0.0.1`, Cursor may fail with `ssrf_blocked: connection to private IP is blocked`.
## 5. Cursor Settings
- OpenAI Base URL: the printed ngrok URL ending in `/v1`