DeepSeek Cursor Proxy with tool schema normalization
 
Go to file
Yixing Lao c238a40045
refactor(config): migrate to yaml and forward auth (#3)
2026-04-24 18:42:59 +08:00
.cursor/rules feat(proxy): initial DeepSeek Cursor proxy implementation (#1) 2026-04-24 16:45:52 +08:00
assets refactor(config): migrate to yaml and forward auth (#3) 2026-04-24 18:42:59 +08:00
src/deepseek_cursor_proxy refactor(config): migrate to yaml and forward auth (#3) 2026-04-24 18:42:59 +08:00
tests refactor(config): migrate to yaml and forward auth (#3) 2026-04-24 18:42:59 +08:00
.gitignore feat(proxy): initial DeepSeek Cursor proxy implementation (#1) 2026-04-24 16:45:52 +08:00
.pre-commit-config.yaml feat(proxy): initial DeepSeek Cursor proxy implementation (#1) 2026-04-24 16:45:52 +08:00
LICENSE Initial commit 2026-04-24 16:21:44 +08:00
README.md refactor(config): migrate to yaml and forward auth (#3) 2026-04-24 18:42:59 +08:00
config.example.yaml refactor(config): migrate to yaml and forward auth (#3) 2026-04-24 18:42:59 +08:00
pyproject.toml refactor(config): migrate to yaml and forward auth (#3) 2026-04-24 18:42:59 +08:00

README.md

deepseek-cursor-proxy

Compatibility proxy connecting Cursor to DeepSeek thinking models (deepseek-v4-pro and deepseek-v4-flash).

What It Does

  • Caches DeepSeek reasoning_content from regular and streamed responses, then restores it on later tool-call turns when Cursor omits it. See DeepSeek docs 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.
  • Starts an ngrok tunnel so Cursor can reach the local proxy.
  • Provides other compatibility fixes to make DeepSeek models run well in Cursor.

Why This Exists

This repository fixes the following Cursor + DeepSeek tool-call error with thinking mode enabled:

Error 400 - reasoning_content must be passed back

⚠️ Connection Error
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"
  }
}

Usage

Step 1: Set Up ngrok

Create an ngrok account, visit ngrok's Dashboard: https://dashboard.ngrok.com

ngrok dashboard showing the public URL

Then, install and authenticate ngrok once:

brew install ngrok
ngrok config add-authtoken <your-ngrok-token>

Step 2: Add Cursor Custom Model

In Cursor, add the DeepSeek custom model and point it at this proxy:

  • 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:

https://example.ngrok-free.app/v1

Cursor settings for DeepSeek through the proxy

Note: you can toggle the custom API on and off with:

  • macOS: Cmd+Shift+0
  • Windows/Linux: Ctrl+Shift+0

Step 3: Start the Proxy Server

Install and run the proxy:

conda create -n dcp python=3.10 -y
conda activate dcp
pip install -e .
deepseek-cursor-proxy --verbose

The proxy creates ~/.deepseek-cursor-proxy/config.yaml on first run.

This will also print the ngrok public URL. If it differs from the one in Cursor, update it in Cursor's Base URL field.

Step 4: Chat with DeepSeek in Cursor

Select deepseek-v4-pro in Cursor and use chat or agent mode as usual.

Chatting with DeepSeek in Cursor

Debugging and Development

Run without ngrok for local curl testing:

PROXY_NGROK=false deepseek-cursor-proxy --port 9000 --verbose

Use another config file:

deepseek-cursor-proxy --config ./dev.config.yaml

Run tests:

PYTHONPATH=src python -m unittest discover -s tests