Cursor在内网环境配置自定义DeepSeek API

关键字

Cursor、DeepSeek、API配置、内网代理、HTTP/2


背景环境

使用Cursor集成环境开发程序。但是我使用公司的内网并不能使用cursor自带的模型,于是我就想使用DeepSeek官方的API服务。

环境:Windows 11系统


解决过程

网络检测

首先进行环境检测,在控制台中根据DeepSeek的API curl命令,检测网络是否通畅:

shell 复制代码
C:\Users\wangq>curl https://api.deepseek.com
curl: (28) Failed to connect to api.deepseek.com port 443 after 21087 ms: Could not connect to server

结果:不能访问服务器

但是网页版本就可以访问,环境区别就在于浏览器走了代理(内网环境很正常)。

首先配置代理:

shell 复制代码
C:\Users\wangq>set http_proxy=http://proxy-server:port
C:\Users\wangq>set https_proxy=http://proxy-server:port
C:\Users\wangq>curl https://api.deepseek.com
{
  "event_id": "30-inst-5-20250318161115-8e303def",
  "error_msg": "Not Found. Please check the configuration."
}

说明我的网络可以访问到DeepSeek的API


Cursor配置DeepSeek

  1. 添加自定义模型

  2. 设置DeepSeek的API Key

    • 这里使用OpenAI API Key,Base URL设置:https://api.deepseek.com
    • 当然也可以使用其他平台的api,比如阿里百炼,硅基流动等等。
  3. 其他模型冲突问题

    • 暂时关闭其他自带模型,只留自定义的模型。
  4. 配置Cursor代理

    • 在VS Code Setting中搜索proxy
    • 通过修改配置的方式修改代理

在配置中添加以下代码:

json 复制代码
"http.proxy": "http://proxy-server:port",
"https.proxy": "https://proxy-server:port",
"http.proxyStrictSSL": false

按理说到这一步就可以正常访问DeepSeek的API了,但是还是不行

  1. 禁用Http2
    • 勾选Disable Http2配置
    • 成功解决问题

总结

  1. 内网环境特殊性
    • 公司代理可能对HTTP/2流量有特殊处理
    • 公网环境下不需要此配置
  2. 问题排查思路
    • 从基础网络连通性开始
    • 逐步排查代理配置
    • 最后考虑协议层问题
  3. 经验教训
    • 内网环境配置需要更多调试
    • 协议级别的配置可能影响API调用
相关推荐
CODER03045 天前
ubuntu22.04部署完整deepseek局域网web服务全过程(RTX5090安装黑屏+web端多人并发)
pytorch·webui·ubuntu22.04·ollama·deepseek·rtx5090·自然语言模型
华科大胡子5 天前
DeepSeek Harness 开源贡献手记:从入门到合入主线
deepseek
Together_CZ6 天前
DeepSeek-V4.1-Flash:Pushing the Limits of KV Cache Compression——推动 KV 缓存压缩的极限
缓存·llm·compression·kv cache·deepseek·v4.1-flash·推动 kv 缓存压缩的极限
roamingcode6 天前
DeepSeek Harness 记忆召回插件的“PRD”设计拆解
agent·memory·deepseek·harness·dsh·dsh-plugin
前端小白乘风6 天前
VS Code 终于能连微信了!发现一个硬核开源神仙插件:WeChat AHP
微信·visual studio code·deepseek
weixin_6687 天前
Cursor 插件使用说明:Linear 与 Figma
人工智能·cursor
今夕资源网7 天前
把 DeepSeek 网页版变成能操作本地项目的 AI Agent:Cuckoo Code 使用指南 GitHub开源
开源·github·deepseek
gs801408 天前
【大模型工程实践】LLM 提效降本指南:基于 Context Caching 与专属 Endpoint 的架构优化
deepseek·大模型缓存
一个金牛座的前端8 天前
AI 写前端,优化的是演示,不是交付
前端·ai·cursor
ss2738 天前
DeepSeek Harness v0.1.6-alpha.2:文件审阅、Office 预览、插件管理,Web 端越来越像 IDE 了
deepseek·dsh