[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-1988":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":37,"readmeContent":38,"aiSummary":39,"trendingCount":16,"starSnapshotCount":16,"syncStatus":14,"lastSyncTime":40,"discoverSource":41},1988,"deepseek-cursor-proxy","yxlao\u002Fdeepseek-cursor-proxy","yxlao","Fixes missing reasoning_content for DeepSeek V4","",null,"Python",408,59,2,5,0,9,16,207,27,81.33,"MIT License",false,"main",[26,27,28,29,30,31,32,33,34,35,36],"byok","cursor","deepseek","deepseek-reasoner","deepseek-v4","deepseek-v4-flash","deepseek-v4-pro","must-be-passed-back","proxy","reasoning","reasoning-content","2026-06-12 04:00:12","\u003C!-- \u003Ch1>\u003Cimg src=\"assets\u002Flogo.png\" width=\"120\" alt=\"deepseek-cursor-proxy logo\" style=\"vertical-align: middle;\">&nbsp;DeepSeek Cursor Proxy\u003C\u002Fh1> -->\n\u003Ch1 align=\"center\">\u003Cimg src=\"assets\u002Flogo.png\" width=\"150\" alt=\"deepseek-cursor-proxy logo\">\u003Cbr>DeepSeek Cursor Proxy\u003C\u002Fh1>\n\nA compatibility proxy that connects Cursor to DeepSeek thinking models (`deepseek-v4-pro` and `deepseek-v4-flash`) by properly handling the `reasoning_content` field for DeepSeek tool-call reasoning API requests.\n\nThis proxy can also help **other applications and coding agents** beyond Cursor that run into the same missing `reasoning_content` issue with DeepSeek's thinking-mode API. Just point their API base URL at the proxy.\n\n## What It Does\n\n- ✅ Injects `reasoning_content` into outgoing tool-call requests since Cursor does not include the field, restoring previously cached reasoning from regular and streamed DeepSeek responses. See [DeepSeek docs](https:\u002F\u002Fapi-docs.deepseek.com\u002Fguides\u002Fthinking_mode#tool-calls) for more details.\n- ✅ Displays DeepSeek's thinking tokens in Cursor by forwarding them into Cursor-visible collapsible Markdown `\u003Cdetails>\u003Csummary>Thinking\u003C\u002Fsummary>...\u003C\u002Fdetails>` blocks.\n- ✅ Starts an ngrok tunnel so Cursor can reach the local proxy through a public HTTPS URL.\n- ✅ Provides other compatibility fixes to make DeepSeek models run well in Cursor.\n\n## Why This Exists\n\nThis repository fixes the following Cursor + DeepSeek tool-call error with thinking mode enabled:\n\n\u003Cimg src=\"assets\u002Ferror_400.png\" width=\"600\" alt=\"Error 400 - reasoning_content must be passed back\">\n\n```txt\n⚠️ Connection Error\nProvider returned error:\n{\n  \"error\": {\n    \"message\": \"The reasoning_content in the thinking mode must be passed back to the API.\",\n    \"type\": \"invalid_request_error\",\n    \"param\": null,\n    \"code\": \"invalid_request_error\"\n  }\n}\n```\n\n## Usage\n\n### Step 1: Set Up ngrok\n\nCursor blocks non-public API URLs such as `localhost`, so the proxy needs a public HTTPS URL. [ngrok](https:\u002F\u002Fngrok.com\u002F) can expose the local proxy to Cursor without opening router ports. Alternatively, you may use [Cloudflare Tunnel](https:\u002F\u002Fdevelopers.cloudflare.com\u002Ftunnel\u002Fsetup\u002F). Create an ngrok account and visit [ngrok's dashboard](https:\u002F\u002Fdashboard.ngrok.com). You will find the authtoken and public URL there.\n\nIf you're using this proxy with another application that allows localhost API endpoints, you can skip this step entirely by setting `ngrok: false` in `~\u002F.deepseek-cursor-proxy\u002Fconfig.yaml`, or by starting the proxy with `--no-ngrok`.\n\n\u003Cimg src=\"assets\u002Fngrok_dashboard.png\" width=\"600\" alt=\"ngrok dashboard\">\n\nThen, install and authenticate ngrok once:\n\n```bash\nbrew install ngrok\nngrok config add-authtoken \u003Cyour-ngrok-token>\n```\n\n### Step 2: Install and Start the Proxy Server\n\n**Run with UV**\n\n```bash\n# Install uv if you don't have it\ncurl -LsSf https:\u002F\u002Fastral.sh\u002Fuv\u002Finstall.sh | sh\n\n# Install and start\n# uv installs the program in .venv\u002F under the repo local folder\ngit clone https:\u002F\u002Fgithub.com\u002Fyxlao\u002Fdeepseek-cursor-proxy.git\ncd deepseek-cursor-proxy\nuv run deepseek-cursor-proxy\n```\n\n**Run with Conda**\n\n```bash\n# Install conda if you don't have it\n# Follow: https:\u002F\u002Fwww.anaconda.com\u002Fdocs\u002Fgetting-started\u002Fminiconda\u002Finstall\u002Foverview\n\n# Install\nconda create -n dcp python=3.10 -y\nconda activate dcp\ngit clone https:\u002F\u002Fgithub.com\u002Fyxlao\u002Fdeepseek-cursor-proxy.git\ncd deepseek-cursor-proxy\npip install -e .\n\n# Start\ndeepseek-cursor-proxy\n```\n\nWhen ngrok is enabled, `deepseek-cursor-proxy` will print the ngrok public URL on start. If it differs from the one in Cursor, update it in Cursor's Base URL field.\n\nIf you use a **reserved ngrok endpoint or your own domain** (instead of a URL assigned by ngrok), pass it through to the ngrok agent as `--url=…`. Set `ngrok_url` in `~\u002F.deepseek-cursor-proxy\u002Fconfig.yaml` or use `--ngrok-url` on the command line (see `ngrok http --help`). Example:\n\n```yaml\nngrok: true\nngrok_url: https:\u002F\u002Fyour-subdomain.ngrok.dev\n```\n\n```bash\ndeepseek-cursor-proxy --ngrok-url https:\u002F\u002Fyour-subdomain.ngrok.dev\n```\n\nOn the first run, `deepseek-cursor-proxy` will create:\n\n- `~\u002F.deepseek-cursor-proxy\u002Fconfig.yaml`: the configuration file\n- `~\u002F.deepseek-cursor-proxy\u002Freasoning_content.sqlite3`: the reasoning content cache\n\nPersistent settings live in `~\u002F.deepseek-cursor-proxy\u002Fconfig.yaml`. You can also override the config with command-line flags, for example:\n\n```bash\n# Hide thinking tokens displaying in Cursor UI\ndeepseek-cursor-proxy --no-display-reasoning\n\n# Show full incoming and outgoing requests\ndeepseek-cursor-proxy --verbose\n\n# Run without ngrok (run on localhost directly)\ndeepseek-cursor-proxy --no-ngrok\n\n# Use a fixed ngrok public URL (reserved endpoint \u002F custom domain)\ndeepseek-cursor-proxy --ngrok-url https:\u002F\u002Fyour-subdomain.ngrok.dev\n\n# Use a different local port\ndeepseek-cursor-proxy --port 9000\n```\n\n### Step 3: Add Cursor Custom Model\n\nIn Cursor, add the DeepSeek custom model and point it at this proxy:\n\n- Model: `deepseek-v4-pro`\n- API Key: your DeepSeek API key\n- Base URL: your ngrok HTTPS URL with the `\u002Fv1` API version path\n\nThe proxy respects the DeepSeek model name Cursor sends, such as `deepseek-v4-pro` or `deepseek-v4-flash`. The `model` field in `config.yaml` is used as a fallback only when a request does not include a model.\n\nFor example, if ngrok dashboard shows `https:\u002F\u002Fexample.ngrok-free.dev`, use:\n\n```text\nhttps:\u002F\u002Fexample.ngrok-free.dev\u002Fv1\n```\n\n\u003Cimg src=\"assets\u002Fcursor_config.png\" width=\"600\" alt=\"Cursor settings for DeepSeek through the proxy\">\n\nNote: you can toggle the custom API on and off with:\n\n- macOS: `Cmd+Shift+0`\n- Windows\u002FLinux: `Ctrl+Shift+0`\n\n### Step 4: Chat with DeepSeek in Cursor\n\nSelect `deepseek-v4-pro` in Cursor and use chat or agent mode as usual.\n\n\u003Cimg src=\"assets\u002Fcursor_chat.png\" width=\"480\" alt=\"Chatting with DeepSeek in Cursor\">\n\n## How It Works\n\n- **Core fix:** DeepSeek [thinking-mode tool calls](https:\u002F\u002Fapi-docs.deepseek.com\u002Fguides\u002Fthinking_mode#tool-calls) require the complete **multi-round** `reasoning_content` chain to be sent back in later requests. Cursor omits that field, causing a 400 error. The proxy (`Cursor -> ngrok -> proxy -> DeepSeek API`) stores DeepSeek's original `reasoning_content` and patches missing blocks back into outgoing tool-call history.\n- **Multi-conversation isolation:** To avoid collisions across concurrent conversations, the proxy scopes cache keys by a SHA-256 hash of the canonical conversation prefix (roles, content, and tool calls, excluding `reasoning_content`) plus the upstream model, configuration, and an API-key hash. Different threads get different scopes, so reused tool-call IDs do not collide. Byte-identical cloned histories produce identical scopes.\n- **Context caching compatibility:** The proxy preserves compatibility by never injecting synthetic thread IDs, timestamps, or cache-control messages. It restores `reasoning_content` as the exact original string, so repeated prefixes remain intact for [DeepSeek context cache](https:\u002F\u002Fapi-docs.deepseek.com\u002Fguides\u002Fkv_cache). Cache hit rates are logged in the terminal output.\n- **Additional compatibility fixes:** Beyond reasoning repair, the proxy converts legacy `functions`\u002F`function_call` fields to `tools`\u002F`tool_choice`, preserves required and named tool-choice semantics, normalizes `reasoning_effort` aliases, strips mirrored thinking display blocks from assistant content, flattens multi-part content arrays to plain text, and mirrors `reasoning_content` into Cursor-visible Markdown details blocks.\n\n## Development\n\nRun unit tests:\n\n```bash\nuv run python -m unittest discover -s tests\n```\n\nRun pre-commit hooks (code formatting and linting):\n\n```bash\nuv sync --dev\nuv run pre-commit run --all-files\n```\n\n## Debugging\n\nRun with verbose output:\n\n```bash\ndeepseek-cursor-proxy --verbose\n```\n\nRun without ngrok for local curl testing:\n\n```bash\ndeepseek-cursor-proxy --no-ngrok --port 9000 --verbose\n```\n\nCapture full structured request traces for debugging:\n\n```bash\ndeepseek-cursor-proxy --verbose --trace-dir .\u002Ftrace-dumps\n```\n\nUse another config file:\n\n```bash\ndeepseek-cursor-proxy --config .\u002Fdev.config.yaml\n```\n\nClear the local reasoning cache:\n\n```bash\ndeepseek-cursor-proxy --clear-reasoning-cache\n```\n","DeepSeek Cursor Proxy 是一个兼容性代理，旨在解决Cursor与DeepSeek思维模型（如deepseek-v4-pro和deepseek-v4-flash）连接时因缺少`reasoning_content`字段而引发的问题。其核心功能包括向工具调用请求中注入`reasoning_content`以恢复之前缓存的推理内容、在Cursor中显示DeepSeek的思考令牌，并通过ngrok隧道提供公共HTTPS URL以便Cursor访问本地代理。此外，该代理还提供了其他兼容性修复措施来优化DeepSeek模型在Cursor中的运行表现。此项目适用于任何需要与DeepSeek思维模式API交互但遇到相同问题的应用程序或编码代理场景。","2026-06-11 02:47:14","CREATED_QUERY"]