📝 Tutorials
· 4 min read

How to Use Claude Sonnet 5 in Cursor: Setup and Tips


Cursor is one of the most popular AI code editors, and Claude Sonnet 5 is an excellent default model for it. Sonnet 5 was an early-access partner at launch, with Cursor’s team reporting that its agents stay on plan and ship clean multi-step changes at an efficient cost. This guide shows how to set it up and use it well.

Step 1: Enable Sonnet 5 in Cursor

  1. Open Cursor settings and go to the Models section.
  2. Make sure Claude Sonnet 5 is enabled in the model list. If you use your own Anthropic key, add it under API keys; otherwise Cursor provides access through its own billing.
  3. Select Claude Sonnet 5 as your model for chat and for Agent.

Step 2: Use it in Agent mode

Cursor’s Agent mode is where Sonnet 5’s strengths show. It plans, edits across multiple files, runs commands, and checks its own work. Point Agent at a clear task and let it execute. Because Sonnet 5 scores 81.2 percent on OSWorld and is built for sustained agentic work, it handles multi-step changes that older models would abandon partway.

Step 3: Manage context

Sonnet 5 supports a one million token context window, but Cursor decides how much of your codebase to send. Use Cursor’s context features (referencing specific files and symbols) to keep prompts focused. Sending less context saves input tokens and often improves accuracy by reducing noise. For patterns, see context window management.

Step 4: Balance cost against Opus 4.8

A smart pattern is to run Sonnet 5 as your everyday model and switch to Opus 4.8 for the hardest problems: deep debugging, big refactors, and tricky architecture. Cursor makes model switching easy, so you get near-flagship quality for most work and the full flagship when you need it. Keep in mind Sonnet 5’s new tokenizer can raise effective token counts by up to 1.35 times; see pricing explained.

Step 5: Compare with your old setup

If you previously ran Sonnet 4.6 or another model in Cursor, run a few real tasks through Sonnet 5 and compare. Most teams find it finishes more tasks end to end with less hand-holding. For the editor-level comparison, see Claude Code vs Cursor 2026.

Tips for getting the most from Sonnet 5 in Cursor

  • Write clear, specific task descriptions for Agent mode.
  • Reference only the files relevant to the task.
  • Let it run, then review the diff before accepting.
  • Escalate to Opus 4.8 for the hardest changes rather than fighting with a stuck session.

A worked example: fixing a bug with Agent

Here is a realistic flow. Suppose a test is failing intermittently in your project. In Cursor with Sonnet 5 selected, open Agent mode and give it a clear instruction: “The test in checkout.test.ts fails intermittently. Find the root cause, fix it, and confirm the test passes reliably.” Sonnet 5 will typically read the relevant files, form a hypothesis about a race condition or shared state, make a targeted change, run the test, and report back. If the first fix does not hold, its self-checking behavior means it often catches that and tries again rather than declaring victory early. Review the diff before accepting, then commit.

This is the kind of multi-step work that older models would start and abandon. Sonnet 5’s 81.2 percent OSWorld score and agentic design are exactly what make this reliable enough to trust in a real project.

Troubleshooting

  • Sonnet 5 is not in the model list. Update Cursor to the latest version and re-check the Models settings. If you use your own key, confirm it is a valid Anthropic key with access.
  • Responses feel truncated. Increase the output limit in settings, and break very large tasks into smaller Agent runs.
  • Costs are higher than expected. Sonnet 5’s new tokenizer can raise effective token counts by up to 1.35 times, and large context sends add up. Reference only the files you need and see pricing explained.
  • The agent stalls on a hard task. Switch to Opus 4.8 for that task rather than retrying repeatedly.

Getting better results

  • Write task descriptions like you would for a junior engineer: clear goal, relevant files, and a definition of done.
  • Keep context focused. More context is not always better, and it costs input tokens.
  • Use Cursor’s rules or conventions features so Sonnet 5 follows your project’s style.
  • Review every diff. Agentic models are powerful, but you own the code they produce.

Frequently asked questions

Is Sonnet 5 available in Cursor? Yes. Cursor was an early-access partner and supports Claude Sonnet 5.

Should I use Sonnet 5 or Opus 4.8 in Cursor? Use Sonnet 5 for most work and switch to Opus 4.8 for the hardest tasks.

Does Cursor use the full 1M context window? Cursor manages how much context it sends. You can guide it by referencing specific files and symbols.

Do I need my own API key? You can use your own Anthropic key or Cursor’s built-in access through its billing.

Can I use my own Anthropic API key in Cursor for Sonnet 5? Yes. Add your key under Cursor’s API key settings, or use Cursor’s built-in access through its own billing. Using your own key gives you direct control over usage and cost.

Does Sonnet 5 work with Cursor’s Tab and inline edits, not just Agent? Yes. You can select Sonnet 5 for chat, inline edits, and Agent mode. Its strengths are most visible in Agent mode on multi-step tasks, but it works across Cursor’s features.

Is Sonnet 5 a good replacement for Sonnet 4.6 in Cursor? Yes. It completes more multi-step tasks without intervention and checks its own work, so most Cursor users will see fewer stalled or abandoned runs. See Sonnet 5 vs Sonnet 4.6.

The bottom line

Sonnet 5 is a strong default for Cursor: enable it, use it in Agent mode for multi-step work, keep context focused, and switch to Opus 4.8 for the hardest tasks. For the full model details, read the complete guide.