Skip to content

Comparison · Coding

Grok vs Claude for coding

On llmwise Pro, Grok 4.7 gets up to 250 messages a month and Claude Sonnet 5.5 up to 125 messages a month. We ran the same 5 coding prompts on Grok's one model and all 6 Claude models and published every reply: the results, then Grok 4.7 against Claude Haiku 5.5 prompt by prompt, then how Grok and Claude compare on price per message, context and files.

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

Short answer

In our coding test runs on October 7, 2026, Grok's one model passed 5 of 5 ($0.0246 a reply). Claude's 6 models passed 28 of 30; Claude Fable 5.1, Claude Opus 5.5 and 3 more each passed 5 of 5. Grok 4.7 and Claude Haiku 5.5 each passed 5 of the 5 prompts, so these coding prompts don't split Grok and Claude; the replies on this page show how they differ.

Grok and Claude on our coding test runs

Every Grok and Claude model in llmwise on our 5 coding prompts: how many replies passed, what each counted as on Pro, and what it cost to run.

Grok and Claude on our coding test runs
ModelPassedHard onesMessages used on ProCost per replyTime per reply
Grok 4.7xAI5 of 52 of 21 each, of 250 a month on Pro$0.024646.9 s
Claude Fable 5.1Anthropic5 of 52 of 21 each, of 31 a month on Pro$0.04259.1 s
Claude Opus 5.5Anthropic5 of 52 of 21 each, of 62 a month on Pro$0.01718.3 s
Claude Sonnet 5.5Anthropic5 of 52 of 21 each, of 125 a month on Pro$0.00633.0 s
Claude Sonnet 5Anthropic5 of 52 of 21 each, of 125 a month on Pro$0.01028.0 s
Claude Haiku 4.5Anthropic3 of 50 of 21 each, of 250 a month on Pro$0.00273.4 s
Claude Haiku 5.5Anthropic5 of 52 of 21 each, of 60 a day on Pro$0.00054.0 s
Grok: 5 of 5 replies passed; Claude: 28 of 30 replies passed. Messages used is what each reply counted as on Pro; cost is what OpenRouter charged us per reply.

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.

Grok vs Claude, prompt by prompt

Each coding prompt with Grok 4.7 and Claude Haiku 5.5 side by side, as they replied: for each side, the model that passed the most coding prompts (then the most hard ones, then the cheaper).

Coding: Grok 4.7 passed 5 of 5 and Claude Haiku 5.5 5 of 5. Claude Haiku 5.5 answered 8.0× sooner at the median, 31.6 s against 3.9 s. Claude Haiku 5.5 cost 54.3× less, $0.1229 against $0.0023 for the 5 replies. Claude Haiku 5.5's replies ran 42% longer, in tokens of reply, thinking not counted.

  1. 1. Turn a title into a URL slug

    Everyday. Grok: 1 of 1 model passed, Grok 4.7 at $0.0078 · Claude: 6 of 6 models passed, Claude Haiku 5.5 the cheapest at $0.0001. The prompt in full.

    Grok 4.7 and Claude Haiku 5.5 both passed this one. Claude Haiku 5.5 answered sooner (1.5 s to 14.3 s), and Claude Haiku 5.5's reply cost less ($0.0001 to $0.0078); Grok 4.7 wrote 73 tokens of reply, Claude Haiku 5.5 112.

    • Grok 4.7

      Passed: All 7 tests passed.

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

      1,720 tokens in, 1,012 out (939 of them reasoning) · 14.3 s · $0.0078 · 1 message on Pro · answered by x-ai/grok-4.7 via xAI ·

    • Claude Haiku 5.5

      Passed: All 7 tests passed.

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

      672 tokens in, 112 out · 1.5 s · $0.0001 · 1 message on Pro · answered by anthropic/claude-haiku-5.5 via Anthropic ·

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

    Everyday. Grok: 1 of 1 model passed, Grok 4.7 at $0.0167 · Claude: 6 of 6 models passed, Claude Haiku 5.5 the cheapest at $0.0005. The prompt in full.

    Grok 4.7 and Claude Haiku 5.5 both passed this one. Claude Haiku 5.5 answered sooner (5.4 s to 31.6 s), and Claude Haiku 5.5's reply cost less ($0.0005 to $0.0167); Grok 4.7 wrote 171 tokens of reply, Claude Haiku 5.5 180.

    • Grok 4.7

      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 || (match[1] == null && match[2] == null && match[3] == null)) return null;
        const hours = match[1] != null ? Number(match[1]) : 0;
        const minutes = match[2] != null ? Number(match[2]) : 0;
        const seconds = match[3] != null ? Number(match[3]) : 0;
        return hours * 3600 + minutes * 60 + seconds;
      }
      ```

      1,706 tokens in, 2,497 out (2,326 of them reasoning) · 31.6 s · $0.0167 · 1 message on Pro · answered by x-ai/grok-4.7 via xAI ·

    • Claude Haiku 5.5

      Passed: All 10 tests passed.

      ```javascript
      function parseDuration(text) {
        if (typeof text !== 'string') return null;
      
        const m = /^\s*(?:(\d+)h)?\s*(?:(\d+)m)?\s*(?:(\d+)s)?\s*$/.exec(text);
        if (!m || m.slice(1).every(v => v === undefined)) return null;
      
        const [, h = 0, mi = 0, s = 0] = m;
        return Number(h) * 3600 + Number(mi) * 60 + Number(s);
      }
      ```

      627 tokens in, 868 out (688 of them reasoning) · 5.4 s · $0.0005 · 1 message on Pro · answered by anthropic/claude-haiku-5.5 via Anthropic ·

  3. 3. Merge overlapping intervals

    Everyday. Grok: 1 of 1 model passed, Grok 4.7 at $0.0045 · Claude: 6 of 6 models passed, Claude Haiku 5.5 the cheapest at $0.0002. The prompt in full.

    Grok 4.7 and Claude Haiku 5.5 both passed this one. Claude Haiku 5.5 answered sooner (1.3 s to 6.1 s), and Claude Haiku 5.5's reply cost less ($0.0002 to $0.0045); Grok 4.7 wrote 198 tokens of reply, Claude Haiku 5.5 185.

    • Grok 4.7

      Passed: All 7 tests passed.

      ```javascript
      function mergeIntervals(intervals) {
        if (!intervals || intervals.length === 0) return [];
      
        const sorted = intervals
          .map((iv) => [iv[0], iv[1]])
          .sort((a, b) => a[0] - b[0] || a[1] - b[1]);
      
        const merged = [[sorted[0][0], sorted[0][1]]];
      
        for (let i = 1; i < sorted.length; i++) {
          const last = merged[merged.length - 1];
          const curr = sorted[i];
          if (curr[0] <= last[1]) {
            if (curr[1] > last[1]) last[1] = curr[1];
          } else {
            merged.push([curr[0], curr[1]]);
          }
        }
      
        return merged;
      }
      ```

      1,684 tokens in, 547 out (349 of them reasoning) · 6.1 s · $0.0045 · 1 message on Pro · answered by x-ai/grok-4.7 via xAI ·

    • Claude Haiku 5.5

      Passed: All 7 tests passed.

      ```javascript
      function mergeIntervals(intervals) {
        const sorted = intervals
          .map(([start, end]) => [start, end])
          .sort((a, b) => a[0] - b[0] || a[1] - b[1]);
      
        const merged = [];
        for (const [start, end] of sorted) {
          const last = merged[merged.length - 1];
          if (last && start <= last[1]) {
            last[1] = Math.max(last[1], end);
          } else {
            merged.push([start, end]);
          }
        }
        return merged;
      }
      ```

      622 tokens in, 185 out · 1.3 s · $0.0002 · 1 message on Pro · answered by anthropic/claude-haiku-5.5 via Anthropic ·

  4. 4. Evaluate an arithmetic expression, no eval

    Hard. Grok: 1 of 1 model passed, Grok 4.7 at $0.0574 · Claude: 5 of 6 models passed, Claude Haiku 5.5 the cheapest at $0.0006. The prompt in full.

    Grok 4.7 and Claude Haiku 5.5 both passed this one. Claude Haiku 5.5 answered sooner (3.9 s to 110.1 s), and Claude Haiku 5.5's reply cost less ($0.0006 to $0.0574); Grok 4.7 wrote 613 tokens of reply, Claude Haiku 5.5 1,074.

    • Grok 4.7

      Passed: All 15 tests passed.

      ```javascript
      function evaluate(expression) {
        if (typeof expression !== 'string') {
          throw new Error('Invalid expression');
        }
      
        const s = expression;
        let i = 0;
      
        function skip() {
          while (i < s.length && s[i] === ' ') i++;
        }
      
        function parseExpression() {
          let value = parseTerm();
          while (true) {
            skip();
            if (s[i] === '+') {
              i++;
              value += parseTerm();
            } else if (s[i] === '-') {
              i++;
              value -= parseTerm();
            } else {
              break;
            }
          }
          return value;
        }
      
        function parseTerm() {
          let value = parseUnary();
          while (true) {
            skip();
            if (s[i] === '*') {
              i++;
              value *= parseUnary();
            } else if (s[i] === '/') {
              i++;
              value /= parseUnary();
            } else {
              break;
            }
          }
          return value;
        }
      
        function parseUnary() {
          skip();
          if (s[i] === '-') {
            i++;
            return -parseUnary();
          }
          return parsePower();
        }
      
        function parsePower() {
          const base = parsePrimary();
          skip();
          if (s[i] === '^') {
            i++;
            return base ** parseUnary();
          }
          return base;
        }
      
        function parsePrimary() {
          skip();
          if (s[i] === '(') {
            i++;
            const value = parseExpression();
            skip();
            if (s[i] !== ')') throw new Error('Invalid expression');
            i++;
            return value;
          }
          return parseNumber();
        }
      
        function parseNumber() {
          skip();
          const start = i;
          if (i >= s.length || s[i] < '0' || s[i] > '9') {
            throw new Error('Invalid expression');
          }
          while (i < s.length && s[i] >= '0' && s[i] <= '9') i++;
          if (s[i] === '.') {
            i++;
            if (i >= s.length || s[i] < '0' || s[i] > '9') {
              throw new Error('Invalid expression');
            }
            while (i < s.length && s[i] >= '0' && s[i] <= '9') i++;
          }
          return Number(s.slice(start, i));
        }
      
        const value = parseExpression();
        skip();
        if (i !== s.length) throw new Error('Invalid expression');
        return value;
      }
      ```

      1,786 tokens in, 9,267 out (8,654 of them reasoning) · 110.1 s · $0.0574 · 1 message on Pro · answered by x-ai/grok-4.7 via xAI ·

    • Claude Haiku 5.5

      Passed: All 15 tests passed.

      ```javascript
      function evaluate(expression) {
        const s = String(expression);
        const tokens = [];
        let i = 0;
        while (i < s.length) {
          const c = s[i];
          if (c === ' ' || c === '\t' || c === '\n' || c === '\r') { i++; continue; }
          if ((c >= '0' && c <= '9') || c === '.') {
            let j = i;
            while (j < s.length && ((s[j] >= '0' && s[j] <= '9') || s[j] === '.')) j++;
            const text = s.slice(i, j);
            if (!/^(\d+\.?\d*|\.\d+)$/.test(text)) throw new Error(`Invalid number "${text}"`);
            tokens.push({ type: 'num', value: Number(text) });
            i = j;
            continue;
          }
          if ('+-*/^()'.includes(c)) {
            tokens.push({ type: c });
            i++;
            continue;
          }
          throw new Error(`Unexpected character "${c}"`);
        }
      
        let pos = 0;
        const peek = () => tokens[pos] ? tokens[pos].type : null;
        const next = () => tokens[pos++];
      
        // expr := term (('+'|'-') term)*
        function parseExpr() {
          let value = parseTerm();
          while (peek() === '+' || peek() === '-') {
            const op = next().type;
            const rhs = parseTerm();
            value = op === '+' ? value + rhs : value - rhs;
          }
          return value;
        }
      
        // term := unary (('*'|'/') unary)*
        function parseTerm() {
          let value = parseUnary();
          while (peek() === '*' || peek() === '/') {
            const op = next().type;
            const rhs = parseUnary();
            value = op === '*' ? value * rhs : value / rhs;
          }
          return value;
        }
      
        // unary := '-' unary | power
        function parseUnary() {
          if (peek() === '-') {
            next();
            return -parseUnary();
          }
          return parsePower();
        }
      
        // power := primary ('^' unary)?   (right-associative; exponent may be signed)
        function parsePower() {
          const base = parsePrimary();
          if (peek() === '^') {
            next();
            const exp = parseUnary();
            return Math.pow(base, exp);
          }
          return base;
        }
      
        // primary := number | '(' expr ')'
        function parsePrimary() {
          const t = tokens[pos];
          if (!t) throw new Error('Unexpected end of expression');
          if (t.type === 'num') {
            pos++;
            return t.value;
          }
          if (t.type === '(') {
            pos++;
            const value = parseExpr();
            if (peek() !== ')') throw new Error('Expected ")"');
            pos++;
            return value;
          }
          throw new Error(`Unexpected token "${t.type}"`);
        }
      
        if (tokens.length === 0) throw new Error('Empty expression');
        const result = parseExpr();
        if (pos !== tokens.length) throw new Error(`Unexpected token "${tokens[pos].type}"`);
        return result;
      }
      ```

      763 tokens in, 1,074 out · 3.9 s · $0.0006 · 1 message on Pro · answered by anthropic/claude-haiku-5.5 via Anthropic ·

  5. 5. Parse CSV with quoted fields

    Hard. Grok: 1 of 1 model passed, Grok 4.7 at $0.0364 · Claude: 5 of 6 models passed, Claude Haiku 5.5 the cheapest at $0.0008. The prompt in full.

    Grok 4.7 and Claude Haiku 5.5 both passed this one. Claude Haiku 5.5 answered sooner (8.1 s to 72.2 s), and Claude Haiku 5.5's reply cost less ($0.0008 to $0.0364); Grok 4.7 wrote 402 tokens of reply, Claude Haiku 5.5 516.

    • Grok 4.7

      Passed: All 8 tests passed.

      ```javascript
      function parseCsv(text) {
        if (text === "") return [];
      
        const rows = [];
        let row = [];
        let field = "";
        let inQuotes = false;
        let atFieldStart = true;
        let endedOnBreak = false;
      
        for (let i = 0; i < text.length; ) {
          const c = text[i];
      
          if (inQuotes) {
            if (c === '"') {
              if (text[i + 1] === '"') {
                field += '"';
                i += 2;
              } else {
                inQuotes = false;
                i += 1;
              }
            } else {
              field += c;
              i += 1;
            }
            endedOnBreak = false;
            continue;
          }
      
          if (atFieldStart && c === '"') {
            inQuotes = true;
            atFieldStart = false;
            endedOnBreak = false;
            i += 1;
            continue;
          }
      
          if (c === ",") {
            row.push(field);
            field = "";
            atFieldStart = true;
            endedOnBreak = false;
            i += 1;
            continue;
          }
      
          if (c === "\n" || (c === "\r" && text[i + 1] === "\n")) {
            row.push(field);
            rows.push(row);
            row = [];
            field = "";
            atFieldStart = true;
            endedOnBreak = true;
            i += c === "\r" ? 2 : 1;
            continue;
          }
      
          field += c;
          atFieldStart = false;
          endedOnBreak = false;
          i += 1;
        }
      
        if (!endedOnBreak) {
          row.push(field);
          rows.push(row);
        }
      
        return rows;
      }
      ```

      1,718 tokens in, 5,854 out (5,452 of them reasoning) · 72.2 s · $0.0364 · 1 message on Pro · answered by x-ai/grok-4.7 via xAI ·

    • Claude Haiku 5.5

      Passed: All 8 tests passed.

      ```javascript
      function parseCsv(text) {
        const rows = [];
        if (text === '') return rows;
      
        let row = [];
        let field = '';
        let inQuotes = false;
        let fieldStart = true; // true only at the very beginning of a field
        let i = 0;
        const n = text.length;
      
        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 === '"' && fieldStart) {
            inQuotes = true;
            fieldStart = false;
            i++;
            continue;
          }
      
          if (c === ',') {
            row.push(field);
            field = '';
            fieldStart = true;
            i++;
            continue;
          }
      
          if (c === '\n' || c === '\r') {
            row.push(field);
            rows.push(row);
            row = [];
            field = '';
            fieldStart = true;
            if (c === '\r' && text[i + 1] === '\n') i += 2;
            else i++;
            continue;
          }
      
          field += c;
          fieldStart = false;
          i++;
        }
      
        // Flush the last row unless the text ended with a line break
        if (row.length > 0 || field !== '' || !fieldStart) {
          row.push(field);
          rows.push(row);
        }
      
        return rows;
      }
      ```

      670 tokens in, 1,464 out (948 of them reasoning) · 8.1 s · $0.0008 · 1 message on Pro · answered by anthropic/claude-haiku-5.5 via Anthropic ·

Each Grok model against each Claude model

Every Grok model against every Claude model on the same 5 coding prompts: passes, the median wait and what the replies cost. A lead under 10% counts as close.

  • Grok 4.7 vs Claude Fable 5.1: 5 of 5 each; Claude Fable 5.1 answered 5.7× sooner at the median and Grok 4.7 cost 1.7× less. Claude Fable 5.1 vs Grok 4.7, on every job.

  • Grok 4.7 vs Claude Opus 5.5: 5 of 5 each; Claude Opus 5.5 answered 4.4× sooner at the median and cost 1.4× less.

  • Grok 4.7 vs Claude Sonnet 5.5: 5 of 5 each; Claude Sonnet 5.5 answered 16.1× sooner at the median and cost 3.9× less.

  • Grok 4.7 vs Claude Sonnet 5: 5 of 5 each; Claude Sonnet 5 answered 11.8× sooner at the median and cost 2.4× less. Claude Sonnet 5 vs Grok 4.7, on every job.

  • Grok 4.7 vs Claude Haiku 4.5: Grok 4.7 5 of 5, Claude Haiku 4.5 3; Claude Haiku 4.5 answered 13.5× sooner at the median and cost 8.9× less. Claude Haiku 4.5 vs Grok 4.7, on every job.

  • Grok 4.7 vs Claude Haiku 5.5: 5 of 5 each; Claude Haiku 5.5 answered 8.0× sooner at the median and cost 54.3× less.

How the coding replies are scored

Every Grok and Claude reply above was checked the same way as every other model's, by the rules published with the prompts: how the coding prompts are scored, and each one in full.

The differences at a glance

What follows from each model's facts in our catalog.

  • The lineups

    Grok: one model, Grok 4.7. Claude: 6 models, Claude Fable 5.1, Claude Opus 5.5, Claude Sonnet 5.5, Claude Sonnet 5, Claude Haiku 4.5, and Claude Haiku 5.5.

  • Price per message

    Grok's one model is Grok 4.7 (250 messages a month on Pro); the least expensive Claude model is Claude Haiku 5.5 (60 messages a day on Pro).

  • Context window

    Grok goes up to 500K tokens (Grok 4.7); Claude up to 1M tokens (Claude Fable 5.1).

  • Images and PDFs

    Every model here reads images. Every model here takes a PDF as a whole file.

  • On the Free plan

    Free's one-time trial of 5 messages covers Grok 4.7, Claude Sonnet 5.5, Claude Sonnet 5, Claude Haiku 4.5, and Claude Haiku 5.5, and Claude Opus 5.5 for 1 message. Paid plans have every model, with messages every month.

Every Grok and Claude model's context window, files and API price: Grok vs Claude.

Where your messages go

In llmwise, a message to Claude goes to its maker, Anthropic, or through OpenRouter when llmwise can't reach the maker directly. Grok models are served only through OpenRouter, by endpoints that don't store or train on prompts. The Privacy Policy has the details.

Bar chart: Prompts passed in our test runs, coding. Claude Haiku 5.5: 5 of 5; Grok 4.7: 5 of 5; Claude Sonnet 5.5: 5 of 5; Claude Sonnet 5: 5 of 5; Claude Opus 5.5: 5 of 5; Claude Fable 5.1: 5 of 5; Claude Haiku 4.5: 3 of 5.
Our test runs of September 27, 28, 29 and October 2, 7, 8, 9, 2026: the same prompts for every model, each reply checked the same way.

Questions

Which is better, Grok or Claude for coding?

In our coding test runs on October 7, 2026, Grok's one model passed 5 of 5 ($0.0246 a reply). Claude's 6 models passed 28 of 30; Claude Fable 5.1, Claude Opus 5.5 and 3 more each passed 5 of 5. Grok 4.7 and Claude Haiku 5.5 each passed 5 of the 5 prompts, so these coding prompts don't split Grok and Claude; the replies on this page show how they differ.

Is Grok or Claude cheaper?

In llmwise, the least expensive Grok model is Grok 4.7 (250 messages a month on Pro), and the least expensive Claude model is Claude Haiku 5.5 (60 messages a day on Pro). At API list prices (October 2026), a typical message of 4,000 tokens in and 700 out costs $0.0122 on Grok 4.7 and $0.0008 on Claude Haiku 5.5.

Can I use Grok and Claude in the same chat?

Yes. Ask Grok 4.7 a question, then switch the picker to Claude Haiku 5.5 and ask again: Claude Haiku 5.5 sees the whole conversation, Grok 4.7's answer included.

Claude, GPT, Gemini, DeepSeek, Grok, Kimi, GLM, and Mistral, 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.