Skip to content

Repository files navigation

CliCursorProxyAPI

Universal Cursor Proxy Gateway — Standalone OpenAI-compatible proxy for Cursor Pro subscription models.

Forked from Nomadcxx/opencode-cursor with a different focus: standalone proxy instead of OpenCode plugin.

License: ISCPort: 32124

What Is This?

A standalone HTTP proxy that provides OpenAI-compatible REST API access to Cursor Pro models. Works with any OpenAI-compatible client (curl, scripts, custom tools) without requiring OpenCode.

This vs Nomadcxx/opencode-cursor:

CliCursorProxyAPINomadcxx/opencode-cursor
PurposeStandalone proxy serverOpenCode plugin
Client supportAny OpenAI-compatible clientOpenCode only
DependenciesNone (just bun)OpenCode + plugin system
Setup complexityLowMedium

Architecture

Client (curl/script/app)
│
▼
┌───────────────────────┐
│ CliCursorProxyAPI │ ← Standalone proxy on :32124
│ /v1/chat/completions│
└───────────────────────┘
│
▼
┌───────────────────────┐
│ cursor-agent CLI │ ← Handles auth, API communication
└───────────────────────┘
│
▼
┌───────────────────────┐
│ Cursor API │
└───────────────────────┘

Quickstart

1. Build

git clone https://github.com/ThewindMom/CliCursorProxyAPI.git
cd CliCursorProxyAPI
bun install
bun run build

2. Start Proxy

bun run proxy

3. Authenticate

cursor-agent login

4. Test

curl http://localhost:32124/health
curl http://localhost:32124/v1/models
curl -X POST http://localhost:32124/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"auto","messages":[{"role":"user","content":"Hello"}],"stream":true}'

API Endpoints

GET /health

curl http://localhost:32124/health
# {"status":"ok","version":"2.3.20","auth":"authenticated","mcp":{...}}

GET /v1/models

curl http://localhost:32124/v1/models

POST /v1/chat/completions

OpenAI-compatible streaming endpoint:

curl -X POST http://localhost:32124/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{ "model": "auto", "messages": [{"role": "user", "content": "Hello"}], "stream": true }'

Available Models

ModelDescriptionUsage Pool
autoAuto-select best modelComposer
composer-2Composer 2 (standard)Composer
composer-2-fastComposer 2 FastComposer
composer-1.5Composer 1.5Composer
sonnet-4.6Claude Sonnet 4.6API
opus-4.6Claude Opus 4.6API

See /v1/models for full list.

Client Integration

curl (Verified Working)

# Health check
curl http://localhost:32124/health
# List models
curl http://localhost:32124/v1/models
# Chat completions
curl -X POST http://localhost:32124/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"auto","messages":[{"role":"user","content":"Hi"}],"stream":false}'

OpenCode

Add to ~/.config/opencode/opencode.json:

{
"$schema": "https://opencode.ai/config.json",
"provider": {
"cursor-acp": {
"npm": "@ai-sdk/openai-compatible",
"name": "Cursor ACP",
"options": {
"baseURL": "http://127.0.0.1:32124/v1"
},
"models": {
"cursor-acp/auto": { "name": "Auto" },
"cursor-acp/sonnet-4.6": { "name": "Sonnet 4.6" }
}
}
}
}

Then: opencode run --model "cursor-acp/cursor-acp/auto" "Your prompt"

Claude Code

Not supported. Claude Code uses Anthropic Messages API, not OpenAI format.

Environment Variables

VariableDefaultDescription
PORT32124Proxy port
HOST127.0.0.1Bind address
TOOL_LOOP_MAX_REPEAT2Max tool call repeats

Troubleshooting

Proxy won't start

# Check port
lsof -i :32124
# Use different port
PORT=32125 bun run proxy

Authentication fails

cursor-agent login
curl http://localhost:32124/health # should show "authenticated"

Model not found

# Use bare model name (no provider prefix)
curl -d '{"model":"sonnet-4.6",...}'# NOT "cursor-acp/sonnet-4.6"

Project Structure

CliCursorProxyAPI/
├── src/
│ ├── proxy/
│ │ ├── server.ts # HTTP server
│ │ ├── handler.ts # Request routing
│ │ └── standalone-server.ts # Standalone entry point
│ ├── streaming/
│ │ ├── parser.ts # NDJSON → SSE conversion
│ │ ├── line-buffer.ts # Line buffering
│ │ └── delta-tracker.ts # Delta tracking
│ ├── auth.ts # Authentication
│ └── models/
│ └── sync.ts # Model list sync
├── docs/
│ ├── OPENCODE.md # OpenCode integration
│ └── FACTORY-DROID.md # Factory Droid integration
├── tests/ # Test suite
└── package.json

What We Added (vs Nomadcxx/opencode-cursor)

  • Standalone proxy — Runs independently, no OpenCode required
  • Minimal API — Only essential endpoints (health, models, chat)
  • Clean build — Fixed TypeScript errors, proper error handling
  • No plugin dependency — Works with any OpenAI-compatible client
  • Factory Droid support — Service manifest for agent orchestration

What We Don't Have (vs Nomadcxx/opencode-cursor)

This is a standalone proxy fork. The upstream has these features that we removed:

FeatureUpstreamThis Fork
One-line installercurl ... install.sh | bashNot applicable
OpenCode plugin entrydist/plugin-entry.jsNot applicable
MCP tool bridge (mcptool)Via mcptool CLINot implemented
Model sync scriptscripts/sync-models.shNot applicable
Auto-install modelscursor-agent models syncManual config
OpenCode /auth integrationBuilt-inManual proxy setup

If you need the OpenCode plugin experience with automatic MCP bridging, use the upstream instead.

Comparison with Alternatives

FeatureCliCursorProxyAPINomadcxx/opencode-cursor
ArchitectureStandalone proxyOpenCode plugin
PlatformAnyOpenCode only
StreamingSSESSE
Tool callingVia cursor-agentVia cursor-agent
MCP bridgeNot implementedVia mcptool

License

ISC

About

Universal Cursor Proxy API - Use Cursor Pro subscription models (Composer 2, Sonnet, Opus, GPT) via OpenAI-compatible REST API in any client. Works with OpenCode, Claude Code, curl, and more.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages