OpenAI-compatible API service for Cursor AI models using Playwright automation. Educational project for learning API integration patterns.
- OpenAI API compatibility implementation
- Web automation with Playwright
- Streaming and non-streaming responses
- Making LLM APIs accessible to everyone
- Image recognition not supported
- Tool calling (function calling) not supported (TODO)
- Node.js >= 16.0.0
- npm or yarn
- Chrome/Chromium browser
No installation needed! Just run:
npx cursorlearn2apiFirst run will automatically install dependencies and Playwright browser.
npm install -g cursorlearn2api
cursorlearn2apiClone and install:
git clone https://github.com/gmh5225/cursorlearn2api.git
cd cursorlearn2api
npm install
npx playwright install chromium
npm startServer runs on port 30011 by default. Set PORT environment variable to change.
Optional: Enable API Key Authentication
export API_KEY="your-secret-key"
npm startThen add header: Authorization: Bearer your-secret-key
Chat Completions
POST /v1/chat/completionsExample:
curl -X POST http://localhost:30011/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY"\
-d '{
"model": "anthropic/claude-4.5-sonnet",
"messages": [{"role": "user", "content": "Who are you"}],
"stream": false
}'anthropic/claude-4-sonnetanthropic/claude-4.1-opusanthropic/claude-4.5-sonnetopenai/gpt-5google/gemini-2.5-progoogle/gemini-2.5-flashxai/grok-4xai/grok-code-fast-1moonshotai/kimi-k2-0905alibaba/qwen3-coderalibaba/qwen3-coder-plusalibaba/qwen3-maxzai/glm-4.6
Formatting
npm run formatLinting
npm run lintMIT License - see LICENSE file.
Educational use only. Users responsible for compliance with terms of service.