Grok 4.7 · Coding
Grok 4.7 for coding: our test runs
Grok 4.7 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 October 2, 2026, Grok 4.7 passed 5 of 5 of our coding prompts (both hard ones): tied 1st of 20 models. Each reply counted as 1 message on Pro, where it has 250 a month, and cost $0.0246 to run on average.
Prompt by prompt
Each of the 5 coding prompts, and how Grok 4.7's reply did.
| Prompt | Result | Cost | Time |
|---|---|---|---|
| Turn a title into a URL slugEveryday | Passed: All 7 tests passed. | $0.0078 | 14.3 s |
| Parse a duration like “1h 30m”Everyday | Passed: All 10 tests passed. | $0.0167 | 31.6 s |
| Merge overlapping intervalsEveryday | Passed: All 7 tests passed. | $0.0045 | 6.1 s |
| Evaluate an arithmetic expression, no evalHard | Passed: All 15 tests passed. | $0.0574 | 110.1 s |
| Parse CSV with quoted fieldsHard | Passed: All 8 tests passed. | $0.0364 | 72.2 s |
Every coding reply from Grok 4.7
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(/\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 ·
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 || (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 ·
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((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 ·
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) { 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 ·
Parse CSV with quoted fields
A hard prompt: “Parse CSV with quoted fields”, in full.
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 ·
How it compares on coding
Grok 4.7 beside the job's picks among every model. 18 models share the hard-problems pick, Grok 4.7 among them.
| Model | Passed | On Pro | Cost per reply |
|---|---|---|---|
| GLM 5.3Our pick: hard problems (shared), best value | 5 of 5 | 250 a month on Pro | $0.0015 |
| GLM 5.3 FlashOur pick: hard problems (shared), everyday | 5 of 5 | 60 a day on Pro | $0.0003 |
| Grok 4.7Our pick: hard problems (shared) | 5 of 5 | 250 a month on Pro | $0.0246 |
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 4.7 next to each model on coding
Grok 4.7 against each model on the same 5 coding prompts. One run each, through OpenRouter: a wait depends on the provider and the load that day, so a lead under 10% counts as close.
Against Claude Fable 5.1: Grok 4.7 answered 5.7× later (31.6 s to 5.5 s), cost 1.7× less, and passed 5 of 5 to its 5.
Against Claude Opus 5.5: Grok 4.7 answered 4.4× later (31.6 s to 7.2 s), cost 1.4× more, and passed 5 of 5 to its 5.
Against Claude Sonnet 5.5: Grok 4.7 answered 16.1× later (31.6 s to 2.0 s), cost 3.9× more, and passed 5 of 5 to its 5.
Against Claude Sonnet 5: Grok 4.7 answered 11.8× later (31.6 s to 2.7 s), cost 2.4× more, and passed 5 of 5 to its 5.
Against Claude Haiku 5.5: Grok 4.7 answered 8.0× later (31.6 s to 3.9 s), cost 54.3× more, and passed 5 of 5 to its 5.
Against Claude Haiku 4.5: Grok 4.7 answered 13.5× later (31.6 s to 2.3 s), cost 8.9× more, and passed 5 of 5 to its 3. Only Grok 4.7 passed Evaluate an arithmetic expression, no eval; Parse CSV with quoted fields.
Against GPT-6 Astra: Grok 4.7 answered 3.9× later (31.6 s to 8.2 s), cost 1.1× more, and passed 5 of 5 to its 5.
Against GPT-6.1 Sol: Grok 4.7 answered 6.6× later (31.6 s to 4.8 s), cost 10.7× more, and passed 5 of 5 to its 5.
Against GPT-6 Sol: Grok 4.7 answered 6.6× later (31.6 s to 4.8 s), cost 4.7× more, and passed 5 of 5 to its 5.
Against GPT-6 Luna: Grok 4.7 answered 6.9× later (31.6 s to 4.6 s), cost 85.8× more, and passed 5 of 5 to its 5.
Against Gemini 4 Argon: Grok 4.7 answered 9.1× later (31.6 s to 3.5 s), cost 10.1× more, and passed 5 of 5 to its 5.
Against Gemini 3.1 Pro (preview): Grok 4.7 answered 3.1× later (31.6 s to 10.3 s), cost 1.3× more, and passed 5 of 5 to its 5.
Against Gemini 3.8 Flash: Grok 4.7 answered 7.5× later (31.6 s to 4.2 s), cost 12.6× more, and passed 5 of 5 to its 5.
Against DeepSeek V4.1 Flash: Grok 4.7 answered 12.7× later (31.6 s to 2.5 s), cost 13.4× more, and passed 5 of 5 to its 5.
Against DeepSeek V4 Pro: Grok 4.7 answered 3.8× sooner (31.6 s to 119.6 s), cost within 10% of it, and passed 5 of 5 to its 5.
Against Kimi K3: Grok 4.7 answered 7.6× later (31.6 s to 4.1 s), cost 3.9× more, and passed 5 of 5 to its 5.
Against GLM 5.3: Grok 4.7 answered 29.9× later (31.6 s to 1.1 s), cost 16.7× more, and passed 5 of 5 to its 5.
Against GLM 5.3 Flash: Grok 4.7 answered 3.8× later (31.6 s to 8.4 s), cost 97.2× more, and passed 5 of 5 to its 5.
Against Mistral Large 4: Grok 4.7 answered 1.2× sooner (31.6 s to 36.8 s), cost 3.4× more, and passed 5 of 5 to its 4. Only Grok 4.7 passed Evaluate an arithmetic expression, no eval.
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.
Grok 4.7, and coding, elsewhere
- Grok 4.7: price, limits and messages on every plan
- The best AI for coding: our picks among every model
- Grok for coding
- Grok 4.7 for writing: our test runs
- Grok 4.7 for math: our test runs
- Grok 4.7 for data analysis: our test runs
- Claude Fable 5.1 vs Grok 4.7
- GPT-6 Astra vs Grok 4.7
- Claude Sonnet 5 vs Grok 4.7
- Claude Haiku 4.5 vs Grok 4.7
- GPT-6 Sol vs Grok 4.7
- GPT-6 Luna vs Grok 4.7
- Gemini 3.1 Pro (preview) vs Grok 4.7
- Gemini 3.8 Flash vs Grok 4.7
- DeepSeek V4.1 Flash vs Grok 4.7
- DeepSeek V4 Pro vs Grok 4.7
- Grok 4.7 vs Kimi K3
- Grok 4.7 vs GLM 5.3
- Grok 4.7 vs GLM 5.3 Flash
- Analyze a CSV with code: the prompt, and its price
- AI prompts for coding, checked by running the code
- Our test runs: 50 prompts on every model
Questions
Is Grok 4.7 good for coding?
In our test runs it passed 5 of 5 coding prompts, tied 1st of the 20 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 Grok 4.7 use?
1 message each on Pro, where it has 250 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, 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.