惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
A
About on SuperTechFans
NISL@THU
NISL@THU
V
Visual Studio Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
小众软件
小众软件
博客园 - Franky
罗磊的独立博客
The Cloudflare Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
MongoDB | Blog
MongoDB | Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Proofpoint News Feed
有赞技术团队
有赞技术团队
Hacker News - Newest:
Hacker News - Newest: "LLM"
Cyberwarzone
Cyberwarzone
C
CXSECURITY Database RSS Feed - CXSecurity.com
Project Zero
Project Zero
Security Latest
Security Latest
L
Lohrmann on Cybersecurity
AWS News Blog
AWS News Blog
The Hacker News
The Hacker News
I
Intezer
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
P
Privacy International News Feed
月光博客
月光博客
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园_首页
WordPress大学
WordPress大学
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Tor Project blog
博客园 - 三生石上(FineUI控件)
The Last Watchdog
The Last Watchdog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Hướng Dẫn Thiết Lập Reasoning Proxy DeepSeek V4-Pro với Cursor (2026)
Sebastian Petrus · 2026-05-25 · via DEV Community

Cắm DeepSeek V4-Pro vào Cursor bằng cấu hình OpenAI-compatible mặc định, bạn có thể gặp lỗi HTTP 400 ngay sau lần gọi công cụ đầu tiên. Nguyên nhân: V4-Pro trả về reasoning_content, Cursor loại bỏ trường này khỏi request tiếp theo, còn API DeepSeek lại yêu cầu chuỗi lý luận đó khi tiếp tục hội thoại có tool_calls. Cách xử lý thực tế là chạy proxy mã nguồn mở yxlao/deepseek-cursor-proxy để lưu và tiêm lại reasoning_content trước khi request được gửi tới DeepSeek.

Dùng thử Apidog ngay hôm nay

Tóm tắt

  • Cursor + DeepSeek V4-Pro có thể lỗi 400 vì Cursor bỏ qua reasoning_content.
  • deepseek-cursor-proxy đứng giữa Cursor và DeepSeek, lưu reasoning_content theo từng hội thoại và tiêm lại khi có request gọi công cụ.
  • Thiết lập gồm: cài proxy, cấu hình ngrok, chạy proxy, thêm model tùy chỉnh trong Cursor.
  • V4-Pro trong Cursor dùng giá API DeepSeek. Xem thêm: DeepSeek V4-Pro Giảm Giá 75% Vĩnh Viễn.

Vì sao cần proxy?

DeepSeek V4-Pro trả về hai phần trong response:

  • content: nội dung trả lời thông thường.
  • reasoning_content: chuỗi suy luận của model.

Với chat thông thường, bạn có thể không cần quan tâm tới reasoning_content. Nhưng với tool calling, DeepSeek yêu cầu request tiếp theo phải giữ lại reasoning_content tương ứng với hội thoại trước đó.

Cursor hiện dùng client theo schema OpenAI Chat Completions. Vì reasoning_content không nằm trong schema OpenAI chuẩn, Cursor loại bỏ trường này khi tạo request kế tiếp. Kết quả là DeepSeek nhận một hội thoại thiếu trạng thái suy luận và trả về HTTP 400.

Proxy giải quyết đúng phần bị thiếu: ghi nhớ reasoning_content mà Cursor đã bỏ qua, rồi tiêm lại vào request tiếp theo.

Proxy hoạt động như thế nào?

deepseek-cursor-proxy làm ba việc chính:

  1. Lắng nghe request chat từ Cursor trên cổng cục bộ, mặc định là 9000.
  2. Lưu reasoning_content từ response của DeepSeek V4-Pro.
  3. Khi Cursor gửi request tiếp theo, proxy tìm phần reasoning_content phù hợp và thêm lại trước khi chuyển tiếp tới DeepSeek.

Proxy cũng mở tunnel qua ngrok vì cấu hình custom model của Cursor yêu cầu HTTPS và thường không chấp nhận localhost.

Cache mặc định nằm tại:

~/.deepseek-cursor-proxy/reasoning_content.sqlite3

Proxy khóa cache bằng SHA-256 của prefix hội thoại đã chuẩn hóa, giúp các cuộc hội thoại song song không ghi đè lẫn nhau.

Điều kiện tiên quyết

Bạn cần:

  • Cursor 2.0 trở lên.
  • API key DeepSeek từ platform.deepseek.com.
  • Python 3.11 trở lên.
  • Tài khoản ngrok có authtoken.

Nếu chưa cài uv, xem tài liệu cài đặt uv. Với ngrok, xem hướng dẫn khởi động nhanh ngrok.

Bước 1: Cài đặt proxy

Cách nhanh nhất là dùng uv:

uv tool install deepseek-cursor-proxy

Hoặc dùng pip bằng cách clone repo:

git clone https://github.com/yxlao/deepseek-cursor-proxy.git
cd deepseek-cursor-proxy
pip install -e .

Kiểm tra lệnh đã có trong PATH:

deepseek-cursor-proxy --help

Bước 2: Cấu hình ngrok

Thêm authtoken ngrok:

ngrok config add-authtoken YOUR_NGROK_AUTHTOKEN

Nếu dùng gói miễn phí, mỗi lần restart có thể nhận một subdomain ngẫu nhiên mới. Nếu muốn URL ổn định hơn, tạo reserved domain trong dashboard ngrok và truyền vào proxy:

deepseek-cursor-proxy --ngrok-url https://your-reserved.ngrok-free.app

Bước 3: Khởi động proxy

Chạy với cấu hình mặc định:

deepseek-cursor-proxy

Output sẽ tương tự:

Starting deepseek-cursor-proxy
Tunnel: https://random-name.ngrok-free.app
Local:  http://127.0.0.1:9000
Cache:  /Users/you/.deepseek-cursor-proxy/reasoning_content.sqlite3

Một số flag hữu ích:

# Đổi cổng local
deepseek-cursor-proxy --port 9001

# In request/response để debug
deepseek-cursor-proxy --verbose

# Không mở ngrok tunnel
deepseek-cursor-proxy --no-ngrok

# Không hiển thị reasoning block trong Cursor
deepseek-cursor-proxy --no-display-reasoning

Giữ proxy chạy trong một terminal riêng. Cursor sẽ gọi proxy cho mỗi request tới model tùy chỉnh.

Bước 4: Thêm model tùy chỉnh trong Cursor

Trong Cursor, mở phần Settings → Models, sau đó thêm custom model.

Điền các trường:

  • Model name: deepseek-v4-pro
  • Base URL: URL ngrok kèm /v1

Ví dụ:

https://random-name.ngrok-free.app/v1

  • API key: API key DeepSeek của bạn, thường bắt đầu bằng sk-.

Proxy không có lớp xác thực riêng. Nó chuyển tiếp API key tới DeepSeek.

Nếu Cursor báo lỗi khi verify model, kiểm tra lại:

  • Proxy còn chạy không.
  • URL ngrok có đúng không.
  • Base URL có kết thúc bằng /v1 không.
  • Log proxy có nhận request từ Cursor không.

Bước 5: Kiểm tra bằng một tool call

Trong Cursor chat, chọn custom model vừa tạo và thử prompt buộc Cursor dùng tool:

“Mở README trong repo này, liệt kê mọi khối mã, và cho tôi biết khối nào thiếu gợi ý ngôn ngữ.”

Luồng đúng sẽ là:

  1. Cursor gửi message tới proxy.
  2. Proxy chuyển tiếp tới DeepSeek.
  3. DeepSeek trả về content, reasoning_contenttool_calls.
  4. Proxy lưu reasoning_content.
  5. Cursor chạy tool, ví dụ read_file.
  6. Cursor gửi request tiếp theo nhưng thiếu reasoning_content.
  7. Proxy tìm cache phù hợp, tiêm lại reasoning_content.
  8. DeepSeek chấp nhận request và trả về câu trả lời cuối cùng.

Nếu chạy proxy với --verbose, bạn sẽ thấy quá trình tiêm lại trong log.

Chi phí thực tế

V4-Pro trong Cursor dùng giá API DeepSeek, không dùng quota model mặc định của Cursor. Theo mức giá được nêu trong bài gốc:

Loại token Giá mỗi 1 triệu token
Đầu vào cache miss $0.435
Đầu vào cache hit $0.003625
Đầu ra $0.87

Ví dụ một ngày dùng nhiều:

  • 50 lượt chat.
  • Mỗi lượt khoảng 8.000 input token.
  • Mỗi lượt khoảng 1.500 output token.

Tính nhanh:

50 × 8.000 × $0.435 / 1.000.000 = $1.74 input, trường hợp xấu nhất
50 × 1.500 × $0.87 / 1.000.000 = $0.065 output

Nếu cache hit tốt cho phần prefix hệ thống và context, chi phí input có thể giảm đáng kể. Bài phân tích giá đầy đủ nằm ở DeepSeek V4-Pro Giảm Giá 75% Vĩnh Viễn.

Xem thêm:

Trải nghiệm V4-Pro trong Cursor

1. Reasoning token có thể hiển thị

Mặc định, proxy hiển thị reasoning của DeepSeek dưới dạng block markdown có thể thu gọn bằng <details>.

Nếu không muốn thấy phần này:

deepseek-cursor-proxy --no-display-reasoning

Suy luận vẫn diễn ra, chỉ phần hiển thị bị ẩn.

2. Tool call đầu tiên có thể chậm hơn

V4-Pro là model tư duy nên thường cần thêm vài giây trước tool call đầu tiên. Sau đó các request tiếp theo chạy bình thường.

3. Refactor nhiều file có thể tốt hơn

Với các tác vụ như đổi tên, thay đổi chữ ký hàm hoặc refactor dựa trên config, reasoning chain của V4-Pro có thể giúp model theo dõi dependency nhiều file tốt hơn.

Các hướng dẫn DeepSeek + Cursor khác:

Kiểm tra thiết lập DeepSeek bằng Apidog

Tích hợp Cursor chỉ kiểm tra đường đi từ Cursor. Nếu bạn dùng V4-Pro cho bot CI, backend agent hoặc plugin IDE riêng, bạn nên có bộ test API độc lập.

Giao diện Apidog hiển thị một yêu cầu và phản hồi API.

Với Apidog, bạn có thể tạo environment trỏ tới:

https://api.deepseek.com/v1

Sau đó nhập API key và schema OpenAI Chat Completion để:

  • Ghi lại response chuẩn từ V4-Pro và phát lại khi thay đổi prompt.
  • Validate tool_calls bằng JSON Schema.
  • So sánh V4-Pro và GPT-5.5 trên cùng một batch input.

Tải tại Apidog, import DeepSeek OpenAPI spec và bạn có thể dựng bàn test V4-Pro trong vài phút. Quy trình tương tự bài Cách sử dụng API DeepSeek V4.

Lỗi thường gặp

Lỗi 400 sau tool call đầu tiên

Đây là lỗi proxy được thiết kế để xử lý. Nếu vẫn gặp:

  • Kiểm tra proxy có đang chạy không.
  • Kiểm tra Cursor có trỏ đúng ngrok URL không.
  • Đảm bảo Base URL kết thúc bằng /v1.
  • Chạy proxy với --verbose để xem request có đi qua proxy không.

Ngrok tunnel liên tục đổi URL

Gói miễn phí có thể đổi URL sau khi restart. Nếu Cursor verify thành công rồi lỗi sau đó, có thể URL đã đổi.

Cách xử lý:

deepseek-cursor-proxy --ngrok-url https://your-reserved.ngrok-free.app

Reasoning hiển thị trùng lặp

Có thể bạn đang chạy nhiều instance proxy dùng chung SQLite cache.

Cách xử lý:

pkill -f deepseek-cursor-proxy
rm ~/.deepseek-cursor-proxy/reasoning_content.sqlite3
deepseek-cursor-proxy

Cache hit thấp

Prompt cache của DeepSeek cần prefix giống nhau theo byte. Nếu Cursor chèn timestamp hoặc session ID vào system prompt, cache hit sẽ giảm.

Bạn có thể:

  • Giảm nội dung biến đổi trong system prompt.
  • Chuyển nội dung động sang user message.
  • Chấp nhận chi phí cao hơn cho các phiên nhiều context.

Cursor báo “model not found”

Tên model trong Cursor phải là model DeepSeek hợp lệ. Ví dụ:

deepseek-v4-pro
deepseek-v4-flash
deepseek-v3-2-pro
deepseek-r1-1

Proxy không dịch tên model. Nó chuyển tiếp nguyên chuỗi tới DeepSeek.

Nếu không muốn dùng proxy

Bạn có hai lựa chọn chính:

1. Dùng V4-Flash

deepseek-v4-flash không phải model tư duy và không trả về reasoning_content, nên Cursor có thể gọi trực tiếp mà không cần proxy. Đổi lại, bạn mất khả năng reasoning chain của V4-Pro.

2. Dùng IDE agent có hỗ trợ reasoning model

Một số công cụ như Cline, Continue hoặc plugin IDE AI khác có thể xử lý reasoning_content tự nhiên hơn trong tool calling.

Xem thêm: Trợ lý mã hóa mã nguồn mở tốt nhất năm 2026: các lựa chọn thay thế Cursor miễn phí.

Các tích hợp model khác với Cursor:

Câu hỏi thường gặp

Vì sao Cursor chưa hỗ trợ DeepSeek V4-Pro trực tiếp?

Cursor dùng schema OpenAI Chat Completions. reasoning_content là phần mở rộng riêng của DeepSeek, không thuộc schema OpenAI chuẩn. Cursor cần xử lý riêng cho provider này để giữ lại trường đó qua các tool call.

Proxy có hoạt động với DeepSeek R1 hoặc V3.2 không?

Có, miễn là model DeepSeek đó trả về reasoning_content và yêu cầu trường này trong request tiếp theo khi dùng tool calling.

Proxy có an toàn để chạy lâu dài không?

Có, nhưng lưu ý SQLite cache chứa nội dung reasoning thô từ phiên làm việc của bạn. Nếu dùng chung máy hoặc nhiều user, hãy giới hạn quyền truy cập thư mục cache.

Có thể dùng proxy không cần ngrok không?

Có:

deepseek-cursor-proxy --no-ngrok

Khi đó proxy chỉ mở:

http://127.0.0.1:9000

Tuy nhiên UI custom model của Cursor thường yêu cầu HTTPS, nên đa số trường hợp vẫn cần ngrok, Cloudflare Tunnel hoặc Tailscale Funnel.

Proxy thêm bao nhiêu độ trễ?

Proxy chỉ thêm một network hop cục bộ, một lần đọc SQLite và thao tác JSON nhỏ. Độ trễ thường không phải nút thắt cổ chai. Phần chậm hơn chủ yếu đến từ reasoning của model và tunnel HTTPS.

Proxy lưu cache theo cách nào?

Proxy băm prefix hội thoại bằng SHA-256, sau đó ánh xạ hash đó tới reasoning_content từ response DeepSeek gần nhất. Request tiếp theo được băm lại để tìm cache phù hợp. Cách này tránh việc hai hội thoại tương tự nhau làm nhiễu cache của nhau.

Kết luận

Vấn đề khi dùng DeepSeek V4-Pro trong Cursor không nằm ở khả năng model mà ở contract API: DeepSeek cần reasoning_content, còn Cursor bỏ trường đó khi tool calling. deepseek-cursor-proxy vá đúng khoảng trống này bằng cách lưu và tiêm lại reasoning state.

Ba bước nên làm tiếp theo:

  1. Cài proxy và test trên vài pull request hoặc task refactor thật trong repo của bạn.
  2. Kiểm tra system prompt của Cursor để giảm nội dung động làm hỏng prompt cache.
  3. Dùng Apidog để tạo bộ regression test cho endpoint DeepSeek trước khi đưa vào workflow production.