Point Cursor at a custom Anthropic base URL

Cursor lets you override the API endpoint it talks to. Once you do, every request is billed against your own key at your own rate instead of Cursor's pooled quota.

In short: Cursor accepts a custom Anthropic base URL and your own API key, both set under Settings → Models. A full restart is required before they take effect, and the way to confirm it worked is that the request appears in your gateway usage log.
Don't have an account yet? You need an API key from the gateway before the steps below will work. Create one free → (no prepay, $1 minimum top-up)
Check current rates → Free to sign up · $1 minimum top-up · No prepayment
Quick self-check. Before wiring anything into your app, confirm the key works. This lists every model your account can call — it costs nothing and works from any machine:
curl https://aicomp.ai/v1/models \
  -H "Authorization: Bearer sk-your-gateway-key"

You should get back a JSON list of model IDs. If you see Invalid token, the key is wrong or was not copied in full.

Step 1 — create a key

Sign up, generate an API key in the dashboard, and copy your base URL (https://aicomp.ai/v1).

Step 2 — open the override field

In Cursor: Settings → Models. Look for the base URL override (in some versions it sits under "Override OpenAI Base URL" or the Anthropic section). Enter:

https://aicomp.ai/v1

Then paste your key into the API key field and save.

Step 3 — confirm it took effect

Open a new chat and send a short message. If routing works you get a normal reply. To be certain, check the usage log in your gateway dashboard (the request should appear there within a minute).

If it does not work

SymptomFix
Invalid API keyCursor may cache the old key. Restart Cursor fully after saving.
404 errorsRemove or add the /v1 suffix so it is not doubled.
Falls back to Cursor quotaSome versions ignore the override unless "use my own key" is explicitly enabled.
Empty model list after savingThe URL is missing its scheme or its /v1 segment. Paste the whole root, including https://.
Works in chat, fails in agent modeAgent mode sends a longer context, and needs tool calls and streaming that plain chat never exercises. See the Agent-mode triage table before assuming the base URL is wrong.

Why changing one URL is enough

An OpenAI-compatible client does not have a provider hardcoded into it. It holds a base URL, and at request time it concatenates that base URL with a resource path — /chat/completions, /models, then sends the same JSON body it would have sent anywhere else, with your key in an Authorization: Bearer header. The base URL is therefore the only thing that decides where the request physically goes.

That is why this change is one line and not a rewrite. Your message array, your tool definitions, your streaming handling and your response parsing are all unchanged, because the wire format is unchanged. What changes is who answers, and what they charge per token. The two values that travel with the new destination are the base URL itself and the API key; the model ID is the third, and it has to be one the new endpoint actually serves, which you can list with a single call to /v1/models rather than guess at.

The practical consequence is that this is reversible. Keep the base URL in configuration rather than inline, and moving between providers is a config change you can undo in a minute — which is also the right way to test it: point a single non-critical call at the new endpoint first, confirm it in the usage log, then move the rest.

What it does not change

Swapping the base URL is narrower than it looks, and the gap between expectation and reality is where most of the frustration comes from.

What it costs

Claude models available in Cursor — gateway rate vs official list
ModelGateway rate
in / out per 1M tokens
Official list
in / out per 1M tokens
Diff
claude-haiku-4-5$0.5 / $2.5$1 / $550%
claude-sonnet-5$1 / $5$2 / $1050%
claude-opus-5$2.5 / $12.5$5 / $2550%

Rates checked 2026-11-02. Gateway rates move with upstream promotions, verify the current number in your dashboard before committing to a budget.

A month of Cursor at three usage shapes — gateway rates
Workloadclaude-haiku-4-5-20251001claude-sonnet-5claude-opus-5
Chat assistance
50 requests a day, 2k in / 500 out
$2$4$11
Bulk processing
5,000 short jobs a day, 800 in / 300 out
$115$230$575
Agent loop
20 turns a day, 60k in / 800 out
$13$26$64

One month at 20 working days, gateway rates checked 2026-11-02. These are the token volumes, not a quote Your own shape may be larger or smaller.

The agent row is the one that surprises people. Autocomplete and chat feel cheap because they are mostly short output; an agent run resends the working context on every turn, so input, not output, becomes most of the bill, and the gap between the cheapest and most expensive model in that row is several times wider than in the chat row. With your own key your bill is pure token spend, with no per-request markup on top. Estimate it with the Cursor cost calculator, or compare Sonnet 5 against Haiku 4.5 for your workload For autocomplete and small edits the difference is most of the bill.

FAQ

Can I use my own Claude API key in Cursor?

Yes. Cursor accepts an Anthropic API key and, in current versions, lets you override the base URL. With both set, requests bill to your key instead of consuming Cursor's pooled quota.

Where exactly is the base URL setting?

Under Cursor Settings → Models. Depending on version it appears as an Anthropic base URL field or alongside the 'Override OpenAI Base URL' option. If it is not exposed in the UI, it can be set in settings.json and Cursor restarted.

How do I know Cursor is actually using my key?

A successful reply is not proof. Check your gateway usage log, if the request does not appear there within a minute, Cursor is still routing through its own quota.

Do I still pay Cursor if I use my own key?

You pay for token spend on your own account rather than drawing down Cursor's included usage. Your subscription covers the editor; the API consumption is billed wherever your key lives.

Does it work in agent mode?

Yes, provided the model you selected is reachable through the configured endpoint. Agent mode sends more context per turn, so the per-token rate matters more there than in ordinary chat.

What is the Cursor custom API endpoint URL?

It is whatever your provider publishes as its OpenAI-compatible root — usually ending in /v1. Paste the whole thing including the scheme; a base URL without https://, or one missing the /v1 segment, is the most common cause of a blank model list after saving.

Can I point Cursor at a non-Anthropic model this way?

Yes, if the endpoint speaks the OpenAI-compatible /chat/completions shape That is the whole point of routing through one gateway. Cursor still labels the field as an Anthropic override, but what it sends is a standard request, so any model the gateway exposes on that route will answer.

Why is agent mode so much more expensive than chat?

Because each turn resends the accumulated context, not just your new message. A chat exchange is mostly short output; an agent run is overwhelmingly input, and input is priced separately. That is also why switching to a cheaper model helps more in agent mode than in chat — and why a model with a cheap input rate but a dearer output rate can come out ahead here while losing on a chat workload.

Can I use one key across a whole team?

Technically yes, and operationally it is a mistake. The endpoint sees a single credential, so every person's spend lands in one indistinguishable usage log, and rotating the key means interrupting everyone at once. Issue one key per person or per service before you need to attribute a bill to someone. Retrofitting that after the fact does not work, because the usage log cannot be un-mixed.

Next

Get API access

Rate cards: Claude and GPT