JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 51
  • Score
    100M100P100Q67291F
  • License MIT

Use your Cursor subscription with any OpenAI-compatible client. Wraps Cursor CLI (agent) as an OpenAI-compatible API server.

Package Exports

  • cursor-agent-api-proxy
  • cursor-agent-api-proxy/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cursor-agent-api-proxy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cursor-agent-api-proxy

npm version npm downloads license

中文文档

OpenAI-compatible API proxy for the Cursor CLI. Lets any OpenAI client use your Cursor subscription.

Prerequisites

  • Node.js 20+
  • Active Cursor subscription (Pro / Business)

Install

1. Install the Cursor CLI and log in:

# macOS / Linux
curl https://cursor.com/install -fsS | bash

# Windows PowerShell
irm 'https://cursor.com/install?win32=true' | iex
agent login          # opens browser, sign in with your Cursor account
agent --list-models  # verify it works

Headless? Skip agent login, generate a key at cursor.com/settings and export CURSOR_API_KEY=<key>.

2. Install and start the proxy:

npm install -g cursor-agent-api-proxy
cursor-agent-api    # starts on http://localhost:4646

3. Verify:

curl http://localhost:4646/health

Use with OpenClaw

OpenClaw is an open-source AI coding agent. Here's how to connect it to your Cursor proxy.

Edit the OpenClaw config file:

{
  env: {
    // Already logged in via `agent login`? Set null — no key needed.
    // Want to pass a specific key? Put your Cursor API Key here.
    OPENAI_API_KEY: null,
    OPENAI_BASE_URL: "http://localhost:4646/v1",
  },
  agents: {
    defaults: {
      model: { primary: "openai/auto" },
    },
  },
}

That's it. OpenClaw will now route requests through this proxy to Cursor.

Models

Model IDs match agent --list-models output directly:

auto                  # auto-select
gpt-5.2               # GPT-5.2
gpt-5.3-codex         # GPT-5.3 Codex
opus-4.6-thinking     # Claude Opus 4.6 (thinking)
sonnet-4.5-thinking   # Claude Sonnet 4.5 (thinking)
gemini-3-pro          # Gemini 3 Pro

Full list: curl http://localhost:4646/v1/models or agent --list-models.

API

Endpoint Method Description
/health GET Health check
/v1/models GET List models
/v1/chat/completions POST Chat completion (supports stream: true)

Configuration

Env Variable Default Description
PORT 4646 Listen port (or cursor-agent-api 8080)
CURSOR_API_KEY - Alternative to agent login

Auto-start

cursor-agent-api install    # register as system service
cursor-agent-api uninstall  # remove
  • macOS → LaunchAgent
  • Windows → Task Scheduler
  • Linux → systemd user service

Other Clients

Python (openai SDK)
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:4646/v1",
    api_key="null",
)

resp = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
Continue.dev
{
  "models": [{
    "title": "Cursor",
    "provider": "openai",
    "model": "auto",
    "apiBase": "http://localhost:4646/v1",
    "apiKey": "null"
  }]
}
curl
curl -X POST http://localhost:4646/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"auto","messages":[{"role":"user","content":"Hello!"}]}'

How it Works

Client  →  POST /v1/chat/completions (OpenAI format)
        →  cursor-agent-api-proxy
        →  spawn agent CLI (stream-json)
        →  Cursor subscription
        →  AI response → OpenAI format → Client

Contributing

git clone https://github.com/tageecc/cursor-agent-api-proxy.git
cd cursor-agent-api-proxy
pnpm install && pnpm run build
pnpm start

License

MIT