All projects
cursor-openai.sh

cursor-openai

Shipped

Drop-in OpenAI-shaped client for Cursor models — LangChain and LangGraph compatible.

Library author

npmjs.com/package/cursor-openai
cursor-openai screenshot

cursor-openai_case_study.sh

~/projects cat cursor-openai_case_study.txt

// Problem

Cursor's model API doesn't match the OpenAI SDK shape, making it hard to use Cursor models in existing OpenAI-compatible tooling and LangChain/LangGraph pipelines.

// What I built

I published cursor-openai, an npm package that provides a drop-in OpenAI-shaped client for Cursor models. Pass a Cursor API key and model id, then call chat.completions.create or use LangChain/LangGraph bindings. Runs in-process via @cursor/sdk with no Express gateway required.

// Architecture

TypeScript library wrapping @cursor/sdk. Exposes createCursorClient() with OpenAI-compatible chat.completions API including streaming and usage tracking. CursorChatModel class for LangChain/LangGraph integration with bindTools support. Model resolution handles Cursor catalog aliases. MIT licensed, published on npm.

// Stack

TypeScript @cursor/sdk LangChain LangGraph Node.js

// Outcomes

  • ▸ Published open-source npm package (cursor-openai v0.1.4)
  • ▸ OpenAI-compatible API with streaming, usage tracking, and LangChain bindings
  • ▸ Supports ask, agent, and plan modes with caller-defined tools only