Skip to content

Claude Sonnet 5 · Coding

Claude Sonnet 5 for coding: our test runs

Claude Sonnet 5 ran our 5 coding prompts in llmwise, through the same pipeline your messages take. Here's every reply as it came, whether it passed, what it cost and what it counts as on Pro, next to the other models.

Based on 5 of our test runs on , through OpenRouter with the app's own prompt and settings. Updated .

Short answer

In our test runs on September 27, 2026, Claude Sonnet 5 passed 5 of 5 of our coding prompts (both hard ones): tied 1st of 15 models. Each reply counted as 1 message on Pro, where it has 125 a month, and cost $0.0102 to run on average.

Prompt by prompt

Each of the 5 coding prompts, and how Claude Sonnet 5's reply did.

Claude Sonnet 5 on each coding prompt
PromptResultCostTime
Turn a title into a URL slugEverydayPassed: All 7 tests passed.$0.00242.3 s
Parse a duration like “1h 30m”EverydayPassed: All 10 tests passed.$0.00362.6 s
Merge overlapping intervalsEverydayPassed: All 7 tests passed.$0.00342.7 s
Evaluate an arithmetic expression, no evalHardPassed: All 15 tests passed.$0.022616.9 s
Parse CSV with quoted fieldsHardPassed: All 8 tests passed.$0.018715.8 s

Every coding reply from Claude Sonnet 5

  1. Turn a title into a URL slug

    An everyday prompt: “Turn a title into a URL slug”, in full.

    Passed: All 7 tests passed.

    ```javascript
    function slugify(title) {
      return title
        .normalize('NFD')
        .replace(/[\u0300-\u036f]/g, '')
        .toLowerCase()
        .replace(/[^a-z0-9]+/g, '-')
        .replace(/^-+|-+$/g, '');
    }
    ```

    669 tokens in, 109 out · 2.3 s · $0.0024 · 1 message on Pro · answered by anthropic/claude-sonnet-5 via Claude Platform on AWS ·

  2. Parse a duration like “1h 30m”

    An everyday prompt: “Parse a duration like “1h 30m””, in full.

    Passed: All 10 tests passed.

    ```javascript
    function parseDuration(text) {
      if (typeof text !== 'string') return null;
    
      const match = text.match(/^\s*(?:(\d+)h)?\s*(?:(\d+)m)?\s*(?:(\d+)s)?\s*$/);
      if (!match) return null;
    
      const [, h, m, s] = match;
      if (h === undefined && m === undefined && s === undefined) return null;
    
      const hours = h ? parseInt(h, 10) : 0;
      const minutes = m ? parseInt(m, 10) : 0;
      const seconds = s ? parseInt(s, 10) : 0;
    
      return hours * 3600 + minutes * 60 + seconds;
    }
    ```

    624 tokens in, 240 out · 2.6 s · $0.0036 · 1 message on Pro · answered by anthropic/claude-sonnet-5 via Claude Platform on AWS ·

  3. Merge overlapping intervals

    An everyday prompt: “Merge overlapping intervals”, in full.

    Passed: All 7 tests passed.

    ```javascript
    function mergeIntervals(intervals) {
      if (!intervals || intervals.length === 0) return [];
    
      const sorted = intervals
        .map(([a, b]) => [a, b])
        .sort((x, y) => x[0] - y[0]);
    
      const result = [sorted[0]];
    
      for (let i = 1; i < sorted.length; i++) {
        const [start, end] = sorted[i];
        const last = result[result.length - 1];
    
        if (start <= last[1]) {
          last[1] = Math.max(last[1], end);
        } else {
          result.push([start, end]);
        }
      }
    
      return result;
    }
    ```

    619 tokens in, 216 out · 2.7 s · $0.0034 · 1 message on Pro · answered by anthropic/claude-sonnet-5 via Claude Platform on AWS ·

  4. Evaluate an arithmetic expression, no eval

    A hard prompt: “Evaluate an arithmetic expression, no eval”, in full.

    Passed: All 15 tests passed.

    ```javascript
    function evaluate(expression) {
      // ---- Tokenizer ----
      const tokens = [];
      let i = 0;
      const s = expression;
      while (i < s.length) {
        const c = s[i];
        if (c === ' ' || c === '\t' || c === '\n' || c === '\r') {
          i++;
          continue;
        }
        if ('+-*/^()'.includes(c)) {
          tokens.push(c);
          i++;
          continue;
        }
        if ((c >= '0' && c <= '9') || c === '.') {
          let start = i;
          let seenDot = false;
          let seenDigit = false;
          while (i < s.length && ((s[i] >= '0' && s[i] <= '9') || s[i] === '.')) {
            if (s[i] === '.') {
              if (seenDot) break;
              seenDot = true;
            } else {
              seenDigit = true;
            }
            i++;
          }
          const raw = s.slice(start, i);
          if (!seenDigit || !/^\d*\.?\d*$/.test(raw)) {
            throw new Error(`Invalid number: "${raw}"`);
          }
          tokens.push({ type: 'num', value: parseFloat(raw) });
          continue;
        }
        throw new Error(`Unexpected character "${c}" at position ${i}`);
      }
    
      // ---- Parser ----
      let pos = 0;
    
      function peek() {
        return tokens[pos];
      }
    
      function next() {
        return tokens[pos++];
      }
    
      function expect(tok) {
        const t = next();
        if (t !== tok) {
          throw new Error(`Expected "${tok}" but got "${t === undefined ? 'end of input' : (typeof t === 'object' ? t.value : t)}"`);
        }
      }
    
      function parseExpr() {
        let value = parseTerm();
        while (peek() === '+' || peek() === '-') {
          const op = next();
          const rhs = parseTerm();
          value = op === '+' ? value + rhs : value - rhs;
        }
        return value;
      }
    
      function parseTerm() {
        let value = parseUnary();
        while (peek() === '*' || peek() === '/') {
          const op = next();
          const rhs = parseUnary();
          if (op === '*') {
            value = value * rhs;
          } else {
            value = value / rhs;
          }
        }
        return value;
      }
    
      function parseUnary() {
        if (peek() === '-') {
          next();
          return -parseUnary();
        }
        if (peek() === '+') {
          next();
          return parseUnary();
        }
        return parsePower();
      }
    
      function parsePower() {
        const base = parseAtom();
        if (peek() === '^') {
          next();
          const exponent = parseUnary(); // right-associative, allows unary minus
          return Math.pow(base, exponent);
        }
        return base;
      }
    
      function parseAtom() {
        const t = peek();
        if (t === undefined) {
          throw new Error('Unexpected end of input');
        }
        if (t === '(') {
          next();
          const value = parseExpr();
          expect(')');
          return value;
        }
        if (typeof t === 'object' && t.type === 'num') {
          next();
          return t.value;
        }
        throw new Error(`Unexpected token "${typeof t === 'object' ? t.value : t}"`);
      }
    
      if (tokens.length === 0) {
        throw new Error('Empty expression');
      }
    
      const result = parseExpr();
    
      if (pos !== tokens.length) {
        const remaining = tokens[pos];
        throw new Error(`Unexpected token "${typeof remaining === 'object' ? remaining.value : remaining}" after expression`);
      }
    
      return result;
    }
    ```

    760 tokens in, 2,110 out (834 of them reasoning) · 16.9 s · $0.0226 · 1 message on Pro · answered by anthropic/claude-sonnet-5 via Claude Platform on AWS ·

  5. Parse CSV with quoted fields

    A hard prompt: “Parse CSV with quoted fields”, in full.

    Passed: All 8 tests passed.

    ```javascript
    function parseCsv(text) {
      const rows = [];
      let row = [];
      let field = '';
      let i = 0;
      const n = text.length;
      let inQuotes = false;
    
      while (i < n) {
        const c = text[i];
    
        if (inQuotes) {
          if (c === '"') {
            if (text[i + 1] === '"') {
              field += '"';
              i += 2;
            } else {
              inQuotes = false;
              i++;
            }
          } else {
            field += c;
            i++;
          }
          continue;
        }
    
        if (c === '"' && field === '') {
          inQuotes = true;
          i++;
        } else if (c === ',') {
          row.push(field);
          field = '';
          i++;
        } else if (c === '\r' && text[i + 1] === '\n') {
          row.push(field);
          rows.push(row);
          row = [];
          field = '';
          i += 2;
        } else if (c === '\n') {
          row.push(field);
          rows.push(row);
          row = [];
          field = '';
          i++;
        } else {
          field += c;
          i++;
        }
      }
    
      // Only push the final row if there's actually pending content;
      // a trailing line break should not create an extra empty row.
      if (field !== '' || row.length > 0) {
        row.push(field);
        rows.push(row);
      }
    
      return rows;
    }
    ```

    667 tokens in, 1,737 out (1,274 of them reasoning) · 15.8 s · $0.0187 · 1 message on Pro · answered by anthropic/claude-sonnet-5 via Claude Platform on AWS ·

How it compares on coding

Claude Sonnet 5 beside the job's picks among every model. 13 models share the hard-problems pick, Claude Sonnet 5 among them.

Claude Sonnet 5 beside other models on coding
ModelPassedOn ProCost per reply
GLM 5.3Our pick: hard problems (shared), best value5 of 5250 a month on Pro$0.0015
GLM 5.3 FlashOur pick: hard problems (shared), everyday5 of 560 a day on Pro$0.0003
Claude Sonnet 5Our pick: hard problems (shared)5 of 5125 a month on Pro$0.0102
On Pro: Pro's count on each model. Cost: what OpenRouter charged us per reply, on average.

Every limit is published. Paid plans also have a monthly fair-use limit on AI cost: Pro $7.50, Max $20, Ultra $42, Studio $85. Using every message on your plan at typical sizes stays under it; very large messages and heavy research use it faster. Every limit, explained.

How these runs were done

Tests. Automatic. The function runs against the prompt's tests in a separate Node.js process with a time limit and no file, network or child-process access; it passes when every test passes.

How the runs were done, and every coding prompt.

Claude Sonnet 5, and coding, elsewhere

Questions

Is Claude Sonnet 5 good for coding?

In our test runs it passed 5 of 5 coding prompts, tied 1st of the 15 models in llmwise. Every reply is on this page, so you can judge them yourself.

How many of my messages does a coding reply from Claude Sonnet 5 use?

1 message each on Pro, where it has 125 a month on Pro. The price of a message is fixed and shown before you send it, however long the reply.

How were these runs done?

The same way for every model: each prompt sent through llmwise's own pipeline, each reply checked the same way. The methods page has every prompt and how each is scored.

Claude, GPT, Gemini, DeepSeek, Grok, Kimi, and GLM, in one chat.

See what a message costs before you send it. Free is 5 messages to try; sign in with an email link, no password or card.