β οΈ As of 2026-04-01, Cursor Docs page only providesgemini-3-flash. This project may have limited functionality.
A proxy service that converts Cursor Web Docs free AI API into Anthropic Messages API and OpenAI Chat Completions API, enabling use with Claude Code and Cursor IDE.
π δΈζζζ‘£: README_CN.md
βββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β Claude Code ββββββΆβ ββββββΆβ β
β (Anthropic) β β cursor2api β β Cursor API β
β βββββββ (proxy) βββββββ /api/chat β
βββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β² β²
β β
ββββββββ΄βββββββ ββββββββ΄βββββββ
β Cursor IDE β β OpenAI Compatβ
β(/v1/responsesβ β(/v1/chat/ β
β + Agent mode)β β completions)β
βββββββββββββββ βββββββββββββββ
- Anthropic Messages API β Full
/v1/messagesstreaming/non-streaming compatibility for Claude Code - OpenAI Chat Completions API β
/v1/chat/completionsfor ChatBox, LobeChat and other clients - Cursor IDE Agent Mode β
/v1/responsesendpoint with flat tool format and incremental streaming - Full-link Log Viewer β Web UI for real-time request/response/tool call inspection with dark/light theme
- API Token Auth β Bearer token / x-api-key dual mode with multi-token support
- Thinking Support β Client-driven Anthropic
thinkingblock + OpenAIreasoning_content - response_format Support β
json_object/json_schemawith auto markdown stripping - Tool Parameter Auto-fix β Field name mapping, smart quote replacement, fuzzy matching
- Vision Fallback β Built-in CPU OCR for image text extraction (zero config), or external vision API
- Full Tool Support β No tool whitelist, all MCP tools and custom extensions supported
- Multi-layer Refusal Defense β 50+ regex patterns (CN/EN), auto-retry + cognitive reframing bypass
- Identity Protection β Probe interception + refusal retry + response sanitization
- Truncation Continuation β Seamless resume of truncated long Write/Edit calls
- Progressive History Compression β Smart message type recognition, tool call summarization
- Schema Compression β Compacts full JSON Schema (~135k chars) to compact type signatures (~15k chars)
- Chrome TLS Fingerprint β Simulates real browser request headers
- SSE Streaming β Real-time response with 128-byte incremental tool call chunks
git clone https://github.com/xuweizhengo/cursor-free-api.git
cd cursor-free-api
npm installcp config.yaml.example config.yamlKey options:
| Option | Description | Default |
|---|---|---|
port |
Server port | 3010 |
auth_tokens |
API auth tokens (recommended for public deployment) | Allow all |
cursor_model |
Model to use | google/gemini-3-flash |
max_history_tokens |
History token limit | 120000 |
vision.enabled |
Enable vision interception | true |
vision.mode |
Vision mode: ocr / api |
ocr |
compression.enabled |
History compression | true |
compression.level |
Compression level 1-3 | 2 |
proxy |
Global proxy (optional) | none |
# Development
npm run dev
# Production
npm run build && npm startexport ANTHROPIC_BASE_URL=http://localhost:3010
claudeWith auth:
export ANTHROPIC_BASE_URL=http://localhost:3010
export ANTHROPIC_API_KEY=sk-your-secret-token-1
claudeSet in Cursor IDE settings:
OPENAI_BASE_URL=https://your-domain.example.com/v1
Select a Claude model name (check /v1/models for available models).
β οΈ Cursor Pro subscription may be required for custom Base URL.
Visit http://localhost:3010/logs after starting the service.
Features:
- Real-time SSE log streaming
- Request list with user question as title
- Global search + time filtering
- Status filtering (success/degraded/failed/processing/blocked)
- Detail panel for full request/response inspection
- Degradation reason display
- Phase timing visualization
- Dark/light theme toggle
- SQLite persistence (recommended) or JSONL file logging
cursor2api/
βββ src/
β βββ index.ts # Entry + Express server + routes + auth middleware
β βββ config.ts # Configuration management
β βββ types.ts # Type definitions
β βββ constants.ts # Global constants
β βββ cursor-client.ts # Cursor API client + Chrome TLS fingerprint
β βββ converter.ts # Protocol conversion + prompt injection + context cleaning
β βββ handler.ts # Anthropic API handler + identity protection + refusal defense
β βββ openai-handler.ts # OpenAI / Cursor IDE compatible handler
β βββ log-viewer.ts # Full-link log Web UI
β βββ logger.ts # Log collection + SSE push
β βββ proxy-agent.ts # Proxy support (global + Vision independent)
β βββ tool-fixer.ts # Tool parameter auto-fix
βββ public/ # Log viewer static files
βββ test/ # Test suites
βββ config.yaml.example # Config template
βββ package.json
βββ tsconfig.json
All config options can be overridden via environment variables (higher priority than config.yaml). See config.yaml.example for details.
The core insight: instead of fighting Cursor's locked-down "Documentation Assistant" identity, we embrace it. The model is told it's writing API documentation examples, tricking it into outputting tool call JSON blocks that the proxy layer then converts into real tool calls.
| Layer | Location | Strategy |
|---|---|---|
| L1: Context Cleaning | converter.ts |
Remove refusal text from conversation history |
| L2: XML Separation | converter.ts |
Separate Claude Code system reminders from user requests |
| L3: Output Interception | handler.ts |
50+ regex patterns to intercept refusals in real-time |
| L4: Response Sanitization | handler.ts |
Post-process all output to replace Cursor identity references |
This project is for educational and research purposes only. It is not affiliated with Cursor or Anysphere. Users should comply with Cursor's Terms of Service and assume all risks. The author is not responsible for any account bans or consequences.
- aws-auto-register β Automated AWS Builder ID account registration with fingerprint randomization
- fingerprint-toolkit β Browser fingerprint randomization toolkit for web automation
- llm-api-purity β OpenAI and Claude API purity checker
- skills-hub β AI Skills & MCP marketplace