Claude

Anthropic's Claude model family — when to use Opus, Sonnet, or Haiku, and how pricing and usage limits work.

Anthropic’s Claude family offers models optimised for different points on the intelligence / speed / cost curve. Pick based on what you need most for the task at hand.

Models

ModelBest forTrade-off
Claude Opus 4.7Deep research, complex analysis, maximum reasoningHighest intelligence, highest cost, slower responses
Claude Sonnet 4.6Coding, agents, general-purpose tasksNear-Opus intelligence at a much better speed/cost ratio
Claude Haiku 4.5High-volume, low-latency, simple tasksCheapest and fastest, but lower reasoning depth

When to use each

  • Opus 4.7 — multi-step reasoning where quality matters most: research, architecture decisions, hard debugging.
  • Sonnet 4.6 — the default workhorse for coding and agent loops. Best balance of quality, speed and price.
  • Haiku 4.5 — classification, short answers, summarisation and any high-volume task where cost dominates.

Pricing

API pricing, per million tokens (MTok):

ModelInputOutput
Claude Haiku 4.5$1$5
Claude Sonnet 4.6$3$15
Claude Opus 4.7$5$25

Two ways to cut this cost:

  • Batch API — up to 50% off standard token prices for asynchronous workloads.
  • Prompt caching — reuse of cached prefixes is billed at a fraction of the input rate, which helps a lot for agents and long system prompts.

For heavy interactive use, the Claude Pro / Max subscriptions are usually cheaper than pay-as-you-go API usage. For occasional or bursty use, the API is cheaper.

Running multiple agents

For bigger jobs it’s often faster — and kinder to your context window — to split the work across several agents running at once. Three practical patterns:

1. Parallel subagents in one session

Inside Claude Code, spawn subagents with the Agent tool and launch them in the same message so they run concurrently. Each one returns a single summary, keeping the main conversation clean.

> Audit the repo: one agent checks tests, one agent checks the build,
one agent checks for TODO/FIXME comments. Run them in parallel.

Claude will emit three Agent tool calls in one turn, then aggregate the results. Good for independent read-only investigations (search, audits, research).

2. Background agents

When a task is long-running and you don’t need the result immediately, launch it in the background and keep working:

> Run the full type-check and test suite in the background
while we keep refactoring the auth module.

Under the hood this uses run_in_background: true on the Agent or Bash tool. You’ll get a notification when it finishes; in the meantime the main agent stays responsive.

3. Multiple Claude Code sessions (git worktrees)

For truly independent streams of work on the same repo, open one Claude Code session per git worktree.

Each session has its own working tree, its own branch and its own context — no file collisions.

Terminal window
# From the repo root
git worktree add ../site-feature-a -b feature-a
git worktree add ../site-feature-b -b feature-b
# Terminal 1
cd ../site-feature-a && claude
# Terminal 2
cd ../site-feature-b && claude

Typical uses: one session drafts a feature, another runs a long refactor, a third reviews a PR. When done, merge the branches and remove the worktrees with git worktree remove.

Which pattern to pick

  • Subagents — parallel research or checks inside a single conversation.
  • Background agent — one slow task you want to fire-and-forget.
  • Worktrees — multiple features being developed in parallel, each needing its own history.

Monitoring usage

Go to Settings > Usage to see how much of your session and weekly limits you’ve consumed.

  • Current session — how much of your plan’s five-hour session limit you’ve used, and the time left in the session.
  • Weekly limits — when your Opus-only and overall weekly limits reset.

See also: Usage limit best practices.

Remote

The cleanest way is to use Claude Code Desktop’s built-in SSH connection — it’s the official, supported path and avoids installing anything on the remote box.

Setup (Claude Code Desktop SSH):

  1. Update Claude Desktop to v1.2581.0 or later (Claude → Check for Updates).
  2. Make sure you can already ssh user@host from your terminal with a key (~/.ssh/id_ed25519 or similar). Use ssh-copy-id if you haven’t.
  3. In the Desktop app, before starting a session, click the Environment dropdown in the prompt area → + Add SSH connection.
  4. Fill in host, user, and the path to your private key (e.g. ~/.ssh/id_ed25519).
  5. Pick that connection as the environment, choose your project folder on the remote machine, and start prompting. Claude Code reads/edits files and runs commands directly on the remote box.

Alternative: install Claude Code on the remote machine itself

Useful if you want long-running/headless work, or you’re already in a terminal:

Terminal window
# On the remote Linux box
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
npm install -g @anthropic-ai/claude-code
claude # interactive
# or non-interactive:
claude -p "audit nginx config in /etc/nginx and suggest hardening"

Run it inside tmux so the session survives if SSH drops. For automation, the -p (print) flag is the workhorse — pipe logs/files in, get output, exit.

Which to pick: Desktop SSH for interactive day-to-day work; remote install + tmux + -p for scheduled/headless tasks or when you want to drive it from your phone later. Docs: https://docs.claude.com/en/docs/claude-code/overview

Login without a browser

claude /login uses an OAuth flow that redirects to http://localhost:<port> of the machine running claude. On a headless server you have two options.

Option 1 — Forward the OAuth callback over SSH

Connect with the callback port forwarded so your laptop’s browser can reach the listener on the remote:

Terminal window
ssh -L 54545:localhost:54545 user@host

Then on the remote run claude (or /login inside it) and open the printed URL in your laptop’s browser. Sign in with your Pro/Max account; the redirect to http://localhost:54545/... is forwarded back to the remote and login completes.

If the port differs, check the redirect_uri parameter in the URL Claude prints and reconnect with that port.

Option 2 — Log in locally, copy the credentials

If port forwarding is awkward (e.g. bastion restrictions), authenticate on your laptop first and copy the token across.

On Linux, the credentials are a plain file:

Terminal window
scp ~/.claude/.credentials.json user@host:~/.claude/.credentials.json
ssh user@host chmod 600 ~/.claude/.credentials.json

On macOS, Claude Code stores the token in the Keychain. Extract it first:

Terminal window
security find-generic-password -s "Claude Code-credentials" -w \
> /tmp/.credentials.json
scp /tmp/.credentials.json user@host:~/.claude/.credentials.json
ssh user@host chmod 600 ~/.claude/.credentials.json
rm /tmp/.credentials.json

Tokens refresh automatically afterwards, and Pro/Max entitlements follow the account, so subscription usage works on the remote.

There is no “paste the device code back” flow today — /login strictly uses the localhost-redirect OAuth flow, so a fully isolated remote needs one of the two options above.