★ Reading this for free? Get 25 structured AI courses + per-chapter AI tutor — the first chapter of every course free, no card.Start free in 30 secondsOr own every course: $149 once
AI Models

Best Claude Model for Coding: Opus vs Sonnet vs Fable vs Haiku

April 14, 2026
22 min read
Barsha Mohapatra

Want to go deeper than this article?

Free account unlocks the first chapter of all 25 courses — RAG, agents, MCP, voice AI, MLOps, real GitHub repos.

📚AI Learning Path

Picked your coding model? Build a real AI dev workflow. From local copilots to agents that ship code — the structured path, running on your hardware. First chapter free.

Start free
Or own it for life — Lifetime $149, pay once

Published on April 14, 2026 · Updated November 2, 2026 · 22 min read

TL;DR (November 2026): The best Claude model for most coding is Claude Opus 5.5 ($4 input / $20 output per million tokens). Anthropic's documentation says to start with it "for most workloads", it is the default model in Claude Code on Pro, Max, Ultra, Team, Enterprise and API accounts, and in Anthropic's own September 2026 announcement it beat the pricier Fable 5.1 on every coding benchmark shown. Pick Claude Sonnet 5.5 ($2 / $10) when you want faster answers at half the price, Claude Fable 5.1 ($10 / $50) only for long-horizon agentic work where Opus at higher effort still falls short, and Claude Haiku 5.5 (from $0.10 / $0.50) for subagents, bulk edits and docstrings.

ModelAPI IDPrice per 1M tokens (in / out)Default effortBest coding use
Claude Opus 5.5claude-opus-5-5$4 / $20mediumDefault for coding and Claude Code; review, debugging, long agent runs
Claude Sonnet 5.5claude-sonnet-5-5$2 / $10highFast daily driver: generation, tests, small refactors
Claude Fable 5.1claude-fable-5-1$10 / $50highLongest, hardest multi-file agentic work
Claude Haiku 5.5claude-haiku-5-5from $0.10 / $0.50mediumSubagents, bulk edits, docstrings, routing

All four have a 1M-token context window and 128K maximum output. Source: Anthropic's models overview and pricing, read November 2, 2026.

The lineup has changed several times since spring. In June 2026 Anthropic introduced Claude Fable 5, a new tier above Opus, and Claude Sonnet 5. Between September 1 and early October it replaced the whole ladder: Fable 5.1 (September 1), Opus 5.5 (September 22), Sonnet 5.5 (September 28) and Haiku 5.5. The June models are still available as legacy models, and the table of older Claude models below covers everything from Claude 3 Sonnet onward.

One June event is worth knowing before you build a workflow on any single cloud model: Anthropic suspended access to Fable 5 and Mythos 5 on June 12, 2026 and redeployed them on July 1, 19 days later. Its announcement gives no reason. A coding setup that depends on one cloud model has a single point of failure outside your control, which is one more reason the hybrid local-plus-cloud pattern at the end of this guide keeps gaining ground.

This guide breaks down where each tier fits for code review, debugging, refactoring, documentation and agentic work, and how to choose without treating a benchmark table as permanent truth.

The short answer: Opus 5.5 by default, Sonnet 5.5 when speed and cost matter, Haiku 5.5 for volume, Fable 5.1 rarely. Here is why.


The Claude Model Lineup

Anthropic offers four current tiers through the Claude API, claude.ai and Claude Code. All four take text and image input, use adaptive thinking (the model decides how much to think, steered by an effort setting), and have a June 2026 knowledge cutoff.

Claude Opus 5.5 (the default)

Released September 22, 2026. Anthropic describes it as built "for long-running agentic coding and knowledge work" and tells developers to start here.

Key specs:

  • $4 input / $20 output per million tokens, cheaper than the $5 / $25 of Opus 5 and Opus 4.8 before it
  • 1M-token context, 128K output tokens
  • Adaptive thinking always on; default effort medium (raise it to high, xhigh or max for hard problems)
  • Fast mode at $8 / $40 with up to 2.5x speed, also available in Claude Code
  • Anthropic-reported: 66.4% on Terminal-Bench 4.0 (xhigh effort), 54.4% on FrontierCode, 57.8% on CursorBench 4.0

Claude Sonnet 5.5

Released September 28, 2026. "The best combination of speed and intelligence", in Anthropic's words, at half Opus 5.5's price.

Key specs:

  • $2 input / $10 output per million tokens
  • 1M-token context, 128K output tokens
  • Default effort high; Anthropic suggests starting agentic coding at medium for well-specified tasks and high for harder ones
  • Rejects temperature, top_p and top_k (a 400 error), so drop them from old code
  • Vendor-reported SWE-bench Pro: 81.3% (llm-stats aggregate of Anthropic's figure, October 2026)

Claude Fable 5.1 (above Opus)

Released September 1, 2026, extending Fable 5 (June 9) at the same price with cheaper cache reads and, per Anthropic, "stronger long-running agentic coding". Its sibling Claude Mythos 5.1 has the same capabilities but is limited to organizations in Anthropic's verification programs.

Key specs:

  • $10 input / $50 output per million tokens, 2.5x Opus 5.5
  • 1M-token context, 128K output tokens; default effort high
  • Anthropic: use it "for demanding reasoning and long-horizon agentic work, or when your evals on Claude Opus 5.5 at higher effort still don't meet your requirements"
  • Anthropic's example for Fable 5: Stripe reported a migration in a 50-million-line Ruby codebase completed in a day that would otherwise have taken a team over two months by hand
  • In Anthropic's Opus 5.5 announcement, Fable 5.1 scored below Opus 5.5 on Terminal-Bench 4.0 (55.8%), FrontierCode (50.3%) and CursorBench (51.8%)

Claude Haiku 5.5

The fast, cheap tier "for high-volume, latency-sensitive tasks such as classification, extraction, and routing".

Key specs:

  • From $0.10 input / $0.50 output per million tokens for prompts up to 100,000 tokens; $0.50 / $2.50 above that
  • 1M-token context, 128K output tokens; default effort medium, which Anthropic recommends for most work including agentic coding
  • Vendor-reported SWE-bench Pro: 64.8%, above the 63.2% reported for Sonnet 5 (llm-stats aggregate, October 2026)

Reading articles is good. Building is better.

Free account = the first chapter of all 25 courses, with a per-chapter AI tutor. No card.

Coding Benchmarks and How to Use Them

SWE-bench tests whether a model can resolve real GitHub issues; Terminal-Bench tests agentic work in a shell. Three kinds of numbers circulate, and they disagree because the harnesses differ.

Anthropic's own launch table (September 22, 2026). The Opus 5.5 announcement is the only primary source that puts the current models side by side in text:

BenchmarkOpus 5.5Fable 5.1Opus 5GPT-6 AstraGPT-5.6 Sol
Terminal-Bench 4.066.4%55.8%52.3%57.9%37.3%
FrontierCode v1.1 (Main)54.4%50.3%48.0%53.3%47.5%
CursorBench 4.057.8%51.8%46.6%not published41.7%

Source: Anthropic, Claude Opus 5.5, read November 2, 2026. Opus 5.5 at max effort (xhigh on Terminal-Bench 4.0, high for GPT-6 Astra). At default (medium) effort Anthropic reports 54.6% on FrontierCode and 52.5% on CursorBench. Sonnet 5.5 and Haiku 5.5 were not in this table.

Vendor-reported SWE-bench Pro, as collected by the llm-stats aggregator on October 14, 2026: Opus 5.5 89.9%, Sonnet 5.5 81.3%, Fable 5 80.0%, Opus 4.8 69.2%, Haiku 5.5 64.8%, Opus 4.7 64.3%, Sonnet 5 63.2%. These are Anthropic's self-reported figures (its posts show them in charts), not an independent run.

Independent boards lag behind. On the official swebench.com Verified leaderboard, where every model runs in the same minimal agent, the best Claude entry is still Claude 4.5 Opus at 76.8%, with Claude 4.6 Opus at 75.6%; none of the September 2026 models has an entry yet. Scale AI's standardized SWE-Bench Pro board tops out at 61.5%, while vendor-reported Pro numbers reach the high 80s. Our SWE-bench explained guide walks through why.

TierBest UseWhy It Wins
Opus 5.5Default coding, review, debugging, long agent runsTop of Anthropic's own coding table at less than half Fable's price
Sonnet 5.5Daily coding, refactoring, testsHalf Opus's price and faster; strong vendor-reported SWE-bench Pro
Fable 5.1The longest multi-file agentic runsAnthropic's pick for long-horizon work when Opus at high effort falls short
Haiku 5.5Subagents, bulk edits, docstringsCheapest per token by far, and stronger on code than earlier Haikus

What this means in practice:

  1. Opus 5.5 is the correct default until it fails. Raise effort before you switch to Fable.
  2. Do not use Haiku for security review or architecture. The task is too high stakes.
  3. Use Sonnet 5.5 when you are iterating quickly and the task is well specified.
  4. Re-check Anthropic's models page before building cost calculators around exact model names and prices; this lineup changed several times in 2026.

Older Claude Models

Many guides, tutorials and tool presets still name earlier Claude models. Here is what each one was, what it published for coding, and whether you can still call it. Prices and status are from Anthropic's pricing page and models overview (read November 2, 2026); SWE-bench Verified figures are from each model's launch announcement unless marked.

ModelReleasedStatus (Anthropic API)Price per 1M (in / out)Published coding figure
Claude Fable 5June 9, 2026Legacy, still available$10 / $50SWE-bench Pro 80.0% (vendor-reported, llm-stats)
Claude Sonnet 5June 30, 2026Legacy, still available$2 / $10 (intro price made permanent Aug 10, 2026)SWE-bench Pro 63.2% (vendor-reported, llm-stats)
Claude Opus 52026Legacy, still available$5 / $25Terminal-Bench 4.0 52.3% (Anthropic, Opus 5.5 announcement)
Claude Opus 4.8May 28, 2026Legacy, still available$5 / $25; fast mode $10 / $50 at 2.5x speedSWE-bench Pro 69.2% (vendor-reported, llm-stats)
Claude Opus 4.7April 16, 2026Legacy, still available$5 / $25SWE-bench Pro 64.3% (vendor-reported, llm-stats)
Claude Sonnet 4.62026Legacy, still available$3 / $15not published in text
Claude Opus 4.62026Legacy, still available$5 / $2575.6% on swebench.com (official board)
Claude Opus 4.5November 24, 2025Legacy, still available$5 / $2576.8% on swebench.com (official board)
Claude Haiku 4.5October 15, 2025Legacy, still available$1 / $573.3% SWE-bench Verified (Anthropic, average of 50 trials)
Claude Sonnet 4.5September 29, 2025Priced, not in the legacy list$3 / $1577.2% SWE-bench Verified (Anthropic, average of 10 trials)
Claude Opus 4.1August 5, 2025Retired, except on Bedrock and Google Cloud$15 / $7574.5% SWE-bench Verified (Anthropic)
Claude Sonnet 4May 22, 2025Retired, except on Bedrock and Google Cloud$3 / $1572.7% SWE-bench Verified (Anthropic)
Claude Opus 4May 22, 2025Retired, except on Google Cloud$15 / $7572.5% SWE-bench Verified (Anthropic)
Claude 3.5 Sonnet (Oct 2024)October 22, 2024Retiredwas $3 / $1549.0% SWE-bench Verified (Anthropic)
Claude 3 SonnetMarch 4, 2024Retiredwas $3 / $15none; 200K context at launch

Sources: models overview, pricing, model deprecations; announcements for Claude 3, Claude 4, Opus 4.1, Sonnet 4.5, Haiku 4.5, Opus 4.5, Opus 4.8, Fable 5 and Mythos 5 and Sonnet 5; Artificial Analysis on Opus 4.8 and on Fable 5 for independent intelligence-index runs; swebench.com; llm-stats SWE-bench Pro. The SWE-bench Verified figures from 2025 announcements came from Anthropic's own harness and are not comparable with the official board.

Notes on the older models people still ask about:

  • Claude Sonnet 4 was the model many coding tools defaulted to through 2025. Its 72.7% on SWE-bench Verified (80.2% with Anthropic's high-compute setup) was state of the art at launch in May 2025. If a tool or tutorial still names it, swap in Sonnet 5.5: it costs less per token ($2 / $10 against $3 / $15).
  • Claude Opus 4.1 was a $15 / $75 model. Every Opus since 4.5 costs $5 / $25 or less, and Opus 5.5 costs $4 / $20, so an old cost estimate built on Opus 4.1 pricing overstates today's Opus bill by more than three times.
  • Claude Sonnet 4.5 vs Opus 4.1, a common 2025 comparison: Sonnet 4.5 reported the higher SWE-bench Verified score (77.2% vs 74.5%) at a fifth of the price, which started the pattern of the mid tier being the sensible default.
  • Claude Opus 4.8 added a fast mode at $10 / $50 for about 2.5x speed, which Anthropic said was three times cheaper than fast mode on earlier models. Opus 5.5 keeps fast mode at $8 / $40.
  • Claude 3 Sonnet (March 2024) introduced the 200K-token context window to the mid tier; today every current Claude model has 1M (the older Haiku 4.5 stays at 200K).

Pricing Breakdown

Current Prices per Million Tokens

ModelInputOutputCache readBatch API
Haiku 5.5 (prompts up to 100K)$0.10$0.50$0.0150% off
Haiku 5.5 (prompts over 100K)$0.50$2.50$0.0550% off
Sonnet 5.5$2$10$0.1050% off
Opus 5.5$4$20$0.2050% off
Fable 5.1$10$50$0.2550% off

Source: Anthropic pricing, read November 2, 2026. Claude 4.7 and later models use a newer tokenizer that Anthropic says produces about 30% more tokens for the same text, so compare costs on real prompts rather than by price alone.

Typical Daily Cost by Developer Profile

ProfileBest DefaultEscalate To
Casual hobby codingSonnet 5.5Opus 5.5 for hard bugs
Active developerOpus 5.5 at medium effortOpus 5.5 at high or xhigh effort
Bulk automationHaiku 5.5Sonnet 5.5 when quality drops
Team workflowOpus 5.5 or Sonnet 5.5 with budget alertsFable 5.1 for the hardest long runs

The practical math: effort is now the main cost lever. Opus 5.5 defaults to medium effort; raising it buys more thinking tokens, and thinking counts toward output. Measure actual token usage for a week before setting a budget.

Claude Subscription vs API

Claude subscription plans are usually simpler for individual developers because they include claude.ai, Claude Code and the desktop apps under one bill. API access is better when you need automation, team attribution or budget controls, and the Batch API halves prices for anything that can wait.


Own it instead of renting it

Run this on your own machine and stop paying every month

Pay once and keep it. No renewal, no per-token bill, and nothing you feed it ever leaves your hardware.

Speed vs Quality Tradeoff

Speed matters for coding. Anthropic publishes comparative latency for the current lineup: Haiku 5.5 "fastest", Sonnet 5.5 "fast", Opus 5.5 "moderate", Fable 5.1 "slower". Actual latency depends on prompt length, output length and effort.

Relative Latency by Model

TierRelative Latency (Anthropic)Best Speed Use
Haiku 5.5FastestInline suggestions, subagents, short transforms
Sonnet 5.5FastInteractive coding and tests
Opus 5.5ModerateDefault agent work, review, debugging
Fable 5.1SlowerLong-horizon agent runs

Sonnet 5.5 is fast enough for normal coding flow, and dropping Opus 5.5 to low or medium effort also shortens responses. Opus 5.5 fast mode (up to 2.5x speed at $8 / $40) is the option when you want Opus quality with less waiting.

When Speed Beats Quality

  • Inline code suggestions (Haiku)
  • Quick "what does this function do?" queries (Sonnet)
  • Generating boilerplate (Haiku or Sonnet)
  • Iterating on a prompt, running five versions to find the best one (Sonnet)

When Quality Beats Speed

  • Reviewing a PR for security vulnerabilities (Opus at high effort)
  • Debugging a concurrency issue (Opus)
  • Designing an API schema (Opus)
  • Refactoring a 2,000-line module (Opus, or Fable for a very long run)

Best Model by Task

Code Generation

Winner: Sonnet 5.5 for speed, Opus 5.5 for difficult code

For generating new functions, classes and modules, Sonnet 5.5 produces clean code fast enough for active development. Opus 5.5 is the better pick for complex algorithms and edge-case-heavy implementations, and at medium effort the speed gap is small.

Code Review

Winner: Opus 5.5

This is where Opus earns its price. Given a substantial diff, Opus 5.5 at high effort is the better choice for finding:

  • Logic errors that a faster pass misses
  • Race conditions in concurrent code
  • Security issues (SQL injection, XSS, path traversal)
  • Performance problems (N+1 queries, unnecessary allocations)
  • Architectural concerns (coupling, SRP violations)

Debugging

Winner: Opus 5.5

Debugging requires understanding state, control flow and the interaction between components. Adaptive thinking at higher effort lets Opus trace execution paths step by step. Feed it a stack trace, the relevant source files and a description of expected versus actual behaviour.

Refactoring

Winner: Opus 5.5 for large refactors, Sonnet 5.5 for small ones

Renaming a variable, extracting a method, simplifying a conditional: Sonnet handles these well. For refactoring an entire module or migrating a codebase to a new pattern, Opus keeps better track of how changes ripple through the code, and Fable 5.1 is the step up for migrations that run for hours.

Test Writing

Winner: Sonnet 5.5

Test generation is relatively formulaic: read the function signature, understand the edge cases, write assertions. Sonnet does this well and fast. Haiku 5.5 is a reasonable choice for scaffolding many simple tests.

Documentation

Winner: Haiku 5.5

Docstrings, README updates, API documentation and inline comments are exactly where Haiku's price shines: from $0.10 per million input tokens, you can run it across an entire codebase.


Claude Code CLI

Claude Code is Anthropic's official agentic coding tool. It connects Claude to your terminal and filesystem.

What Claude Code Does

  • Reads and writes files across your project
  • Runs terminal commands (build, test, lint)
  • Creates and manages git commits
  • Searches codebases with grep and glob
  • Handles multi-step refactoring autonomously

Default Model and Overrides

According to Claude Code's model-configuration docs, the default model is Opus 5.5 on Pro, Max, Ultra, Team, Enterprise and Anthropic API accounts (Microsoft Foundry defaults to Sonnet 4.5). Fable is never the account default. The aliases resolve as follows on the Anthropic API: opus to Opus 5.5, sonnet to Sonnet 5.5, haiku to Haiku 5.5, fable to Fable 5.1, best to Fable where available, otherwise Opus, and opusplan uses Opus while planning and Sonnet while executing. Each tool call costs tokens, so long agentic sessions on large projects add up.

# Install Claude Code
npm install -g @anthropic-ai/claude-code

# Start an agentic coding session (uses your account default, Opus 5.5)
claude "Refactor the auth module to use JWT instead of sessions"

# Use Sonnet 5.5 for a simpler task
claude --model sonnet "Add input validation to the user form"

# Inside a session: switch models
/model opusplan

Claude Code vs Cursor vs Copilot

FeatureClaude CodeCursorGitHub Copilot
InterfaceTerminal/CLI, IDE and desktop integrationsVS Code forkIDE extension
Typical model choiceOpus / SonnetSeveral vendors' modelsSeveral vendors' models
Agentic capabilityFull (files, terminal, git)Agent modeAgent mode and inline completion
Multi-file editingNativeNativeSupported
CostSubscription or pay per useSubscriptionSubscription
OfflineOnly with a local model through OllamaNoNo
Best forComplex refactoring, debuggingDaily coding in an editorInline completion in existing IDEs

For a deeper comparison of coding tools, see our AI coding tools comparison.


API Integration for Developers

If you are building coding tools or integrating Claude into your workflow, use the current model IDs and the effort parameter. The manual budget_tokens "extended thinking" mode from earlier models is not accepted by the current models.

Basic API Call for Code Review

import anthropic

client = anthropic.Anthropic()

message = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=8192,
    messages=[
        {
            "role": "user",
            "content": """Review this Python function for bugs and suggest improvements:

def calculate_discount(price, discount_percent):
    if discount_percent > 100:
        return 0
    final_price = price - (price * discount_percent / 100)
    return final_price"""
        }
    ]
)

for block in message.content:
    if block.type == "text":
        print(block.text)

Choosing Model by Task in Code

def get_model_for_task(task_type: str) -> str:
    """Select a Claude model by task. IDs from Anthropic's models overview, November 2026."""
    model_map = {
        "autocomplete": "claude-haiku-5-5",
        "generate": "claude-sonnet-5-5",
        "review": "claude-opus-5-5",
        "debug": "claude-opus-5-5",
        "refactor_small": "claude-sonnet-5-5",
        "refactor_large": "claude-opus-5-5",
        "test": "claude-sonnet-5-5",
        "document": "claude-haiku-5-5",
    }
    return model_map.get(task_type, "claude-opus-5-5")

More Thinking for Complex Problems: the Effort Parameter

# Opus 5.5 always thinks adaptively; effort controls how much (low, medium, high, xhigh, max)
message = client.messages.create(
    model="claude-opus-5-5",
    max_tokens=32000,  # thinking counts toward max_tokens, so leave room
    output_config={"effort": "high"},
    messages=[
        {
            "role": "user",
            "content": "This async Python function deadlocks intermittently. Identify every potential race condition: [code here]"
        }
    ]
)

Opus 5.5 defaults to medium effort; Sonnet 5.5 and Fable 5.1 default to high. Anthropic's effort documentation suggests xhigh for long-running agentic and coding tasks and an effort sweep on your own evals rather than carrying settings over from older models.


Claude vs Other Coding Models

Claude is not the only serious coding option. OpenAI, Google and open-weight local models are all competitive depending on your workflow. Our best AI coding models ranking compares current models from every vendor on the same tables.

Strengths by Provider

Claude (Anthropic):

  • Strong multi-file understanding, refactoring and code review
  • Claude Code provides a terminal-native agent with the model picker built in
  • In Anthropic's own table, Opus 5.5 leads GPT-6 Astra on Terminal-Bench 4.0 (66.4% vs 57.9%)

OpenAI models:

  • Strong ecosystem integration across developer tools, and Codex CLI
  • Good choice if your stack already uses OpenAI APIs

Gemini models:

  • Strong long-context and multimodal workflows
  • Useful when screenshots, UI diagrams or very large inputs matter

Which to Choose?

For code review and agentic debugging: Claude Opus 5.5. For fast, cheaper daily cloud coding: Claude Sonnet 5.5. For ecosystem integration: the model family already wired into your tooling. For local/private coding: none of these; see the next two sections and our best local AI coding models.


Can You Run Claude Locally?

No. Anthropic has never released the weights of any Claude model, current or legacy. Claude runs only through Anthropic's API and apps and the cloud platforms that resell it (Amazon Bedrock, Google Cloud, Microsoft Foundry). Any download claiming to be "Claude weights" is not from Anthropic.

What you can do locally:

  • Run an open-weight coding model that fits your hardware. Qwen3-Coder 30B (qwen3-coder:30b, 19GB) fits a 24GB GPU; Devstral Small 2 (devstral-small-2:24b, 15GB) is Mistral's agentic coder; Qwen3-Coder-Next (qwen3-coder-next, 52GB) needs 64GB. Our best Ollama model for coding page has the pick for each VRAM tier.
  • Keep Claude Code and swap the model. Claude Code can talk to a local model served by Ollama, covered step by step below and in our Claude Code offline guide.

When a Local Model Wins (and Saves Money)

This is a guide to the best Claude model for coding, and for the hardest agentic and review work Claude is worth it. But a cloud API is not always the right answer. A lot of everyday coding now runs well on an open-weight model on your own machine: no per-token bill, no data leaving your laptop, no internet required.

Choose a local model instead of Claude when one of these is true:

  • Privacy / data sovereignty. Proprietary code, client work under NDA, healthcare or regulated data: if it cannot leave your network, a local model is the requirement, not a compromise.
  • Cost at volume. Sonnet 5.5 is $2 / $10 per million tokens, Opus 5.5 $4 / $20 and Fable 5.1 $10 / $50. That is cheap for occasional use, but autocomplete and bulk edits all day add up. A local model is free per token after the hardware you already own.
  • Availability risk. Fable 5 was unavailable to every user for 19 days in June 2026. Local weights on your own disk cannot be switched off by anyone else.
  • Offline / air-gapped. On a plane, on a locked-down corporate network or in a secure facility, a cloud API is not available. A local model keeps working.
  • High-volume low-stakes work. Autocomplete, docstrings, boilerplate and simple transforms, the tasks where you would otherwise reach for Haiku, run fine locally.

The local coding models that are now good enough:

  • Qwen3-Coder 30B (qwen3-coder:30b, 19GB): a coding-specific mixture-of-experts model with 3.3B parameters active per token, so it generates at small-model speed on a 24GB GPU or a 32GB Mac. The official swebench.com board lists it at 51.6% on SWE-bench Verified inside the OpenHands agent. See our Qwen3-Coder guide.
  • Devstral Small 2 (24B) (devstral-small-2:24b, 15GB): Mistral's purpose-built coding-agent model. Mistral reports 68.0% on SWE-bench Verified; the official board lists it at 56.4% with its own harness. Mistral says it runs on a single RTX 4090 or a 32GB Mac. See our Devstral deep dive.
  • Codestral (codestral:22b): Mistral's fill-in-the-middle specialist for fast inline completion, the workload where Haiku would otherwise be your cloud default.

If you have a 12-16GB GPU, the 14B-class tier is the sweet spot for refactors and tests on a mid-range card; our roundup of the best 14B coding models ranks the options. For the full picture across every VRAM tier, see the best local AI models for programming.

Not sure which local model fits your hardware and task? Use our coding model router: pick what you are coding (autocomplete, refactor, debug, agentic, tests) and your GPU, and it returns the open-weight model that fits, and says so when the job has outgrown your hardware and Claude is the better call.

How to actually run a local model inside Claude Code

The section above is about whether to go local. This is the how, because it is what many people mean when they search for the best model for Claude Code.

Ollama added launcher support for coding agents over the summer of 2026. As of Ollama v0.32.11 you can start Claude Code against a local model in one command:

# start Claude Code backed by a local model (24GB GPU)
ollama launch claude --model qwen3-coder:30b

Ollama v0.33.0 went further and added Claude Desktop support, letting you configure the desktop client to use Ollama as a third-party gateway provider, so the same local weights back both the CLI and the desktop app. Both changes are documented in Ollama's release notes.

Two things decide whether this feels good or frustrating:

  • Pick the model by your memory, not by the leaderboard. A 24GB card runs qwen3-coder:30b; 16GB runs devstral-small-2:24b with a short context, or gpt-oss:20b; 12GB runs qwen2.5-coder:14b. Our best Ollama model for coding page has the pick and pull command for each tier.
  • Raise the context length. Agentic coding reads several files at once, and Ollama's default context is conservative. A local model that cannot see enough of your repository will look far worse than it is. Set it per model rather than globally.

For the full walkthrough including config and the failure modes, see running Claude Code offline with Ollama.

Honest limits: where Claude still leads

Local is not a clean sweep. The frontier cloud models still win on the hardest tasks: tangled architectural refactors, subtle concurrency and memory bugs, and long agentic sessions that span many files. On weak hardware (8GB VRAM or CPU-only) you are capped at 7B-class models, and cloud will usually be the smarter route. The most productive setups are hybrid: a local model for routine edits and completions, Claude Opus 5.5 or Sonnet 5.5 for the work where deeper reasoning earns its price.


Code Quality Differences

What does the difference between tiers look like in practice? Take a typical prompt such as "write a rate limiter middleware for Express.js". The following is an illustration of the pattern Anthropic's tier descriptions imply, not a benchmark we ran:

A fast tier (Haiku) tends to return the minimum viable answer: a basic token bucket kept in process memory, which works on one server and leaves distributed deployments and edge cases to you.

The mid tier (Sonnet) tends to return a strong first draft: a sliding-window limiter with per-route limits, proper 429 responses with a Retry-After header, an optional Redis backend and TypeScript types.

The top tier (Opus, at higher effort) spends more attention on failure modes: race conditions in the Redis path, behaviour when Redis is unavailable, separate limits for authenticated and anonymous users, and tests.

The useful habit is the same whichever tier you use: ask explicitly for the failure modes, distributed behaviour and tests you need, rather than relying on the model to volunteer them.


When to Use Each Model

Use Claude Haiku 5.5 When:

  • Running autocomplete, routing or subagents at scale
  • Generating documentation across a large codebase
  • Processing many small, independent code tasks in parallel
  • Budget is the primary constraint
  • The code is simple enough that quality differences are minimal

Use Claude Sonnet 5.5 When:

  • Writing new features during active development and you want fast answers
  • Generating unit tests and integration tests
  • Small to medium refactoring (single file, few files)
  • Interactive debugging with rapid iteration
  • You want half Opus's per-token price

Use Claude Opus 5.5 When:

  • You want one default for everything (it is Anthropic's and Claude Code's default)
  • Reviewing pull requests for production code
  • Debugging complex, multi-component issues
  • Large-scale refactoring and architecture discussions
  • Security audits and long agentic tasks in Claude Code

Use Claude Fable 5.1 When:

  • A task runs for hours across many files and Opus 5.5 at high effort still falls short
  • The cost of a wrong answer outweighs 2.5x the per-token price

A Practical Workflow

A sensible way to use the tiers through a working day:

  1. Code review: Opus 5.5 at high effort reviews the day's PRs
  2. Active development: Sonnet 5.5 for generation and quick debugging
  3. Test writing: Sonnet 5.5 generates test suites
  4. Documentation: Haiku 5.5 generates docstrings in bulk
  5. Hard refactor: Opus 5.5, escalating to Fable 5.1 only for very long runs

Track your own token usage for a week before you budget; effort level and agent tool calls move the bill more than the model choice alone.


Conclusion

The best Claude model for coding is not a single model; it is knowing when to use each tier. Opus 5.5 is the default for a reason: Anthropic recommends it, Claude Code uses it, and it topped Anthropic's own coding table at less than half Fable's price. Sonnet 5.5 is the faster, cheaper daily driver. Haiku 5.5 earns its place for volume. Fable 5.1 is for the rare task that is long and hard enough to justify $10 / $50.

If you are forced to pick just one: Claude Opus 5.5. If cost per token matters more than the last few points of quality: Claude Sonnet 5.5.


Want to compare Claude with local alternatives that run on your own hardware? Check our best AI coding models ranking or set up a free local AI coding assistant with Continue.dev.

🎯
AI Learning Path

Picked your coding model? Build a real AI dev workflow.

From local copilots to agents that ship code — the structured path, running on your hardware. First chapter free.

Or own it for life — Lifetime $149 $599, pay once

Liked this? 25 full AI courses are waiting.

From fundamentals to RAG, agents, MCP servers, voice AI, and production deployment with real GitHub repos. First chapter free, every course.

Reading now
Join the discussion
TagsClaudeOpusSonnetFableHaikuClaude CodeCodingAnthropic

Barsha Mohapatra

Local AI Master writes hands-on courses and hardware guides for running AI on machines you own. Content is checked against current releases and corrected when readers tell us it is wrong.

Build Real AI on Your Machine

RAG, agents, NLP, vision, and MLOps - chapters across 25 courses that take you from reading about AI to building AI.

Want the structured version?

Hands-on courses on local AI, from $8.99 a month. The first chapter of each is free.

AI Learning Path
More on AI Models for Coding
See the full Best Local AI for Coding guide.

Comments (0)

No comments yet. Be the first to share your thoughts!

📅 Published: April 14, 2026🔄 Last Updated: November 2, 2026✓ Manually Reviewed
Barsha Mohapatra

Written by

Barsha Mohapatra

Founder and Editor, Local AI Master · Founder, Little AI Master

Founder of Little AI Master and the editor behind every course and guide on Local AI Master. Years of tutoring students taught her where AI education actually fails.

Build Real AI on Your Machine

RAG, agents, NLP, vision, and MLOps - chapters across 25 courses that take you from reading about AI to building AI.

Was this helpful?

📚
Free · no account required

Grab the AI Starter Kit — career roadmap, cheat sheet, setup guide

No spam. Unsubscribe with one click.

🎯
AI Learning Path

Picked your coding model? Build a real AI dev workflow.

From local copilots to agents that ship code — the structured path, running on your hardware. First chapter free.

Or own it for life — Lifetime $149 $599, pay once
Free Tools & Calculators