← Blog
By the apillms team · Published 2026-10-04 · Cursor · OpenAI-compatible API · API keys

Cursor custom OpenAI base URL: use your own API key

Cursor supports custom OpenAI-compatible endpoints, which means you can swap the default model provider for any gateway that speaks the OpenAI API format. This guide walks through connecting Cursor to apillms, so you can use Claude, GPT, DeepSeek, Grok or Kimi models with pay-as-you-go credits instead of a subscription, and pick whichever model fits a given task.

What you need

Each apillms account has exactly one API key, created automatically at sign-up. There's no "create new key" flow — you just show it on the API keys page, or roll it if it ever leaks, which disables the old one immediately.

Step 1: Get your base URL and key

Log in and open the API keys page. You'll see two base URLs listed:

Cursor's custom-model setting expects an OpenAI-compatible endpoint, so you want the first one. Click "Show key" to reveal your key and copy it. The same page also has ready-made setup tabs for Claude Code and Codex, plus code examples in Python, Node, cURL and the Anthropic SDK if you want to sanity-check the key outside of Cursor first.

A quick way to confirm the key works before touching Cursor is a plain cURL call:

curl https://apillms.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "messages": [{"role": "user", "content": "say hi"}]
  }'

If that returns a normal chat completion response, the key and endpoint are good and the rest is just Cursor configuration.

Step 2: Override the base URL in Cursor

In Cursor, go to the model settings where you add a custom OpenAI API key and base URL. Enter:

Base URL: https://apillms.com/v1
API Key: YOUR_KEY

Save the settings, then disable or ignore Cursor's built-in models if you want all requests routed through apillms instead of Cursor's own billing. This follows the full setup described on the Cursor integration guide at /integrations?app=cursor, which has the exact fields and current field names for the Cursor version you have installed — useful if Cursor has moved the setting since this post was written.

You can also open the Connect page in your apillms console first. It lets you test your key and links out to the per-app guides, including Cursor, so you don't have to hunt for the integration page separately.

Step 3: Pick a model id

Once the endpoint is saved, Cursor will let you type or select a model id. Use the exact ids from the Models & API page in your console — for example:

Model idGood for
claude-sonnet-5General coding, strong reasoning
gpt-5.5Fast, cheap everyday edits
claude-opus-5-5Harder refactors, longer context
gpt-6-astraLarger context, agentic tasks
deepseek-v4-flashHigh-volume, low-cost completions

The full list with capability filters is on the Models & API console page, and endpoints include /v1/chat/completions and /v1/responses for OpenAI-style clients. Other model ids on sale include claude-haiku-4-5, claude-opus-4-8, grok-4.6, kimi-k3 and several more — check the live list in your console since it changes over time.

Because the model id is just a string Cursor sends with each request, you can switch models mid-session without reconfiguring the base URL or key — just type a different id in Cursor's model picker, or edit the model field in whatever config file Cursor stores it in.

Step 4: Test the connection and troubleshoot

Open a file in Cursor, trigger a chat or inline edit, and confirm you get a response. If something fails, work through these in order:

If Cursor still won't connect, retest the same key and URL with the cURL command above. If that works but Cursor doesn't, the issue is in Cursor's settings, not in your apillms account.

What it costs

Pricing is per-token, billed from your credit balance, and failed requests aren't charged. Prompt caching is on automatically too — Cursor sends repeated context (open files, system instructions) on every request, and cache reads are billed at the lower cache price with no setup on your end. Here's what a single chat-sized message (1,000 input + 500 output tokens) costs on apillms, next to OpenRouter's listed per-token rates for the same models:

Modelapillms per-token priceapillms, 1 messageOpenRouter input/output (per 1M)
claude-sonnet-5$0.274 in / $1.37 out per 1M$0.002$2 / $10
claude-opus-5-5$0.639 in / $3.19 out per 1M$0.004$4 / $20
gpt-5.5$0.532 in / $3.19 out per 1M$0.319 per 1,000 messages$5 / $30
gpt-6-astra$1.06 in / $5.32 out per 1M$0.719 per 1,000 messages$10 / $50
deepseek-v4-flash$0.047 in / $0.047 out per 1M$0.14 per 1,000 messages$0.028 / $0.056

Cursor's agent mode sends much larger contexts than a single chat message, since it reuses file content and prior turns on every call. For an agent-style turn with heavy context reuse (100,000 cache-read tokens, 5,000 fresh input, 1,000 output), claude-sonnet-5 costs $0.021 per turn, or $20.99 for 1,000 turns; gpt-5.5 costs $0.013 per turn, or $13.45 for 1,000 turns; deepseek-v4-flash costs $0.006 per turn, or $5.88 for 1,000 turns. See the full side-by-side on /compare, or check per-pack token estimates on /pricing before you decide which model to default to in Cursor.

Credits and top-ups

Credits never expire, so you can buy a pack and use it over weeks or months without losing anything. Packs:

PackPriceCredits
Starter$51,000
Builder$204,200
Pro$5011,000
Scale$10023,000

Top up via PayPal or card on the Billing page whenever your balance runs low — Cursor just keeps working against the same key, nothing to reconfigure on top-up. The Usage page in your console shows spend by day (today / 7 / 30 days), filterable by status, with CSV export if you want to track Cursor usage against other integrations separately.

Using the same key elsewhere

Since your apillms account has one key, you can reuse it for every tool you connect — not just Cursor. If you also run Claude Code, Codex, or VS Code's built-in Chat, the same base URL and key pattern applies, with small differences per tool (Claude Code uses the Anthropic-compatible base URL and the ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN env vars instead of an OpenAI-style override). The Models & API endpoints also cover /v1/messages for Anthropic-style clients, so you're not locked into the OpenAI format even outside Cursor.

Takeaway

Cursor's custom OpenAI endpoint setting works with apillms out of the box: set the base URL to https://apillms.com/v1, paste your key, and choose a model id from Models & API. Prompt caching and per-token billing keep agent-mode costs predictable, and the same key works across other editors and CLIs if you use them too. See the VS Code Chat guide or the Claude Code setup guide for the equivalent steps elsewhere.

Try apillms

One API key for Claude, GPT, Grok, DeepSeek and Kimi. OpenAI- and Anthropic-compatible, prompt caching included, pay-as-you-go from $5 with PayPal or card. Credits never expire.

Get an API key Compare prices

FAQ

Which base URL does Cursor need?

Use the OpenAI-compatible base URL, https://apillms.com/v1, since Cursor's custom model field expects the OpenAI API format. The Anthropic-compatible URL (no /v1) is for tools like Claude Code instead.

Do I need a separate API key for Cursor?

No. Each apillms account has one API key for all integrations — reuse the same key you show on the API keys page, and roll it only if it leaks.

Which model id should I pick in Cursor?

Copy the exact id from the Models & API page, such as claude-sonnet-5 or gpt-5.5; typos in the id will return a 404 instead of a response.

What happens if a request fails or my balance runs out?

Failed requests are not billed, so a bad model id or connection error won't use your credits. If your balance hits zero, top up on the Billing page — Cursor will keep using the same key once credits are added.