How to Use Claude Sonnet 5 in Cursor

Learn how to use Claude Sonnet 5 in Cursor: enable it in the model picker, add your Anthropic API key with BYOK, use agent mode, and manage cost.

Ashley Innocent

Ashley Innocent

1 July 2026

How to Use Claude Sonnet 5 in Cursor

Apidog for Enterprise

On-Premises Deploy

SSO & RBAC

SOC 2 Compliant

Explore Apidog Enterprise

Claude Sonnet 5 landed on June 30, 2026, and it is a strong fit for how most people use Cursor. Anthropic calls it its most agentic Sonnet model yet, with tool-use performance close to Opus 4.8 at a much lower price. That matters in Cursor, where the model spends most of its time reading files, editing code, and running commands in a loop. This guide shows you how to enable Sonnet 5 in Cursor, when to use your own Anthropic API key, how to get the most out of agent mode, and when to switch to a bigger model. For the full model overview, read what is Claude Sonnet 5, and Anthropic’s official announcement covers the launch details.

You will also see where Apidog fits: when Cursor and Sonnet 5 build an API for you, Apidog is where you send requests, save them, mock responses, and run automated tests against the endpoints.

Why Sonnet 5 is a good default in Cursor

Cursor’s agent does a lot of small, tool-driven steps. It opens files, applies edits, searches the codebase, and runs terminal commands. That is exactly the kind of work where Sonnet 5 shines.

Anthropic’s launch benchmarks put Sonnet 5 within a few points of Opus 4.8 on agentic tasks. On SWE-bench Pro, a coding benchmark, the reported figures were 63.2% for Sonnet 5 and 69.2% for Opus 4.8, up from 58.1% on Sonnet 4.6. On Terminal-Bench 2.1, Sonnet 5 scored 80.4% against Opus 4.8’s 82.7%. On OSWorld-Verified, a computer-use benchmark, Sonnet 5 hit 81.2% versus 83.4% for Opus 4.8. These are Anthropic’s reported numbers, not our own testing. For the full table, see the Claude Sonnet 5 benchmarks breakdown.

The pattern is consistent. With tools in the loop, Sonnet 5 lands within about one to three points of Opus 4.8. On pure reasoning, Opus pulls ahead by around six points. Cursor almost always has tools in the loop, so you get most of the top-tier quality without paying the top-tier price.

Price is the other half. Sonnet 5 costs the same per token as Sonnet 4.6: $3 per million input tokens and $15 per million output tokens on the standard rate. Anthropic is running an introductory rate of $2 per million input and $10 per million output through August 31, 2026. Opus 4.8 costs $5 per million input and $25 per million output. In a long agent session, that gap adds up fast.

Two ways to use Sonnet 5 in Cursor

Cursor supports Anthropic’s Claude models directly, and it also supports bring-your-own-key (BYOK) if you want to bill through your own Anthropic account. Menu wording changes between Cursor versions, so treat these as the shape of the flow rather than exact steps.

Option 1: Cursor’s built-in model picker

If your Cursor plan includes Claude models, this is the fastest path.

  1. Open Cursor and press the model selector. It usually sits in the chat or Composer input, or under Settings.
  2. Look for Claude Sonnet 5 in the model list.
  3. Select it. Cursor now routes your requests through Sonnet 5 for chat, edits, and agent runs.

New models can take a short while to appear in a given Cursor build. If you do not see Sonnet 5 yet, update Cursor to the latest version, then check again. For more setup help, the Cursor setup guide walks through configuration from scratch.

Option 2: Bring your own Anthropic API key

BYOK is useful when you want direct control over billing, higher limits tied to your account, or a model your Cursor plan does not bundle.

  1. Get an Anthropic API key from the Claude Console. Create a key under your organization’s API keys.
  2. In Cursor, open Settings and find the model or API keys section.
  3. Paste your Anthropic key into the Anthropic provider field and save.
  4. Select Claude Sonnet 5 as your active model.

The model ID Anthropic exposes is claude-sonnet-5, an exact string with no date suffix. You do not usually type the ID into Cursor’s UI, but you will need it if you script anything against the API yourself. Our Claude Sonnet 5 API guide covers the raw request shape, the model ID, and the response format in detail.

Keep your API key out of your codebase. Store it in an environment variable or your OS keychain, and never commit it to git.

What changed under the hood (and why it matters for Cursor)

Sonnet 5 is a drop-in replacement for Sonnet 4.6 at the API level, but a few behavior changes are worth knowing even inside Cursor.

Adaptive thinking is now on by default. On Sonnet 4.6, a request with no thinking field ran without thinking. On Sonnet 5, that same request runs with adaptive thinking. In Cursor, this means the model reasons more before it acts on a hard task, which is what you want for planning multi-file changes. Output can include thinking tokens, so responses may take a little longer and cost a little more on tricky prompts.

Sonnet 5 also ships a new tokenizer. The same input text produces roughly 30% more tokens than on Sonnet 4.6, about 1.3 times as many. The request and response shapes are identical, so nothing breaks. But anything you measure in tokens shifts. Your 1M token context window holds a bit less text on average, and the cost of an equivalent request can be higher even though the per-token rate is unchanged. If you track Cursor spend, remeasure against Sonnet 5 rather than reusing your 4.6 numbers.

Two more constraints matter if you script directly against the API. Manual extended thinking with budget_tokens returns a 400 error. Setting temperature, top_p, or top_k to a non-default value also returns a 400 error. Steer behavior through your prompt instead. Cursor handles this inside its own model calls, so you only hit these if you build against the Anthropic API yourself.

Using Sonnet 5 in Cursor’s agent mode

Agent mode is where Sonnet 5 earns its place. It lets the model read your project, plan a change, edit multiple files, run terminal commands, then check its own work.

A workflow that holds up well:

  1. Describe the outcome, not the steps. Tell Sonnet 5 what you want built and which files or folders are in scope.
  2. Let it plan first. With adaptive thinking on, Sonnet 5 tends to lay out an approach before it edits. Read the plan and correct it early if it drifts.
  3. Keep tasks scoped. Smaller, well-defined tasks give cleaner diffs and cost less than one giant open-ended prompt.
  4. Review every diff. The model is strong on agentic coding, but you still own the merge.

Because Cursor keeps tools in the loop, Sonnet 5’s agentic strength shows up directly. It handles the read, edit, run, verify cycle well without you reaching for a more expensive model on routine work.

A realistic example: build an API, then test it

Say you ask Sonnet 5 in Cursor to scaffold an Express route that creates an order and returns it as JSON.

// routes/orders.js
const express = require('express');
const router = express.Router();

router.post('/orders', (req, res) => {
  const { customerId, items } = req.body;
  if (!customerId || !Array.isArray(items) || items.length === 0) {
    return res.status(400).json({ error: 'customerId and items are required' });
  }
  const order = {
    id: `order_${Date.now()}`,
    customerId,
    items,
    status: 'created',
  };
  return res.status(201).json(order);
});

module.exports = router;

Cursor and Sonnet 5 can generate this, wire it into your app, and even draft a test. But generated code still needs real verification against real requests. That is where Apidog comes in.

In Apidog, you can:

Cursor and Sonnet 5 write the code fast, and Apidog gives you a reproducible way to confirm the API behaves. If you have moved off other tools, this API testing without Postman walkthrough shows the testing flow end to end. Download Apidog to follow along with your own endpoints.

Cost and usage notes

Cursor manages its own billing, limits, and model access, and those specifics change over time, so check Cursor’s current plan details directly. A few principles hold regardless of the plan:

For a wider look at picking a model inside Cursor, see the best Cursor model comparison.

When to switch models

Sonnet 5 covers most Cursor work well. Switch up to Opus 4.8 for the hardest reasoning: gnarly architecture decisions, subtle debugging that needs deep step-by-step reasoning, or long-horizon autonomous runs where quality matters more than cost. On pure reasoning without tools, Opus 4.8 leads Sonnet 5 by around six points on the reported benchmarks, and that margin can be worth the premium on the toughest tasks.

For everything else, from feature work to refactors to writing and running tests, Sonnet 5 gives you close-to-Opus agentic performance at a lower price. Keep Sonnet 5 as your default and bump to Opus 4.8 only when a task actually stalls.

Frequently asked questions

Is Claude Sonnet 5 available in Cursor? Cursor supports Anthropic’s Claude models, and Sonnet 5 should appear in the model picker once your Cursor build supports it. If it is missing, update Cursor to the latest version. You can also add it through bring-your-own-key with an Anthropic API key.

Do I need my own API key to use Sonnet 5 in Cursor? Not always. If your Cursor plan bundles Claude models, you can select Sonnet 5 without a key. Use BYOK when you want to bill through your own Anthropic account or need direct control over limits. The Claude Sonnet 5 API guide explains how to create a key.

Is Sonnet 5 or Opus 4.8 better for coding in Cursor? For most Cursor work, Sonnet 5 is the better value because it performs close to Opus 4.8 on agentic coding at a lower price. Reach for Opus 4.8 on the hardest reasoning tasks. The Sonnet 5 vs Opus 4.8 comparison breaks down the tradeoff.

Why does Sonnet 5 seem to use more tokens than Sonnet 4.6? Sonnet 5 uses a new tokenizer that produces roughly 30% more tokens for the same text. The per-token price is unchanged, but the cost of equivalent requests can be higher. Measure your real workloads instead of reusing older token counts.

Can I use Sonnet 5 in Cursor for free? That depends on your Cursor plan, which Cursor controls. Sonnet 5 is the default model on the free Claude web and app plan, but that is separate from Cursor. Check Cursor’s current plan details for what is included.

button

Explore more

Claude Sonnet 5 vs Opus 4.8: Which Model Should You Use?

Claude Sonnet 5 vs Opus 4.8: Which Model Should You Use?

Claude Sonnet 5 vs Opus 4.8 compared: price, context, benchmarks, and a decision checklist for picking the right model for agents, reasoning, or high volume.

1 July 2026

How to Use Claude Sonnet 5 in Claude Code

How to Use Claude Sonnet 5 in Claude Code

Learn how to select and use Claude Sonnet 5 in Claude Code: the /model command, adaptive thinking, a real coding workflow, cost, and when to switch to Opus 4.8.

1 July 2026

How to Use the Claude Sonnet 5 API (Step-by-Step with Apidog)

How to Use the Claude Sonnet 5 API (Step-by-Step with Apidog)

Call the Claude Sonnet 5 API step by step: get a key, use the claude-sonnet-5 model ID, handle adaptive thinking, avoid 400s, and test in Apidog.

1 July 2026

Practice API Design-first in Apidog

Discover an easier way to build and use APIs

How to Use Claude Sonnet 5 in Cursor