In 2026 Cursor is still the most productive AI-native editor on the market, and Claude Sonnet 5 is still the strongest general-purpose coding model. The expensive part is elsewhere. A Cursor subscription bundles a fixed quota of frontier-model calls, everything above it is metered separately, and anyone who leans on the agent sees the bill climb fast. The clean fix is to point Cursor at a pay-per-token gateway like codexkey, keep the same Cmd+K, Cmd+L and Composer flows, and pay only for the tokens you actually burn.
This guide covers the whole setup: what to prepare, where to get the key, how to enter a custom OpenAI-compatible base URL, which model aliases we recommend for daily work, how to switch tab autocomplete and Composer to Claude, and the errors you will probably hit on the first try.
Why Cursor and Claude work well together in 2026
There are two reasons, both boring and both correct.
First, Claude Sonnet 5 and Claude Opus 5 consistently lead public coding benchmarks and, more importantly, internal evals at teams that ship a lot of code. Claude is strong at edits across several files, does not misreport what it just did, and follows project conventions when you hand it a CLAUDE.md or AGENTS.md file.
Second, Cursor's interface rests on three primitives: inline edit (Cmd+K), chat (Cmd+L) and Composer, the multi-file agent. All three get better with a stronger model underneath. Swapping the model under those primitives is exactly what custom model support exists for.
What to prepare first
Check two things:
- Cursor Pro is required. The free tier and the 7-day Pro trial do not allow custom OpenAI-compatible models. The "OpenAI API Key" and "Override OpenAI Base URL" fields appear only with an active paid Cursor Pro seat. That is a Cursor restriction and has nothing to do with codexkey.
- A codexkey account with a balance. Billing is pay-as-you-go, so a small top-up is enough to test the whole flow: 5-10 USD equivalent through SBP (the Russian Faster Payments System), crypto or card.
There is nothing else to set up. No extensions, no proxies, no local servers.
Step 1. Create a codexkey API key
Sign in to the codexkey dashboard, open API Keys and create a key labelled "Cursor" or anything else that makes it easy to rotate later. Copy the key right away: you will paste it into Cursor in a minute. If you suspect a leak, revoke the key on the same screen and issue a new one. codexkey keys are separated per application from the start for exactly this reason.
Step 2. Point Cursor at codexkey (OpenAI-compatible mode)
Open Cursor and go to Settings → Models. Scroll to the OpenAI API Key block. This is the one you need even though you are calling Claude: the "OpenAI" field in Cursor is really a slot for any OpenAI-compatible endpoint, and codexkey exposes a fully OpenAI-compatible API precisely so the integration works without code on your side.
Fill in exactly two fields:
- OpenAI API Key: the key from Step 1.
- Override OpenAI Base URL:
https://api.codexkey.online/v1
Turn the override on. Do not enable Anthropic's native API in the same Cursor profile: pick one transport and stay with it. We recommend the OpenAI-compatible mode only, because Cursor's custom model form is built around the OpenAI schema, and codexkey translates OpenAI-style requests into Claude calls on its side.
Step 3. Add model aliases
Most people get this step wrong. Cursor cannot discover which Claude models sit behind your gateway, so you have to list the identifiers it should send. In the same Models panel click + Add model and add the aliases from the table. Each one points to a real, routable identifier on the codexkey side, so what you pick is what gets billed.
| Alias | What it routes to | When to use it |
|---|---|---|
cursor-sonnet5 | Claude Sonnet 5 | Default daily driver for Cmd+L and Composer. |
cursor-opus5 | Claude Opus 5 | Hard reasoning, big refactors, planning passes. |
cursor-sonnet46 | Claude Sonnet 4.6 | Stable fallback and budget edits when Sonnet 5 is overkill. |
cursor-opus48 | Claude Opus 4.8 | Budget reasoning tier when Opus 5 is overkill. |
cursor-luna | gpt-5.6-luna | Tab autocomplete, fast edits, classification. |
cursor-gpt56 | GPT-5.6 Sol (compat) | Cross-model sanity checks and second opinions. |
Haiku is in the lineup too: the catalog has claude-haiku-5.5 and claude-haiku-4.5, with prices on the models page. They run on the Premium channel and are not available on the Cheap channel.
Once the aliases are in, turn off the stock Cursor models you do not plan to run through Cursor's own quota. That list changes with every Cursor release, so check Settings → Models rather than trust a snapshot here. This keeps your shortcuts going through codexkey instead of silently falling back to Cursor's paid pool.
Step 4. Check the reply in chat
Open a chat with Cmd+L, pick cursor-sonnet5 in the model selector and ask something trivial, for example "reply with the word ok". The answer should arrive in under a second. If it does, the wiring is right and you can move on.
If it does not, do not add the remaining aliases yet; read the troubleshooting section first. One model is much easier to debug than several at once.
Step 5. Switch tab autocomplete and Composer to Claude
Two toggles are left.
- Tab autocomplete model. In Settings → Features → Cursor Tab set the completion model to
cursor-luna. gpt-5.6-luna is fast enough that you will not feel the network hop, and the cost of one accepted completion is negligible. - Composer and agent model. In Settings → Features → Composer set the default to
cursor-sonnet5for everyday agent runs andcursor-opus5for planning-heavy sessions. Composer respects the model chosen per thread, so you can override it for one refactor without touching the global setting.
That is all of it. Inline edit (Cmd+K), chat (Cmd+L), Composer and tab autocomplete now run through codexkey on Claude, billed per token at Anthropic-matched rates.
Troubleshooting: common errors
You will probably see these at least once:
- HTTP 401 / "invalid API key". The codexkey key is wrong, revoked or has a stray space at the end. Copy it from the dashboard again and paste it once more: Cursor does not trim trailing whitespace.
- HTTP 404 / "model not found". The alias in Cursor does not match a model registered on the codexkey side. Check the spelling:
cursor-sonnet5, notCursor-Sonnet5and notcursorsonnet5. Aliases are case-sensitive. - A slow first request. Cold cache. Send one warm-up request and the rest will be fast. It is not a bug.
- Tab autocomplete lags. Most likely the Composer model (Sonnet 5 or Opus 5) is set as the autocomplete model. Switch back to
cursor-luna(gpt-5.6-luna) and it feels instant again.
What it costs in practice
A developer who lives in Cursor all day (chat, Composer and tab autocomplete) can expect roughly 5-20 USD a month on codexkey at 2026 rates. That assumes gpt-5.6-luna handles autocomplete, Sonnet handles everyday chat and Opus comes out only when needed. Heavy agent users with long Composer sessions every day land near the top of the range; people who mostly edit inline land near the bottom.
That is meaningfully cheaper than buying extra frontier-model quota inside Cursor Pro. You also see where the money went, line by line.
What to read next
The full reference (environment variables for headless setups, team-level key management, the current list of routable identifiers) lives in the canonical doc, /docs/guides/cursor. It is updated with every Claude model release, so bookmark it rather than this post.