Comparison · Coding
ChatGPT vs Grok for coding
On llmwise Pro, GPT-6.2 Sol gets up to 125 messages a month and Grok 4.7 up to 250 messages a month. ChatGPT is OpenAI's own app for its GPT models; llmwise has GPT models in its own chat, not ChatGPT itself. We ran the same 5 coding prompts on all 7 GPT models and Grok's one model and published every reply: the results, then GPT-6 Luna against Grok 4.7 prompt by prompt, then how GPT and Grok 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, GPT's 7 models passed 35 of 35; GPT-6.2 Astra, GPT-6 Astra and 5 more each passed 5 of 5. Grok's one model passed 5 of 5 ($0.0271 a reply). GPT-6 Luna and Grok 4.7 each passed 5 of the 5 prompts, so these coding prompts don't split GPT and Grok; the replies on this page show how they differ.
GPT and Grok on our coding test runs
Every GPT and Grok 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 |
|---|---|---|---|---|---|
| GPT-6.2 AstraOpenAI | 5 of 5 | 2 of 2 | 1 each, of 31 a month on Pro | $0.0132 | 3.9 s |
| GPT-6 AstraOpenAI | 5 of 5 | 2 of 2 | 1 each, of 31 a month on Pro | $0.0108 | 7.1 s |
| GPT-6.2 SolOpenAI | 5 of 5 | 2 of 2 | 1 each, of 125 a month on Pro | $0.0037 | 3.7 s |
| GPT-6.1 SolOpenAI | 5 of 5 | 2 of 2 | 1 each, of 125 a month on Pro | $0.0041 | 8.4 s |
| GPT-6 SolOpenAI | 5 of 5 | 2 of 2 | 1 each, of 125 a month on Pro | $0.0028 | 4.4 s |
| GPT-6.1 TerraOpenAI | 5 of 5 | 2 of 2 | 1 each, of 250 a month on Pro | $0.0013 | 7.4 s |
| GPT-6 LunaOpenAI | 5 of 5 | 2 of 2 | 1 each, of 60 a day on Pro | $0.0001 | 9.2 s |
| Grok 4.7xAI | 5 of 5 | 2 of 2 | 1 each, of 250 a month on Pro | $0.0271 | 51.4 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.
GPT vs Grok, prompt by prompt
Each coding prompt with GPT-6 Luna and Grok 4.7 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: GPT-6 Luna passed 5 of 5 and Grok 4.7 5 of 5. GPT-6 Luna answered 4.3× sooner at the median, 7.3 s against 31.2 s. GPT-6 Luna cost 191.7× less, $0.0007 against $0.1354 for the 5 replies. Grok 4.7's replies ran 20% longer, in tokens of reply, thinking not counted.
1. Turn a title into a URL slug
Everyday. GPT: 7 of 7 models passed, GPT-6 Luna the cheapest at $0.0001 · Grok: 1 of 1 model passed, Grok 4.7 at $0.0053. The prompt in full.
GPT-6 Luna and Grok 4.7 both passed this one. GPT-6 Luna answered sooner (2.3 s to 5.9 s), and GPT-6 Luna's reply cost less ($0.0001 to $0.0053); GPT-6 Luna wrote 74 tokens of reply, Grok 4.7 80.
GPT-6 Luna
Passed: All 7 tests passed.
```javascript function slugify(title) { return title .toLowerCase() .normalize("NFD") .replace(/[\u0300-\u036f]/g, "") .replace(/[^a-z0-9]+/g, "-") .replace(/^-|-$/g, ""); } ```655 tokens in, 74 out · 2.3 s · $0.0001 · 1 message on Pro · answered by openai/gpt-6-luna via OpenAI ·
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 ·
2. Parse a duration like “1h 30m”
Everyday. GPT: 7 of 7 models passed, GPT-6 Luna the cheapest at $0.0001 · Grok: 1 of 1 model passed, Grok 4.7 at $0.0151. The prompt in full.
GPT-6 Luna and Grok 4.7 both passed this one. GPT-6 Luna answered sooner (7.3 s to 31.2 s), and GPT-6 Luna's reply cost less ($0.0001 to $0.0151); GPT-6 Luna wrote 125 tokens of reply, Grok 4.7 165.
GPT-6 Luna
Passed: All 10 tests passed.
```javascript function parseDuration(text) { const match = /^\s*(?:(\d+)h)?\s*(?:(\d+)m)?\s*(?:(\d+)s)?\s*$/.exec(text); if (!match || !match[1] && !match[2] && !match[3]) return null; return Number(match[1] || 0) * 3600 + Number(match[2] || 0) * 60 + Number(match[3] || 0); } ```640 tokens in, 296 out (171 of them reasoning) · 7.3 s · $0.0001 · 1 message on Pro · answered by openai/gpt-6-luna via OpenAI ·
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 ·
3. Merge overlapping intervals
Everyday. GPT: 7 of 7 models passed, GPT-6 Luna the cheapest at $0.0001 · Grok: 1 of 1 model passed, Grok 4.7 at $0.0052. The prompt in full.
GPT-6 Luna and Grok 4.7 both passed this one. GPT-6 Luna answered sooner (3.0 s to 8.3 s), and GPT-6 Luna's reply cost less ($0.0001 to $0.0052); GPT-6 Luna wrote 127 tokens of reply, Grok 4.7 174.
GPT-6 Luna
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { const sorted = intervals.map(([start, end]) => [start, end]); sorted.sort((a, b) => a[0] - b[0]); const merged = []; for (const [start, end] of sorted) { const last = merged[merged.length - 1]; if (!last || start > last[1]) { merged.push([start, end]); } else { last[1] = Math.max(last[1], end); } } return merged; } ```621 tokens in, 127 out · 3.0 s · $0.0001 · 1 message on Pro · answered by openai/gpt-6-luna via OpenAI ·
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 ·
4. Evaluate an arithmetic expression, no eval
Hard. GPT: 7 of 7 models passed, GPT-6 Luna the cheapest at $0.0003 · Grok: 1 of 1 model passed, Grok 4.7 at $0.0716. The prompt in full.
GPT-6 Luna and Grok 4.7 both passed this one. GPT-6 Luna answered sooner (18.9 s to 131.0 s), and GPT-6 Luna's reply cost less ($0.0003 to $0.0716); GPT-6 Luna wrote 536 tokens of reply, Grok 4.7 676.
GPT-6 Luna
Passed: All 15 tests passed.
```javascript function evaluate(expression) { if (typeof expression !== "string") { throw new Error("Expression must be a string"); } const tokens = []; let i = 0; while (i < expression.length) { if (/\s/.test(expression[i])) { i++; continue; } const number = /(?:\d+(?:\.\d*)?|\.\d+)/y; number.lastIndex = i; const match = number.exec(expression); if (match) { tokens.push({ type: "number", value: Number(match[0]) }); i = number.lastIndex; } else if ("+-*/^()".includes(expression[i])) { tokens.push({ type: expression[i], value: expression[i] }); i++; } else { throw new Error("Invalid expression"); } } let position = 0; function parsePrimary() { const token = tokens[position]; if (token?.type === "number") { position++; return token.value; } if (token?.type === "(") { position++; const value = parseSum(); if (tokens[position]?.type !== ")") throw new Error("Invalid expression"); position++; return value; } throw new Error("Invalid expression"); } function parsePower() { const base = parsePrimary(); if (tokens[position]?.type === "^") { position++; return base ** parseUnary(); } return base; } function parseUnary() { if (tokens[position]?.type === "-") { position++; return -parseUnary(); } return parsePower(); } function parseProduct() { let value = parseUnary(); while (tokens[position]?.type === "*" || tokens[position]?.type === "/") { const operator = tokens[position++].type; const right = parseUnary(); value = operator === "*" ? value * right : value / right; } return value; } function parseSum() { let value = parseProduct(); while (tokens[position]?.type === "+" || tokens[position]?.type === "-") { const operator = tokens[position++].type; const right = parseProduct(); value = operator === "+" ? value + right : value - right; } return value; } const result = parseSum(); if (position !== tokens.length) throw new Error("Invalid expression"); return result; } ```721 tokens in, 933 out (397 of them reasoning) · 18.9 s · $0.0003 · 1 message on Pro · answered by openai/gpt-6-luna via OpenAI ·
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 ·
5. Parse CSV with quoted fields
Hard. GPT: 7 of 7 models passed, GPT-6 Luna the cheapest at $0.0002 · Grok: 1 of 1 model passed, Grok 4.7 at $0.0382. The prompt in full.
GPT-6 Luna and Grok 4.7 both passed this one. GPT-6 Luna answered sooner (14.4 s to 80.8 s), and GPT-6 Luna's reply cost less ($0.0002 to $0.0382); GPT-6 Luna wrote 346 tokens of reply, Grok 4.7 351.
GPT-6 Luna
Passed: All 8 tests passed.
```javascript function parseCsv(text) { if (text === "") return []; const rows = []; let row = []; let field = ""; let inQuotes = false; let fieldStart = true; let endedWithRowBreak = false; for (let i = 0; i < text.length; i++) { const char = text[i]; if (inQuotes) { if (char === '"') { if (text[i + 1] === '"') { field += '"'; i++; } else { inQuotes = false; } } else { field += char; } endedWithRowBreak = false; continue; } if (char === '"' && fieldStart) { inQuotes = true; fieldStart = false; endedWithRowBreak = false; } else if (char === ",") { row.push(field); field = ""; fieldStart = true; endedWithRowBreak = false; } else if (char === "\n" || (char === "\r" && text[i + 1] === "\n")) { if (char === "\r") i++; row.push(field); rows.push(row); row = []; field = ""; fieldStart = true; endedWithRowBreak = true; } else { field += char; fieldStart = false; endedWithRowBreak = false; } } if (!endedWithRowBreak) { row.push(field); rows.push(row); } return rows; } ```653 tokens in, 736 out (390 of them reasoning) · 14.4 s · $0.0002 · 1 message on Pro · answered by openai/gpt-6-luna via OpenAI ·
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 ·
Each GPT model against each Grok model
Every GPT model against every Grok model on the same 5 coding prompts: passes, the median wait and what the replies cost. A lead under 10% counts as close.
GPT-6.2 Astra vs Grok 4.7: 5 of 5 each; GPT-6.2 Astra answered 8.8× sooner at the median and cost 2.0× less.
GPT-6 Astra vs Grok 4.7: 5 of 5 each; GPT-6 Astra answered 5.4× sooner at the median and cost 2.5× less. GPT-6 Astra vs Grok 4.7, on every job.
GPT-6.2 Sol vs Grok 4.7: 5 of 5 each; GPT-6.2 Sol answered 8.3× sooner at the median and cost 7.3× less.
GPT-6.1 Sol vs Grok 4.7: 5 of 5 each; GPT-6.1 Sol answered 4.0× sooner at the median and cost 6.6× less.
GPT-6 Sol vs Grok 4.7: 5 of 5 each; GPT-6 Sol answered 6.5× sooner at the median and cost 9.6× less. GPT-6 Sol vs Grok 4.7, on every job.
GPT-6.1 Terra vs Grok 4.7: 5 of 5 each; GPT-6.1 Terra answered 4.6× sooner at the median and cost 20.4× less. GPT-6.1 Terra vs Grok 4.7, on every job.
GPT-6 Luna vs Grok 4.7: 5 of 5 each; GPT-6 Luna answered 4.3× sooner at the median and cost 191.7× less. GPT-6 Luna vs Grok 4.7, on every job.
How the coding replies are scored
Every GPT and Grok 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
GPT: 7 models, GPT-6.2 Astra, GPT-6 Astra, GPT-6.2 Sol, GPT-6.1 Sol, GPT-6 Sol, GPT-6.1 Terra, and GPT-6 Luna. Grok: one model, Grok 4.7.
Price per message
The least expensive GPT model is GPT-6 Luna (60 messages a day on Pro); Grok's one model is Grok 4.7 (250 messages a month on Pro).
Context window
GPT goes up to 1.05M tokens (GPT-6.2 Astra); Grok up to 500K tokens (Grok 4.7).
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, GPT-6.2 Astra and GPT-6 Astra from Pro up. Every plan is month to month: cancel in two clicks.
Every GPT and Grok model's context window, files and API price: Grok vs ChatGPT.
Where your messages go
In llmwise, a message to GPT goes to its maker, OpenAI, 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, ChatGPT or Grok for coding?
In our coding test runs on November 18, 2026, GPT's 7 models passed 35 of 35; GPT-6.2 Astra, GPT-6 Astra and 5 more each passed 5 of 5. Grok's one model passed 5 of 5 ($0.0271 a reply). GPT-6 Luna and Grok 4.7 each passed 5 of the 5 prompts, so these coding prompts don't split GPT and Grok; the replies on this page show how they differ.
Is GPT or Grok cheaper?
In llmwise, the least expensive GPT model is GPT-6 Luna (60 messages a day on Pro), and the least expensive Grok model is Grok 4.7 (250 messages a month on Pro). At API list prices (October 2026), a typical message of 4,000 tokens in and 700 out costs $0.0008 on GPT-6 Luna and $0.0122 on Grok 4.7.
Can I use GPT and Grok in the same chat?
Yes. Ask GPT-6 Luna a question, then switch the picker to Grok 4.7 and ask again: Grok 4.7 sees the whole conversation, GPT-6 Luna'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.