AI Personal Learning
and practical guidance
CyberKnife Drawing Mirror

Cursor2API: Converting the AI capabilities of the Cursor editor to an OpenAI-compatible interface service

General Introduction

Cursor API is an open source project that aims to convert the AI capabilities of the Cursor editor into an interface service compatible with the OpenAI API. Through this project, users can reuse Cursor's AI capabilities in other applications, thus realizing a wider range of application scenarios. The project provides a variety of deployment methods, including Docker, Docker Compose and PM2, etc., which is convenient for users to choose and use according to their own needs.The Cursor API not only supports the basic dialog interface, but also provides a detailed interface description and usage guide to help users get started quickly. Supplementarycursor-apiThe

For learning purposes only, Cursor2API has more problems than it can stabilize.

 

Function List

  • Converting the AI capabilities of the Cursor editor to an OpenAI-compatible interface
  • Supports multiple deployment methods: Docker, Docker Compose, PM2
  • Provide detailed interface descriptions and usage guidelines
  • Support for Basic Dialog Interface
  • Compatible with multiple AI models

 

Using Help

Installation process

  1. Docker Compose Deployment (recommended)
    • Run the following command in the terminal: bash
      docker compose up -d
  2. Docker Deployment
    • Run the following command in the terminal: bash
      docker run -d --name cursor-api -p 3000:3000 waitkafuka/cursor-api:latest
  3. PM2 deployment
    • Run the following command in the terminal: bash
      cd cursor-api
      npm install
      pm2 start ecosystem.config.js

Guidelines for use

  1. Get WorkosCursorSessionToken
    • Visit the Cursor website and complete the registration login.
    • Open Developer Tools in your browser (F12), find the value named WorkosCursorSessionToken in Application-Cookies and save it.
  2. Configure the interface
    • Interface Address:http://localhost:3000/v1/chat/completions
    • Request method: POST
    • Authentication method: Bearer Token (using the value of the WorkosCursorSessionToken)
  3. Request format
   {
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "user",
"content": "Hello, how can I use Cursor API?"
}
]
}
  1. response format
   {
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652280,
"model": "gpt-3.5-turbo",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "You can use Cursor API by following the installation and usage guidelines provided in the documentation."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}

caveat

  • Please keep your WorkosCursorSessionToken safe and do not disclose it to others.
  • This project is for study and research use only, please follow Cursor's terms of use.

 

Cursor-API Checksum Update Tutorial

This document will guide you on how to update the checksum value for Cursor-API.

update step

1. Decommissioning of existing packagings

docker stop cursor-api

2. Deletion of old packagings

docker rm cursor-api

3. Get the new checksum value

New checksum (expiring soon)

4. restart the container with the new checksum value

docker run -d --name cursor-api -e x-cursor-checksum=替换为请求的checksum值 -p 3000:3000 zhx47/cursor-api:latest

Validating Deployment

Once the update is complete, you can verify the container status using the following command:

docker ps | grep cursor-api

View updated checksum value command:

docker exec cursor-api env | grep x-cursor-checksum
May not be reproduced without permission:Chief AI Sharing Circle " Cursor2API: Converting the AI capabilities of the Cursor editor to an OpenAI-compatible interface service
en_USEnglish