Skip to content

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 September 27, 2026, Grok 4.7 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 250 a month, and cost $0.0220 to run on average.

Prompt by prompt

Each of the 5 coding prompts, and how Grok 4.7's reply did.

Grok 4.7 on each coding prompt
PromptResultCostTime
Turn a title into a URL slugEverydayPassed: All 7 tests passed.$0.00486.7 s
Parse a duration like “1h 30m”EverydayPassed: All 10 tests passed.$0.015125.3 s
Merge overlapping intervalsEverydayPassed: All 7 tests passed.$0.00253.8 s
Evaluate an arithmetic expression, no evalHardPassed: All 15 tests passed.$0.0472124.9 s
Parse CSV with quoted fieldsHardPassed: All 8 tests passed.$0.0403100.4 s

Every coding reply from Grok 4.7

  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 String(title)
        .normalize("NFD")
        .replace(/[\u0300-\u036f]/g, "")
        .toLowerCase()
        .replace(/[^a-z0-9]+/g, "-")
        .replace(/^-+|-+$/g, "");
    }
    ```

    1,719 tokens in, 724 out (644 of them reasoning) · 6.7 s · $0.0048 · 1 message on Pro · answered by x-ai/grok-4.7 via xAI ·

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

    1,705 tokens in, 2,862 out (2,687 of them reasoning) · 25.3 s · $0.0151 · 1 message on Pro · answered by x-ai/grok-4.7 via xAI ·

  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(([start, end]) => [start, end])
        .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 [start, end] = sorted[i];
        const last = merged[merged.length - 1];
        if (start <= last[1]) {
          if (end > last[1]) last[1] = end;
        } else {
          merged.push([start, end]);
        }
      }
    
      return merged;
    }
    ```

    1,683 tokens in, 306 out (119 of them reasoning) · 3.8 s · $0.0025 · 1 message on Pro · answered by x-ai/grok-4.7 via xAI ·

  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) {
      if (typeof expression !== "string") {
        throw new Error("Invalid expression");
      }
    
      const s = expression;
      let i = 0;
    
      function skip() {
        while (i < s.length && (s[i] === " " || s[i] === "\t" || s[i] === "\n" || s[i] === "\r" || s[i] === "\f" || s[i] === "\v")) {
          i++;
        }
      }
    
      function parseAdd() {
        let left = parseMul();
        for (;;) {
          skip();
          const op = s[i];
          if (op !== "+" && op !== "-") break;
          i++;
          const right = parseMul();
          left = op === "+" ? left + right : left - right;
        }
        return left;
      }
    
      function parseMul() {
        let left = parseUnary();
        for (;;) {
          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 parsePow();
      }
    
      function parsePow() {
        const base = parsePrimary();
        skip();
        if (s[i] === "^") {
          i++;
          return base ** parseUnary();
        }
        return base;
      }
    
      function parsePrimary() {
        skip();
        if (s[i] === "(") {
          i++;
          const value = parseAdd();
          skip();
          if (s[i] !== ")") throw new Error("Invalid expression");
          i++;
          return value;
        }
        return parseNumber();
      }
    
      function parseNumber() {
        skip();
        if (i >= s.length || s[i] < "0" || s[i] > "9") {
          throw new Error("Invalid expression");
        }
        const start = i;
        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 = parseAdd();
      skip();
      if (i !== s.length) throw new Error("Invalid expression");
      return value;
    }
    ```

    1,785 tokens in, 9,532 out (8,879 of them reasoning) · 124.9 s · $0.0472 · 1 message on Pro · answered by x-ai/grok-4.7 via xAI ·

  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) {
      if (text === "") return [];
    
      const rows = [];
      let row = [];
      let field = "";
      let inQuotes = false;
      let i = 0;
    
      while (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;
          }
          continue;
        }
    
        if (c === '"') {
          if (field.length === 0) inQuotes = true;
          else field += '"';
          i += 1;
          continue;
        }
    
        if (c === ",") {
          row.push(field);
          field = "";
          i += 1;
          continue;
        }
    
        if (c === "\n" || (c === "\r" && text[i + 1] === "\n")) {
          i += c === "\r" ? 2 : 1;
          row.push(field);
          rows.push(row);
          row = [];
          field = "";
          continue;
        }
    
        field += c;
        i += 1;
      }
    
      if (text[text.length - 1] !== "\n" || inQuotes) {
        row.push(field);
        rows.push(row);
      }
    
      return rows;
    }
    ```

    1,717 tokens in, 8,172 out (7,825 of them reasoning) · 100.4 s · $0.0403 · 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. 13 models share the hard-problems pick, Grok 4.7 among them.

Grok 4.7 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
Grok 4.7Our pick: hard problems (shared)5 of 5250 a month on Pro$0.0220
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.

Grok 4.7, and coding, elsewhere

Questions

Is Grok 4.7 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 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, 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.