How to use Claude Sonnet 4.5 in Claude Code

Dive into this conversational guide on claude code with claude sonnet 4.5! Explore benchmarks, claude code v2.0 updates, and a full step-by-step to integrate Sonnet 4.5 for agents and tasks. Plus, quick pricing ($3/M input) and why it's a dev must-have.

Ashley Goolam

Ashley Goolam

30 September 2025

How to use Claude Sonnet 4.5 in Claude Code

If you have been itching to improve your terminal with the latest AI-powered coding tools, then you’re in the right place. Today, we’re diving into a step-by-step guide on how to use Claude Sonnet 4.5 in Claude Code, focusing on getting you up and running in the terminal. Claude Sonnet 4.5 is Anthropic’s latest AI model, and paired with claude code v2.0, is the ultimate combination. It’s like having a coding genius whispering suggestions as you type. We’ll go through the basics—like its stellar benchmarks and cool new features—but the heart of this guide is a hands-on walkthrough to make claude code with claude sonnet 4.5 your new best friend. Ready to roll? Let’s dive in and get you coding smarter, not harder.

💡
Want a great API Testing tool that generates beautiful API Documentation?

Want an integrated, All-in-One platform for your Developer Team to work together with maximum productivity?

Apidog delivers all your demands, and replaces Postman at a much more affordable price!
button

Claude Sonnet 4.5 and Claude Code v2.0: A Quick Intro

Before we hit the terminal, a quick shoutout to what makes this duo awesome. Claude Sonnet 4.5 is Anthropic’s top-tier coding model, acing benchmarks like OSWorld at 61.4% (a huge leap from Sonnet 4’s 42.2%) and leading SWE-Bench Verified for real-world software tasks. It’s a beast for complex agents, long-running tasks (think 30+ hours), and domains like finance or STEM.

claude sonnet 4.5 benchmarks

Meanwhile, claude code v2.0 brings a revamped terminal UI, a native VS Code extension, searchable prompt history (Ctrl+R), and a killer conversation rewind feature to undo changes with checkpoints. These updates make claude sonnet 4.5 in claude code a dream for devs, but we’ll focus on the terminal setup today. Want the pricing? It’s $3 per million input tokens, $15 per million output tokens, with 200K context windows and up to 90% caching discounts—affordable for most projects.

Now, let’s get to the good stuff: a step-by-step guide to wielding Claude Sonnet 4.5 in Claude Code via your terminal.

claude sonnet 4.5

Step-by-Step Tutorial: Using Claude Sonnet 4.5 in Claude Code

This tutorial assumes you’ve got Node.js and npm installed—standard dev tools. We’ll install or update Claude Code, set it up with a theme and account, select Sonnet 4.5, and start coding. Follow along, and you’ll be prompting like a pro in no time.

Step 1: Install or Update Claude Code

First, let’s make sure you’ve got the latest claude code v2.0. If you’re starting fresh, install it globally with this command in your terminal:

npm install -g @anthropic-ai/claude-code

Already got it? Update to the latest version to ensure you’re rocking claude code v2.0’s new features:

npm update -g @anthropic-ai/claude-code

This grabs the newest package, complete with the redesigned UI and checkpointing goodness. Run claude --version to confirm you’re on the latest (should be 2.0 or higher as of September 2025).

Step 2: Set Up Claude Code with a Theme and Account

Now, let’s get Claude Code ready to roll. Open your terminal and start Claude Code by typing:

claude

The first time you run it, it’ll prompt you to set up. Choose a theme to make your terminal look snazzy—options like “dark,” “light,” or “solarized” pop up. I’m a “dark” fan for that hacker vibe, but pick what suits you. Use the arrow keys or type the theme name, then hit Enter.

Next, you’ll need an Anthropic account with API access. You’ve got two paths:

select a claude code subscription account

I went with a Pro subscription for simplicity—it’s seamless and handles most coding tasks without fuss. Once authenticated, Claude Code saves your creds securely, so you’re set for future sessions.

Step 3: Select Claude Sonnet 4.5 as Your Model

With Claude Code running, you need to pick Sonnet 4.5 as your model. In the terminal, type:

/models

This lists available models. You’ll see options like “claude-opus-4-1,” “claude-sonnet-4,” and the star of the show, “claude-sonnet-4-5” (or “claude-sonnet-4-5-20250929” for the exact build). Select it by typing the name or using arrow keys, then hit Enter.

using claude sonnet 4.5 in claude code v2.0

This locks in Claude Sonnet 4.5, ensuring its 61.4% OSWorld-crushing power is at your fingertips. I did this and got a confirmation: “Model set to claude-sonnet-4-5.” Ready to code!

Step 4: Start Coding with Claude Sonnet 4.5

Now the fun begins. In your project folder, run claude to start a session. Claude Code scans your codebase (it groks entire repos thanks to that 200K token context). Try a natural language prompt like:

Let’s test it. I prompted: “Create a Node.js script to fetch and parse a JSON API.” Claude Sonnet 4.5 whipped up:

const fetch = require('node-fetch');

async function fetchData(url) {
  try {
    const response = await fetch(url);
    if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
    const data = await response.json();
    return data;
  } catch (error) {
    console.error('Fetch error:', error.message);
    return null;
  }
}

// Example usage
fetchData('https://api.example.com/data')
  .then(data => console.log(data))
  .catch(err => console.error(err));

This ran perfectly on my test server, with error handling baked in. Sonnet 4.5’s reasoning nailed the async/await syntax and even added a try-catch—smart!

Step 5: Leverage Claude Code v2.0 Features

Claude code v2.0’s upgrades make coding a breeze. Try these:

native vs code extension

Step 6: Monitor and Optimize Token Usage

Sonnet 4.5’s 200K token context is a beast, but keep an eye on usage via the Anthropic Console or Claude dashboard. Long sessions can rack up tokens, so use prompt caching (up to 90% off) for repeated prompts. I set a hook to run npm test after edits, ensuring no regressions while keeping costs low.

Conclusion: Your Terminal, Turbocharged

There you have it—a hands-on guide to claude sonnet 4.5 in claude code. From installing claude code v2.0 to selecting Sonnet 4.5 and coding like a wizard, you’re now equipped to tackle anything from quick scripts to full-blown apps. The terminal-first approach, with its slick UI and rewind feature, makes this a must-have for devs.

In short, if you're serious about AI-assisted development, fire up Claude Sonnet 4.5 in Claude Code today—it's robust, scalable, and ridiculously user-friendly. Pricing? Just $3 per million input tokens, $15 per million output—wallet-friendly for most. Want to dive deeper into API integrations? Download Apidog for top-notch API documentation and debugging to complement your Claude Code adventures. Happy coding!

button
Download Apidog

Explore more

Codex You've Hit Your Usage Limit: Don't Panic, Here's Your Escape Plan

Codex You've Hit Your Usage Limit: Don't Panic, Here's Your Escape Plan

Ever seen "Codex You've Hit Your Usage Limit" mid-project? Don't sweat it! This guide breaks down what to do: review plans, upgrade, or buy extras. Explore alternatives plus efficiency tips—concise prompts, caching, batching—to avoid codex usage limit pitfalls.

30 September 2025

What Is Status Code: 407 Proxy Authentication Required? The Gatekeeper's Gatekeeper

What Is Status Code: 407 Proxy Authentication Required? The Gatekeeper's Gatekeeper

Discover what the 407 Proxy Authentication Required HTTP status code means, why it happens, and how to fix it. Learn common causes and how Apidog helps developers handle proxy errors with ease.

30 September 2025

What Is Status Code: 406 Not Acceptable? The Picky Eater Protocol

What Is Status Code: 406 Not Acceptable? The Picky Eater Protocol

What is HTTP 406 Not Acceptable? This guide explains this content negotiation error code, how Accept headers work, and how to fix compatibility issues between clients and servers.

30 September 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs