Prerequisites for all examples: Cursor CLI installed and authenticated (agent login). The SDK examples start the proxy in the background automatically if it is not already running.
Optional: set CURSOR_PROXY_URL to use a different proxy URL (default http://127.0.0.1:8765). Set startProxy: false when creating the client if you run the proxy yourself.
Uses the minimal client (createCursorProxyClient). Proxy starts automatically on first request. No extra dependencies.
npm run build # if running from repo
node examples/sdk-client.mjsUses getOpenAIOptionsAsync with the OpenAI SDK. Proxy starts automatically. This is an optional example; openai is not part of this package and only needs to be installed in the project where you run the example.
npm install openai
node examples/sdk-openai.mjsUses the minimal client’s fetch for streaming. Proxy starts automatically on first request.
node examples/sdk-stream.mjsNon-streaming chat completion via raw fetch (no cursor-api-proxy SDK import).
node examples/test.mjsStreaming chat completion via raw fetch.
node examples/test-stream.mjsPrints each streamed chunk and the total character count.