cursor-openai-api
v0.0.2
Published
Standalone CLI that serves Cursor API as OpenAI-compatible
Downloads
26
Readme
Cursor OpenAI API
A standalone CLI that serves Cursor's API as an OpenAI-compatible endpoint.
Features
- OAuth authentication with Cursor
- OpenAI-compatible
/v1/chat/completionsendpoint - Automatic model discovery from your Cursor account
- Tool calling support
- Streaming responses
Docker
# Pull the image
docker pull ghcr.io/egoist/cursor-openai-api:latest
# Run
docker run -p 3000:3000 \
-v ~/.config/cursor-openai-api:/home/appuser/.config/cursor-openai-api \
ghcr.io/egoist/cursor-openai-api:latest login
docker run -p 3000:3000 \
-v ~/.config/cursor-openai-api:/home/appuser/.config/cursor-openai-api \
ghcr.io/egoist/cursor-openai-api:latest serveCredentials are stored in ~/.config/cursor-openai-api/credentials.json.
Commands
cursor-openai-api login
Authenticate with Cursor via OAuth browser flow.
cursor-openai-api logincursor-openai-api logout
Clear stored credentials.
cursor-openai-api logoutcursor-openai-api whoami
Check authentication status.
cursor-openai-api whoamicursor-openai-api models
List available Cursor models.
cursor-openai-api modelscursor-openai-api serve
Start the OpenAI-compatible proxy server. Uses PORT environment variable (default: 3000).
PORT=3000 cursor-openai-api serveThe server exposes:
POST /v1/chat/completions- Chat completions endpointGET /v1/models- List available models
cursor-openai-api status
Check if the proxy server is running.
cursor-openai-api statusUsage with OpenAI SDK
import OpenAI from "openai"
const client = new OpenAI({
apiKey: "cursor", // any non-empty string
baseURL: "http://localhost:3000/v1",
})
const chat = await client.chat.completions.create({
model: "claude-4-sonnet",
messages: [{ role: "user", content: "Hello!" }],
})Requirements
- Bun or Node.js 18+
- macOS, Linux, or WSL
- A Cursor account with API access
Development
# Install dependencies
bun install
# Run without building
bun run src/cli.ts serve
# Build for production
bun run buildPublishing
Push a tag to trigger the Docker build:
git tag v0.0.1
git push origin v0.0.1