Model chooser  /  Build or fix software  /  Recurring

For coding that runs every day, use Claude Sonnet 5.

Automated code review, test generation and small fixes run hundreds of times. Sonnet 5 gives near-Opus coding quality at a medium cost tier with the same 1M context, which is the trade a pipeline needs.

Why Claude Sonnet 5

The reasons it wins for this job.

  • Anthropic calls Sonnet 5 its "best combination of speed and intelligence". In CI, a review that lands before the developer switches tasks is worth more than a slightly better one that lands later.
  • It scores 85.2% on SWE-bench Verified in third-party reporting, within a few points of the Opus tier at well under half the per-token price.
  • It has the same 1M-token context and 128K output as Opus 5, so a whole diff plus the files it touches fits in one request.
  • It supports prompt caching. Put the repo conventions and style guide in a cached prefix and every run after the first reads them at a fraction of the input cost.

How to use it

4 steps to a first result.

  1. 1Pick one narrow jobStart with one: review every pull request for a checklist, write missing tests, or fix lint failures. A narrow job is measurable.
  2. 2Freeze the instructionsPut your conventions in a system prompt that never changes between runs, and mark it for caching.
  3. 3Wire it into CICall the API from a GitHub Action or your CI runner with the diff as input. Post the result as a PR comment, never as a direct commit at first.
  4. 4Measure, then tune effortTrack how often reviewers accept its comments. Try effort: "medium"; if acceptance holds, keep the cheaper setting.

Claude API, TypeScript

Start from this.

Edit the parts in capitals, then run it.

import Anthropic from "@anthropic-ai/sdk";
import { readFileSync } from "node:fs";

const client = new Anthropic(); // reads ANTHROPIC_API_KEY
const diff = readFileSync("pr.diff", "utf8");

const res = await client.messages.create({
  model: "claude-sonnet-5",
  max_tokens: 16000,
  thinking: { type: "adaptive" },
  output_config: { effort: "medium" },
  system: [
    { type: "text", text: readFileSync("REVIEW_RULES.md", "utf8"), cache_control: { type: "ephemeral" } },
  ],
  messages: [{ role: "user", content: `Review this pull request against the rules. List only real problems, each with file:line.\n\n${diff}` }],
});

for (const block of res.content) if (block.type === "text") console.log(block.text);
Nothing is sent anywhere. It copies to your clipboard.

Alternatives that also work

If Claude Sonnet 5 is not an option.

Claude Opus 5Official page →

Anthropic · closed · cost: high

Pick it when the job is multi-step and agentic, such as fixing a failing build end to end, and a wrong fix is expensive.

DeepSeek V4.1 FlashHugging Face →

DeepSeek · open weights · cost: low · 391K HF downloads/mo

Pick it when volume is very high and cost dominates. It is MIT-licensed, has a cheap hosted API with off-peak pricing, and scores 74.2 on DeepSWE on its model card.

Qwen3.8 27BHugging Face →

Alibaba Qwen · open weights · cost: free weights; you pay for the hardware · 7.5M HF downloads/mo

Pick it when code must stay on your own machine. It is Apache 2.0, fits one 24GB GPU at 4-bit, and reports 61.7 on SWE-bench Pro.

Watch out for

Doing this just once? For a one-off build, code it with Claude Opus 5. Anthropic built Opus 5 for complex agentic coding, it runs inside Claude Code, and it sits in the top tier of every coding benchmark that still separates models. For one project, that is the whole decision.

Sources

Checked . Models change monthly; we re-check this page when they do.

Picking the model is the easy part.

Wiring it into a workflow that runs every week, with evals, fallbacks and a cost you can predict, is the work. Fifteen minutes, no deck.

Book fifteen minutes →