cursor-to-api
v0.1.0
Published
One-command launcher for cursor-api-proxy: .env, Windows agent detection, health UI
Maintainers
Readme
cursor-to-api
Use your Cursor subscription as a local OpenAI-compatible HTTP API.
This is a launcher and test UI around cursor-api-proxy. It fixes the pain points of running the proxy directly:
- Loads
CURSOR_API_KEYfrom.env(barenpx cursor-api-proxydoes not) - Auto-detects
agenton Windows (%LOCALAPPDATA%\cursor-agent\) - Sets safe defaults (
chat-only,force) so auth and trust work out of the box - Includes a browser test UI and
doctorcommand
Not official. Community tool. Uses your Cursor subscription quota, not a separate OpenAI key.
Quick start
Prerequisites
- Cursor CLI (
agentcommand) - Node.js 18+
- Cursor API Key — Cursor Settings → API Keys
Install
npm install -g cursor-to-api
# or try without install:
npx cursor-to-api doctorConfigure
cp .env.example .env
# edit .env — set CURSOR_API_KEY=crsr_....env is read from (first match wins):
- Current working directory
~/.cursor-to-api/.env- Package directory (development)
Run
cursor-to-api start # proxy + test UI → http://127.0.0.1:3456
cursor-to-api proxy # proxy only → http://127.0.0.1:8765/v1
cursor-to-api init --key crsr_xxx # write ~/.cursor-to-api/.env
cursor-to-api doctor # diagnose agent / key / proxyWindows: double-click scripts/start.cmd after cloning the repo.
Use from any OpenAI client
from openai import OpenAI
client = OpenAI(
base_url="http://127.0.0.1:8765/v1",
api_key="unused",
)
print(client.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "Hello"}],
).choices[0].message.content)Modes
Pass header X-Cursor-Mode: ask|plan|agent or set CURSOR_BRIDGE_MODE in env.
| Mode | Behavior |
|------|----------|
| ask | Read-only exploration |
| plan | Planning, read-only |
| agent | Full agent — can edit files and run commands |
Architecture
OpenAI client (SDK / LiteLLM / LangChain / …)
→ POST /v1/chat/completions
→ cursor-api-proxy (:8765) ← spawned by cursor-to-api
→ Cursor CLI (agent)
→ Cursor cloud modelscursor-to-api start also serves a test page on :3456 that proxies /api/proxy/* to the upstream API.
Why not npx cursor-api-proxy?
Direct npx cursor-api-proxy:
- Does not load
.env→ authentication fails - On Windows,
agentis often not on PATH → "Command not found: agent" - Workspace trust /
--forcemust be configured manually
cursor-to-api handles all of that before spawning the proxy.
Environment variables
| Variable | Default | Description |
|----------|---------|-------------|
| CURSOR_API_KEY | — | Required (or agent login) |
| CURSOR_BRIDGE_PORT | 8765 | Proxy listen port |
| TEST_SERVER_PORT | 3456 | Test UI port |
| CURSOR_BRIDGE_CHAT_ONLY_WORKSPACE | true if API key set | Sandbox workspace + --trust |
| CURSOR_BRIDGE_FORCE | true | Skip workspace trust prompt |
| CURSOR_AGENT_BIN | auto-detected | Override agent path |
See cursor-api-proxy docs for full bridge options.
Open source this repo
To publish as a standalone GitHub project:
cd tools/cursor-to-api
git init
git add .
git commit -m "Initial release: cursor-to-api launcher"
# create github.com/lzpzywoo/cursor-to-api
git remote add origin https://github.com/lzpzywoo/cursor-to-api.git
git push -u origin main
npm publish # after npm login; update package.json repository/authorUpdate repository and author in package.json before publishing.
License
MIT — see LICENSE.
Related
- cursor-api-proxy — the underlying OpenAI bridge
- Cursor CLI docs
- Cursor Skill — for Cursor users: paste API key, Agent runs setup (install guide)
