Skip to content

seven7763/cursor-custom-openai-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cursor-custom-openai-api

Point Cursor at a custom OpenAI-compatible endpoint — and verify it works before you wire it in.

Cursor lets you override the OpenAI base URL to use your own gateway (Claude, GPT, Gemini, DeepSeek… behind one key). The hard part isn't the setting — it's knowing whether the endpoint will actually work (auth, exact model ids, and SSE streaming, which Cursor needs). This repo ships a tiny zero-dependency verifier that checks all three, then a precise, honest setup guide.

Node License: MIT Try DaoXE

Quickstart

git clone https://github.com/seven7763/cursor-custom-openai-api
cd cursor-custom-openai-api

export OPENAI_BASE_URL="https://daoxe.com/v1"   # any OpenAI-compatible gateway
export OPENAI_API_KEY="your_key"

node verify-openai-endpoint.mjs                 # auto-picks a model from /models
# or, curl-only (no Node):
OPENAI_BASE_URL="$OPENAI_BASE_URL" OPENAI_API_KEY="$OPENAI_API_KEY" ./verify.sh "exact-model-id"

You'll get a PASS/FAIL checklist:

PASS  GET /models — 42 models visible (180 ms)
PASS  POST /chat/completions — HTTP 200 (410 ms, tokens: 12)
PASS  POST /chat/completions (stream) — SSE chunks received (150 ms), clean [DONE]

Ready for Cursor. Set Base URL = https://daoxe.com/v1, add your model, then Verify.

Then follow docs/SETUP.md to add it in Cursor.

Why the verifier?

"It works in curl but not in Cursor" is almost always one of:

  1. auth / base-URL shape (/v1 root vs full path),
  2. wrong model id (ids are account-scoped — use GET /v1/models),
  3. no streaming — Cursor relies on SSE; a gateway that 200s on a normal request but breaks on stream: true will silently fail in the editor.

The verifier checks all three and prints latency + token usage — without ever printing or storing your API key, the prompt, or the response text.

Safe by construction

  • Zero dependencies (built-in Node.js fetch), auditable in one file.
  • Reads the key only from the environment; never logs it.
  • Only reports: model id, HTTP status, latency, token counts, coarse errors.

Works with (same base-URL idea)

Cursor · Cline · Roo Code · Continue · Windsurf · LobeChat · any OpenAI SDK. Claude Code uses the Anthropic protocol (ANTHROPIC_BASE_URL) — see the guides below.

Related

  • seven7763/DaoXE-AI — per-client setup for ~50 tools (Cursor, Claude Code, Cline, Continue…), Postman collection, multi-language docs.
  • seven7763/llm-gateway-benchmark — reproducible latency / availability / price leaderboard for gateways.

About the example gateway

Examples default to DaoXE, an OpenAI-compatible, multi-model, multi-protocol gateway (Chat Completions, Responses, and Anthropic Messages) at https://daoxe.com/v1. Any OpenAI-compatible endpoint works — set OPENAI_BASE_URL to its /v1 root. Free credit on signup: {{FREE_CREDIT}} (to be confirmed).

Disclosure: this repo's author operates DaoXE. The verifier and guide are gateway-agnostic; nothing here is an official Cursor integration.

Acknowledgements

Thanks to the LINUX DO community for discussion and feedback on testing OpenAI-compatible gateways with coding tools.

License

MIT

About

Point Cursor at a custom OpenAI-compatible endpoint (Claude/GPT/Gemini/DeepSeek via one base URL) + a zero-dependency verifier that checks models, chat & SSE streaming before you wire it in.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages