Convert the Cursor Editor to an OpenAI API interface service.
This project provides a proxy service that converts the AI chat of the Cursor Editor into an OpenAPI API, allowing you to reuse the LLM of the Cursor in other applications.
- Visit Cursor and register a account.
- 150 fast premium requests are given, which can be reset by deleting the account and then registering again
- Suggest to use gmail/outlook email, some temp emails have been disabled by Cursor.
- Log in and open the developer tool in the browser (F12).
- Find the cookie value named
WorkosCursorSessionTokenin Application-Cookies and save it (The value starts withuser_).
docker run -d --name cursor-to-openai -p 3010:3010 ghcr.io/jiuz-chn/cursor-to-openai:latest
npm install
npm run start
-
Get models
- Url:
http://localhost:3010/v1/models - Request:
GET - Authentication:
Bearer Token(The value ofWorkosCursorSessionToken,supports comma-separated values)
- Url:
-
Chat completion
- Url:
http://localhost:3010/v1/chat/completions - Request:
POST - Authentication:
Bearer Token(The value ofWorkosCursorSessionToken,supports comma-separated values)
- Url:
for the response body, please refer to the OpenAI interface
from openai import OpenAI
client = OpenAI(api_key="{{{Replace by the WorkosCursorSessionToken value of your account. It starts with user_...}}}",
base_url="http://localhost:3010/v1")
response = client.chat.completions.create(
model="claude-3-7-sonnet",
messages=[
{"role": "user", "content": "Hello."},
],
stream=False
)
print(response.choices)
- Please keep your WorkosCursorSessionToken properly and do not disclose it to others
- This project is for study and research only, please abide by the Cursor Terms of Use
- This project is based on cursor-api(by zhx47).
- This project integrates the commits in cursor-api(by lvguanjun).