Cursor IDE
Cursor’s Override OpenAI Base URL must target the Cursor adapter, not the unified /gateway/v1 root.
| Setting | Value |
|---|---|
| OpenAI API Key | eis_… (org platform key) |
| Override OpenAI Base URL | https://production-api.exemplar.dev/gateway/cursor |
| Custom model | Exact allowlisted id, e.g. openai/gpt-4o-mini, anthropic/claude-sonnet-4-6 |
Create the key under Tokens and API keys. Enable providers under AI Gateway → Management → Providers.
Cursor is not OpenAI passthrough and not Unified /gateway/v1. See Choose your surface if you are unsure which base to use.
Do not set the override to /gateway/v1 or /gateway/openai/v1. Cursor still posts to /chat/completions, but the body is often Responses-shaped (input, flat tools, previous_response_id, …). Plain Chat Completions backends reject that. The adapter at /gateway/cursor normalizes the request, calls the gateway Responses (or Chat) path, and returns Chat Completions JSON/SSE Cursor expects.
Why /gateway/v1 fails
When Override Base URL is set, Cursor calls {base}/chat/completions. Payload shape depends on the selected model family:
| Model family in Cursor | Typical body | Expected response |
|---|---|---|
| OpenAI-style | Responses API fields (input, …) on /chat/completions | Strict Chat Completions |
| Anthropic-style | Native Anthropic + Responses-like fields on the same path | Strict Chat Completions |
| Gemini-style | Provider-specific fields, not Chat Completions | Strict Chat Completions |
/gateway/cursor (and /gateway/cursor/v1/chat/completions) exists for that mismatch. Telemetry is tagged route_mode=cursor.
Setup
- Cursor Settings → Models.
- Enable Override OpenAI Base URL and paste
https://<api-host>/gateway/cursor(no trailing slash; do not append/v1yourself—the adapter serves both/chat/completionsand/v1/chat/completions). - Paste your org
eis_*key as the OpenAI API key. - Add custom models using the exact gateway model ids from Management / catalog.
Supported modes today: Ask and Plan. Agent/Composer may still use Cursor’s own backend. Prefer HTTP/1.1 in Cursor network settings if you see TLS or connection errors.
curl -sS -X POST https://production-api.exemplar.dev/gateway/cursor/chat/completions \
-H "Authorization: Bearer $EXEMPLAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-4o-mini","input":[{"role":"user","content":"hi"}]}'Precautions
- Model id must match an enabled allowlisted provider/model. Mismatched custom names fail at the gateway.
- Thinking / reasoning UI — Chat Completions responses do not surface full thinking-token streams the way native provider UIs might; treat that as a Cursor + Chat Completions limitation.
- Rate limits apply when a policy is effective — see Rate limits.
Model path vs action path
| Need | Surface |
|---|---|
| Route Cursor chat through Exemplar models | This page (/gateway/cursor) |
| Allow / deny shell, MCP, prompts, file reads | Relay Connect (Cursor hook bridge) |
| Org MCP tools | Tools & MCP → Connect |
Hooks are independent of the model base URL—you can use Relay without /gateway/cursor, or both together.
Related
- Choose your surface — when Cursor vs Unified vs Anthropic
- Provider passthrough — Anthropic / Cursor / OpenAI bases side by side
- Claude Code — Anthropic passthrough for the Claude CLI
- Getting started — auth and model ids
- Unified API — Chat Completions and Responses for SDKs
- Frameworks — non-IDE clients
- Relay Connect — IDE tool governance