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 7 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 40 of our test runs on , through OpenRouter with the app's own prompt and settings.
Short answer
In our coding test runs on November 18, 2026, Grok's one model passed 5 of 5 ($0.0271 a reply). Claude's 7 models passed 33 of 35; Claude Fable 5.2, Claude Fable 5.1 and 4 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.
| Model | Passed | Hard ones | Messages used on Pro | Cost per reply | Time per reply |
|---|---|---|---|---|---|
| Grok 4.7xAI | 5 of 5 | 2 of 2 | 1 each, of 250 a month on Pro | $0.0271 | 51.4 s |
| Claude Fable 5.2Anthropic | 5 of 5 | 2 of 2 | 1 each, of 31 a month on Pro | $0.0249 | 5.6 s |
| Claude Fable 5.1Anthropic | 5 of 5 | 2 of 2 | 1 each, of 31 a month on Pro | $0.0333 | 6.6 s |
| Claude Opus 5.5Anthropic | 5 of 5 | 2 of 2 | 1 each, of 62 a month on Pro | $0.0179 | 7.3 s |
| Claude Sonnet 5.5Anthropic | 5 of 5 | 2 of 2 | 1 each, of 125 a month on Pro | $0.0051 | 3.2 s |
| Claude Sonnet 5Anthropic | 5 of 5 | 2 of 2 | 1 each, of 125 a month on Pro | $0.0101 | 8.0 s |
| Claude Haiku 4.5Anthropic | 3 of 5 | 0 of 2 | 1 each, of 250 a month on Pro | $0.0030 | 3.1 s |
| Claude Haiku 5.5Anthropic | 5 of 5 | 2 of 2 | 1 each, of 60 a day on Pro | $0.0004 | 3.0 s |
Every limit is published. Paid plans also have a monthly fair-use limit on AI cost: Plus $3.75, 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 24.2× sooner at the median, 31.2 s against 1.3 s. Claude Haiku 5.5 cost 68.3× less, $0.1354 against $0.0020 for the 5 replies. Claude Haiku 5.5's replies ran 44% longer, in tokens of reply, thinking not counted.
1. Turn a title into a URL slug
Everyday. Grok: 1 of 1 model passed, Grok 4.7 at $0.0053 · Claude: 7 of 7 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 5.9 s), and Claude Haiku 5.5's reply cost less ($0.0002 to $0.0053); Grok 4.7 wrote 80 tokens of reply, Claude Haiku 5.5 112.
Grok 4.7
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, ""); } ```1,890 tokens in, 544 out (464 of them reasoning) · 5.9 s · $0.0053 · 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, ""); } ```926 tokens in, 112 out · 1.3 s · $0.0002 · 1 message on Pro · answered by anthropic/claude-haiku-5.5 via Anthropic ·
2. Parse a duration like “1h 30m”
Everyday. Grok: 1 of 1 model passed, Grok 4.7 at $0.0151 · Claude: 7 of 7 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.2 s to 31.2 s), and Claude Haiku 5.5's reply cost less ($0.0001 to $0.0151); Grok 4.7 wrote 165 tokens of reply, Claude Haiku 5.5 212.
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] ? Number(match[1]) : 0; const minutes = match[2] ? Number(match[2]) : 0; const seconds = match[3] ? Number(match[3]) : 0; return hours * 3600 + minutes * 60 + seconds; } ```1,876 tokens in, 2,173 out (2,008 of them reasoning) · 31.2 s · $0.0151 · 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 s = text.trim(); const match = /^(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?\s*(?:(\d+)\s*s)?$/.exec(s); if (!match || s === "") return null; const [, h, m, sec] = match; if (h === undefined && m === undefined && sec === undefined) return null; return (Number(h ?? 0) * 3600) + (Number(m ?? 0) * 60) + Number(sec ?? 0); } ```881 tokens in, 212 out · 1.2 s · $0.0001 · 1 message on Pro · answered by anthropic/claude-haiku-5.5 via Anthropic ·
3. Merge overlapping intervals
Everyday. Grok: 1 of 1 model passed, Grok 4.7 at $0.0052 · Claude: 7 of 7 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.1 s to 8.3 s), and Claude Haiku 5.5's reply cost less ($0.0001 to $0.0052); Grok 4.7 wrote 174 tokens of reply, Claude Haiku 5.5 180.
Grok 4.7
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { if (intervals.length === 0) return []; const sorted = intervals .map(([start, end]) => [start, end]) .sort((a, b) => a[0] - b[0]); const merged = [[sorted[0][0], sorted[0][1]]]; for (let i = 1; i < sorted.length; i++) { const last = merged[merged.length - 1]; const [start, end] = sorted[i]; if (start <= last[1]) { last[1] = Math.max(last[1], end); } else { merged.push([start, end]); } } return merged; } ```1,854 tokens in, 660 out (486 of them reasoning) · 8.3 s · $0.0052 · 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 result = []; for (const [start, end] of sorted) { const last = result[result.length - 1]; if (last && start <= last[1]) { last[1] = Math.max(last[1], end); } else { result.push([start, end]); } } return result; } ```876 tokens in, 180 out · 1.1 s · $0.0001 · 1 message on Pro · answered by anthropic/claude-haiku-5.5 via Anthropic ·
4. Evaluate an arithmetic expression, no eval
Hard. Grok: 1 of 1 model passed, Grok 4.7 at $0.0716 · Claude: 6 of 7 models passed, Claude Haiku 5.5 the cheapest at $0.0013. The prompt in full.
Grok 4.7 and Claude Haiku 5.5 both passed this one. Claude Haiku 5.5 answered sooner (9.3 s to 131.0 s), and Claude Haiku 5.5's reply cost less ($0.0013 to $0.0716); Grok 4.7 wrote 676 tokens of reply, Claude Haiku 5.5 1,063.
Grok 4.7
Passed: All 15 tests passed.
```javascript function evaluate(expression) { if (typeof expression !== "string") { throw new Error("Invalid expression"); } const s = expression; const n = s.length; let i = 0; function skip() { while (i < n && (s[i] === " " || s[i] === "\t" || s[i] === "\n" || s[i] === "\r")) { i++; } } function parseExpression() { let left = parseTerm(); while (true) { skip(); const op = s[i]; if (op !== "+" && op !== "-") break; i++; const right = parseTerm(); left = op === "+" ? left + right : left - right; } return left; } function parseTerm() { let left = parseUnary(); while (true) { skip(); const op = s[i]; if (op !== "*" && op !== "/") break; i++; const right = parseUnary(); left = op === "*" ? left * right : left / right; } return left; } 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 (i >= n) throw new Error("Invalid expression"); 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 >= n || s[i] < "0" || s[i] > "9") { throw new Error("Invalid expression"); } while (i < n && s[i] >= "0" && s[i] <= "9") i++; if (i < n && s[i] === ".") { i++; if (i >= n || s[i] < "0" || s[i] > "9") { throw new Error("Invalid expression"); } while (i < n && s[i] >= "0" && s[i] <= "9") i++; } return Number(s.slice(start, i)); } skip(); if (i >= n) throw new Error("Invalid expression"); const result = parseExpression(); skip(); if (i !== n) throw new Error("Invalid expression"); return result; } ```1,956 tokens in, 11,564 out (10,888 of them reasoning) · 131.0 s · $0.0716 · 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 src = String(expression); // Tokenize: numbers, operators, parentheses. Spaces are skipped. const tokens = []; for (let i = 0; i < src.length; ) { const c = src[i]; if (/\s/.test(c)) { i++; continue; } const m = /^(\d+(?:\.\d+)?|\.\d+)/.exec(src.slice(i)); if (m) { tokens.push({ type: 'num', value: Number(m[1]) }); i += m[1].length; continue; } if ('+-*/^()'.includes(c)) { tokens.push({ type: c }); i++; continue; } throw new Error(`Unexpected character "${c}" at position ${i}`); } // Recursive descent parser. // expr := term (('+' | '-') term)* // term := unary (('*' | '/') unary)* // unary := '-' unary | power // power := primary ('^' unary)? (right-associative, exponent may be signed) // primary := number | '(' expr ')' let p = 0; const peek = () => (p < tokens.length ? tokens[p].type : null); const expect = (type) => { if (peek() !== type) { throw new Error(`Expected "${type}" at token ${p + 1}`); } p++; }; function parseExpr() { let v = parseTerm(); while (peek() === '+' || peek() === '-') { const op = tokens[p++].type; const r = parseTerm(); v = op === '+' ? v + r : v - r; } return v; } function parseTerm() { let v = parseUnary(); while (peek() === '*' || peek() === '/') { const op = tokens[p++].type; const r = parseUnary(); v = op === '*' ? v * r : v / r; } return v; } function parseUnary() { if (peek() === '-') { p++; return -parseUnary(); } return parsePower(); } function parsePower() { const base = parsePrimary(); if (peek() === '^') { p++; return base ** parseUnary(); } return base; } function parsePrimary() { if (peek() === 'num') { return tokens[p++].value; } if (peek() === '(') { p++; const v = parseExpr(); expect(')'); return v; } if (peek() === null) { throw new Error('Unexpected end of expression'); } throw new Error(`Unexpected token "${tokens[p].type}" at token ${p + 1}`); } if (tokens.length === 0) { throw new Error('Empty expression'); } const result = parseExpr(); if (p !== tokens.length) { throw new Error(`Unexpected token "${tokens[p].type}" at token ${p + 1}`); } return result; } ```1,017 tokens in, 2,412 out (1,349 of them reasoning) · 9.3 s · $0.0013 · 1 message on Pro · answered by anthropic/claude-haiku-5.5 via Anthropic ·
5. Parse CSV with quoted fields
Hard. Grok: 1 of 1 model passed, Grok 4.7 at $0.0382 · Claude: 6 of 7 models passed, Claude Haiku 5.5 the cheapest at $0.0003. The prompt in full.
Grok 4.7 and Claude Haiku 5.5 both passed this one. Claude Haiku 5.5 answered sooner (2.2 s to 80.8 s), and Claude Haiku 5.5's reply cost less ($0.0003 to $0.0382); Grok 4.7 wrote 351 tokens of reply, Claude Haiku 5.5 513.
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 fieldStarted = false; const n = text.length; function endField() { row.push(field); field = ""; fieldStarted = false; } function endRow() { endField(); rows.push(row); row = []; } for (let i = 0; i < n; i++) { const c = text[i]; if (inQuotes) { if (c === '"') { if (i + 1 < n && text[i + 1] === '"') { field += '"'; i++; } else { inQuotes = false; } } else { field += c; } continue; } if (c === '"' && !fieldStarted) { inQuotes = true; fieldStarted = true; continue; } if (c === ",") { endField(); continue; } if (c === "\n" || (c === "\r" && i + 1 < n && text[i + 1] === "\n")) { if (c === "\r") i++; endRow(); continue; } field += c; fieldStarted = true; } if (fieldStarted || row.length > 0) { endRow(); } return rows; } ```1,888 tokens in, 6,161 out (5,810 of them reasoning) · 80.8 s · $0.0382 · 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 = []; let row = []; let field = ""; let inQuotes = false; let fieldStarted = false; let i = 0; const n = text.length; if (n === 0) return []; while (i < n) { const ch = text[i]; if (inQuotes) { if (ch === '"') { if (text[i + 1] === '"') { field += '"'; i += 2; continue; } inQuotes = false; i++; continue; } field += ch; i++; continue; } if (ch === '"' && !fieldStarted) { inQuotes = true; fieldStarted = true; i++; } else if (ch === ",") { row.push(field); field = ""; fieldStarted = false; i++; } else if (ch === "\r" || ch === "\n") { row.push(field); rows.push(row); row = []; field = ""; fieldStarted = false; if (ch === "\r" && text[i + 1] === "\n") i += 2; else i++; // A trailing line break ends the last row without starting a new one. if (i >= n) return rows; } else { field += ch; fieldStarted = true; i++; } } // Flush the final row (text did not end with a line break). row.push(field); rows.push(row); return rows; } ```924 tokens in, 513 out · 2.2 s · $0.0003 · 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.2: 5 of 5 each; Claude Fable 5.2 answered 7.6× sooner at the median and cost about the same.
Grok 4.7 vs Claude Fable 5.1: 5 of 5 each; Claude Fable 5.1 answered 7.0× sooner at the median and Grok 4.7 cost 1.2× 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 5.4× sooner at the median and cost 1.5× less.
Grok 4.7 vs Claude Sonnet 5.5: 5 of 5 each; Claude Sonnet 5.5 answered 12.6× sooner at the median and cost 5.3× 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.7× 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 14.3× sooner at the median and cost 9.0× 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 24.2× sooner at the median and cost 68.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: 7 models, Claude Fable 5.2, 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.2).
Images and PDFs
Every model here reads images. Every model here takes a PDF as a whole file.
Plans
Every plan has messages every month on them, Claude Fable 5.2 and Claude Fable 5.1 from Pro up. Every plan is month to month: cancel in two clicks.
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.
Questions
Which is better, Grok or Claude for coding?
In our coding test runs on November 18, 2026, Grok's one model passed 5 of 5 ($0.0271 a reply). Claude's 7 models passed 33 of 35; Claude Fable 5.2, Claude Fable 5.1 and 4 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. Every plan is month to month: cancel in two clicks. Sign in with an email link, no password.