AI
Grok 4.5 delivers comparable code output with 75% fewer tokens than Claude Opus
A hands-on test of xAI's newest model versus Anthropic's flagship suggests Grok can match Opus on real coding tasks while consuming far fewer tokens and costing significantly less.
The New Stack
Challenging a trusted favorite#
After years of relying on Claude Opus for development work, I decided to put xAI's newly released Grok 4.5 through a real-world test. The stakes felt personal: xAI claims its model matches Opus on coding tasks while using roughly one-quarter the tokens and costing less than half as much. If true, it would upend the calculus many developers use when choosing an AI pair programmer.
Head-to-head testing on real code#
I ran three distinct coding challenges on both models using the same Rust repository—the fd file-finder utility—inside Cursor's Agent mode. Each test was isolated, and I tracked wall-clock time, token consumption, and cost using Cursor's usage dashboard.
Test 1: Debugging — I presented a bug where the –no-ignore-vcs flag inadvertently disabled parent-directory ignore files. Both models identified the root cause in the same place and produced identical fixes, each deleting a single line from src/main.rs. Opus finished in 30.43 seconds using 174.1K tokens; Grok took 46.25 seconds and 210.2K tokens.
Test 2: Refactoring — I asked both to extract a bloated construct_config function into a dedicated module with focused helpers. Both succeeded identically, moving code and splitting responsibilities while keeping all 264 tests green. Grok completed this in 83 seconds on 197.1K tokens ($0.27); Opus required 5.5 minutes and 953.7K tokens ($1.67)—nearly 5× as many tokens for the same result.
Test 3: Feature development — I requested a new –count flag that returns match totals without listing paths. Both delivered working implementations. Grok touched six files and added tests; Opus added one more file, more test coverage, and updated the manual page, making its version slightly more thorough. Grok completed this in 97 seconds on 602.6K tokens ($0.54); Opus took 5.5 minutes and 3.2M tokens ($3.25)—over 5× the token load.
The numbers that matter#
Across all three tasks, Opus consumed 4.3 times as many tokens as Grok—marginally wider than xAI's advertised 4.2× claim. On code quality alone, both models proved functionally interchangeable, with Opus showing a slight edge in documentation thoroughness but no difference in correctness.
Important caveats: These figures reflect Cursor's blended token counts, which include context reused across turns. Opus was tested on Cursor's "thinking" tier (incorporating extended reasoning), while Grok used the "fast" tier. Grok's pricing also carried a 50% promotional discount; at standard rates, the three jobs would cost roughly $2 versus Opus's $5.14. This test covered only three tasks in one codebase, not a comprehensive workload sampling.

