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
- Docker Compose Deployment (recommended)
- Run the following command in the terminal:
bash
docker compose up -d
- Run the following command in the terminal:
- Docker Deployment
- Run the following command in the terminal:
bash
docker run -d --name cursor-api -p 3000:3000 waitkafuka/cursor-api:latest
- Run the following command in the terminal:
- PM2 deployment
- Run the following command in the terminal:
bash
cd cursor-api
npm install
pm2 start ecosystem.config.js
- Run the following command in the terminal:
Guidelines for use
- 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.
- Configure the interface
- Interface Address:
http://localhost:3000/v1/chat/completions
- Request method: POST
- Authentication method: Bearer Token (using the value of the WorkosCursorSessionToken)
- Interface Address:
- Request format
{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "user", "content": "Hello, how can I use Cursor API?
"content": "Hello, how can I use Cursor API?"
}
]
}
- response format
{
"id": "chatcmpl-123",
"object": "chat.completion",
"model": "gpt-3.5-turbo", "choices": [
"choices": [
{
"index": 0, "message": {
"message": {
"role": "assistant", "content": "You can use Cursor API by following the installation and
"content": "You can use the Cursor API by following the installation and usage guidelines provided in the documentation."
}, "finish_reason": "finish_reason".
"finish_reason": "stop"
}
}, "finish_reason": "stop" }
"usage": {
"completion_tokens": 12, "total_tokens": 21, "completion_tokens": 20
"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
4. restart the container with the new checksum value
docker run -d --name cursor-api -e x-cursor-checksum=replace with requested checksum value -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