2026-04-24 13:40:23 +00:00
< h1 > < img src = "assets/logo.png" width = "90" alt = "deepseek-cursor-proxy logo" style = "vertical-align: middle;" > deepseek-cursor-proxy< / h1 >
2026-04-24 08:45:52 +00:00
2026-04-24 10:42:59 +00:00
Compatibility proxy connecting Cursor to DeepSeek thinking models (`deepseek-v4-pro` and `deepseek-v4-flash` ).
2026-04-24 08:45:52 +00:00
2026-04-24 09:11:21 +00:00
## What It Does
2026-04-24 10:42:59 +00:00
- ✅ Caches DeepSeek `reasoning_content` from regular and streamed responses, then restores it on later tool-call turns when Cursor omits it. See [DeepSeek docs ](https://api-docs.deepseek.com/guides/thinking_mode#tool-calls ) for more details.
- ✅ Mirrors streamed `reasoning_content` into Cursor-visible `<think>...</think>` text so that thinking tokens are shown in Cursor's UI. For BYOK/proxy mode, Cursor renders this as normal text, not as a native collapsible thinking block.
2026-04-24 13:40:23 +00:00
- ✅ Starts an ngrok tunnel so Cursor can reach the local proxy through a public HTTPS URL.
2026-04-24 10:42:59 +00:00
- ✅ Provides other compatibility fixes to make DeepSeek models run well in Cursor.
2026-04-24 09:11:21 +00:00
2026-04-24 08:45:52 +00:00
## Why This Exists
2026-04-24 10:42:59 +00:00
This repository fixes the following Cursor + DeepSeek tool-call error with thinking mode enabled:
2026-04-24 08:45:52 +00:00

```txt
⚠️ Connection Error
2026-04-24 10:42:59 +00:00
Provider returned error:
{
"error": {
"message": "The reasoning_content in the thinking mode must be passed back to the API.",
"type": "invalid_request_error",
"param": null,
"code": "invalid_request_error"
}
}
2026-04-24 08:45:52 +00:00
```
2026-04-24 10:42:59 +00:00
## Usage
2026-04-24 08:45:52 +00:00
2026-04-24 10:42:59 +00:00
### Step 1: Set Up ngrok
2026-04-24 08:45:52 +00:00
2026-04-24 13:40:23 +00:00
Cursor blocks non-public API URLs such as `localhost` , so the proxy needs a public HTTPS URL. [ngrok ](https://ngrok.com/ ) can expose the local proxy to Cursor without opening router ports. Alternatively, you may use [Cloudflare Tunnel ](https://developers.cloudflare.com/tunnel/setup/ ).
2026-04-24 08:45:52 +00:00
2026-04-24 13:40:23 +00:00
Create an ngrok account, then visit ngrok's Dashboard: https://dashboard.ngrok.com

2026-04-24 08:45:52 +00:00
2026-04-24 10:42:59 +00:00
Then, install and authenticate ngrok once:
2026-04-24 08:45:52 +00:00
```bash
2026-04-24 10:42:59 +00:00
brew install ngrok
ngrok config add-authtoken < your-ngrok-token >
2026-04-24 08:45:52 +00:00
```
2026-04-24 10:42:59 +00:00
### Step 2: Add Cursor Custom Model
In Cursor, add the DeepSeek custom model and point it at this proxy:
2026-04-24 08:45:52 +00:00
2026-04-24 10:42:59 +00:00
- Model: `deepseek-v4-pro`
- API Key: your DeepSeek API key
- Base URL: your ngrok HTTPS URL with the `/v1` API version path
For example, if ngrok dashboard shows `https://example.ngrok-free.app` , use:
2026-04-24 08:45:52 +00:00
```text
2026-04-24 10:42:59 +00:00
https://example.ngrok-free.app/v1
2026-04-24 08:45:52 +00:00
```
2026-04-24 10:42:59 +00:00

2026-04-24 08:45:52 +00:00
2026-04-24 10:42:59 +00:00
Note: you can toggle the custom API on and off with:
2026-04-24 08:45:52 +00:00
2026-04-24 10:42:59 +00:00
- macOS: `Cmd+Shift+0`
- Windows/Linux: `Ctrl+Shift+0`
2026-04-24 08:45:52 +00:00
2026-04-24 10:42:59 +00:00
### Step 3: Start the Proxy Server
2026-04-24 08:45:52 +00:00
2026-04-24 10:42:59 +00:00
Install and run the proxy:
2026-04-24 08:45:52 +00:00
```bash
2026-04-24 13:40:23 +00:00
# Or, use your favourite Python env manager
2026-04-24 10:42:59 +00:00
conda create -n dcp python=3.10 -y
conda activate dcp
2026-04-24 10:53:24 +00:00
# Install
2026-04-24 13:40:23 +00:00
git clone https://github.com/yxlao/deepseek-cursor-proxy.git
cd deepseek-cursor-proxy
2026-04-24 10:42:59 +00:00
pip install -e .
2026-04-24 10:53:24 +00:00
2026-04-24 13:40:23 +00:00
# Run
2026-04-24 10:53:24 +00:00
deepseek-cursor-proxy
2026-04-24 08:45:52 +00:00
```
2026-04-24 10:42:59 +00:00
The proxy creates `~/.deepseek-cursor-proxy/config.yaml` on first run.
2026-04-24 08:45:52 +00:00
2026-04-24 10:42:59 +00:00
This will also print the ngrok public URL. If it differs from the one in Cursor, update it in Cursor's Base URL field.
2026-04-24 08:45:52 +00:00
2026-04-24 10:42:59 +00:00
### Step 4: Chat with DeepSeek in Cursor
2026-04-24 08:45:52 +00:00
2026-04-24 10:42:59 +00:00
Select `deepseek-v4-pro` in Cursor and use chat or agent mode as usual.
2026-04-24 08:45:52 +00:00
2026-04-24 10:42:59 +00:00

2026-04-24 08:45:52 +00:00
2026-04-24 13:40:23 +00:00
## Debugging
Run with verbose output:
```bash
deepseek-cursor-proxy --verbose
```
2026-04-24 08:45:52 +00:00
Run without ngrok for local curl testing:
```bash
PROXY_NGROK=false deepseek-cursor-proxy --port 9000 --verbose
```
2026-04-24 10:42:59 +00:00
Use another config file:
2026-04-24 08:45:52 +00:00
```bash
2026-04-24 10:42:59 +00:00
deepseek-cursor-proxy --config ./dev.config.yaml
2026-04-24 08:45:52 +00:00
```
Run tests:
```bash
PYTHONPATH=src python -m unittest discover -s tests
```