- 访问 www.cursor.com 并完成注册登录(赠送 250 次快速响应,可通过删除账号再注册重置)
- 在浏览器中打开开发者工具(F12)
- 找到 应用-Cookies 中名为
WorkosCursorSessionToken的值并保存(相当于 openai 的密钥)
- 接口地址:
/v1/chat/completions - 请求方法:POST
- 认证方式:Bearer Token(使用 WorkosCursorSessionToken 的值,支持英文逗号分隔的 key 入参)
- 接口地址:
/v1/models - 请求方法:GET
- 接口地址:
/env-checksum - 请求方法:GET
- 接口地址:
/checksum - 请求方法:GET
- 接口地址:
/ - 请求方法:GET
- 接口地址:
/logs - 请求方法:GET
npm install
npm run start接口地址:
http://localhost:3000/v1/chat/completionshttp://localhost:3000/v1/modelshttp://localhost:3000/env-checksumhttp://localhost:3000/checksumhttp://localhost:3000/http://localhost:3000/logs
-
duplicate项目: huggingface链接
- 调整git项目: 如果你fork了项目,可以在Dockerfile中调整git地址,调整为你的git地址
- 调整接口地址:
因为huggingface的限制,似乎无法直接访问
/v1/chat/completions,所以在dockerfile中将接口调整为/proxy/v1/chat/completions。你可以根据需要调整。
RUN sed -i 's/\/v1\/chat\/completions/\/proxy\/v1\/chat\/completions/g' src/index.js -
配置环境变量(一定要配置,一直随机会封号24小时)
在你的space中,点击settings,找到
Variables and secrets,添加Variables- name:
X_CURSOR_CHECKSUM(注意大写) - value: 通过
/checksum接口获取的随机checksum
- name:
-
重新部署
点击
Factory rebuild,等待部署完成 -
接口地址(
Embed this Space中查看:Hugging Face Spaces的接口地址命名规则:
{username}-{space-name}.hf.space举例:如果用户名是test,空间名是cursor,则接口地址为:
https://test-cursor.hf.space/v1/models -
为了检测x-cursor-checksum是否设置成功,在接口中添加了日志记录,通过
/logs接口可以获取日志记录
- 请妥善保管您的 WorkosCursorSessionToken,不要泄露给他人
- 请在部署的项目中,将x-cursor-checksum的值设置到环境变量X_CURSOR_CHECKSUM中(注意大写),避免触发cursor的24小时多设备警告
- 本项目仅供学习研究使用,请遵守 Cursor 的使用条款
- cursor-api 基于该项目进行修改
- cursor (已删除) 基于该项目进行huggingface部署
MIT License