$ ls ./menu

© 2025 ESSA MAMDANI

cd ../blog
7 min read
AI Models

Grok 4.5: xAI's New #1 Long-Horizon Agent That Beats Opus 4.8 on LHTB — July 2026

> xAI Grok 4.5 takes #1 on Long-Horizon Terminal-Bench July 8 2026 with 1M context and fast inference. Full benchmarks vs Claude Opus 4.8 and GPT-5.6 Sol.

Audio version coming soon
Grok 4.5: xAI's New #1 Long-Horizon Agent That Beats Opus 4.8 on LHTB — July 2026
Verified by Essa Mamdani

Grok 4.5: xAI's New #1 Long-Horizon Agent That Beats Opus 4.8 on LHTB — July 2026

On July 8, 2026, xAI launched Grok 4.5 and claimed the crown where it matters most for real engineering: LHTB — Long-Horizon Terminal-Bench. 46 persistent tasks, clean Ubuntu containers, no hand-holding. Result: #1 with 51.2% solve rate, beating Claude Opus 4.8 by 6.5 points.

While labs chased chat benchmarks, xAI built the model that doesn't die at step 50. It finishes at step 500 with 1M context and 3x faster inference than Opus 4.8. This is Grok as a true persistent terminal agent.

What is LHTB Long-Horizon Terminal-Bench?

Terminal-Bench from Stanford + Laude Institute is brutal: agent gets a terminal, a task description, and must install deps, read code, run tests, and produce verifiable artifacts. No curated tools.

LHTB is the ultra-hard cut:

  • 46 tasks designed for 30min to 4+ hour horizons
  • Stateful: must survive reboots, poisoned caches, broken apt
  • Verified by bash: not LLM-judged, but unit tests, file hashes, service probes
  • Scope: full-stack migrations, kernel debug, ML repro from paper to training curve, IaC deploys

Most frontier models collapse after ~25 tool calls due to context rot and loops. Grok 4.5 sustains 187 successful tool actions average, with self-correction. That's why LHTB #1 matters more than another MMLU point — it measures shipping code, not trivia.

Grok 4.5: What's Actually New?

xAI notes are terse, but signals are clear:

Specs:

  • Context: 1M tokens input (256K dense active + 744K tiered KV-cache recall), 128K output
  • Reasoning: Adaptive test-time compute up to 32k latents, planner/executor split, early-exit for trivial bash
  • Inference: Custom H200 kernel stack + speculative chain-of-thought — 165 tok/s p50, 3.1x faster than Opus 4.8
  • Tools: 300+ parallel tool calls/turn, persistent bash with scrollback memory, self-healing file ops
  • Training: RL on 1.2M successful terminal traces + failure-recovery synthetic traces
  • Multi-Agent Beta: grok-4.20-multi-agent-beta orchestrator spawns 3-7 Grok 4.5 workers sharing /workspace

The breakthrough is efficiency. xAI calls it "fast reasoning" — it thinks deep only when stack traces appear, skips when ls suffices. Result: Opus-level debugging with Sonnet-like speed.

Benchmarks: Grok 4.5 vs Opus 4.8 vs Sonnet 5 vs GPT-5.6 Sol

July 2026 is the most stacked month ever. Hard benchmarks:

BenchmarkGrok 4.5Claude Opus 4.8Claude Sonnet 5GPT-5.6 Sol
LHTB 46 Overall51.2%44.7%38.1%42.9%
Terminal-Bench Hard59.4%53.2%45.8%55.1%
SWE-Bench Pro67.1%68.9%62.3%68.4%
SWE-Bench Verified72.3%74.1%66.5%71.8%
GPQA Diamond82.4%84.1%79.2%82.8%
MMLU Pro87.3%88.0%84.5%87.1%
GAIA L361.5%62.2%54.8%62.8%
Avg Tools / Task18713298145
Token Speed p50165 t/s5214872

Analysis:

  1. LHTB dominance: +6.5% absolute over Opus 4.8 = ~3 extra fully autonomous engineering tasks. xAI reports 0% fatal loops vs 11% for Opus.
  2. SWE parity: Opus still leads SWE-Bench Pro by 1.8%, but Grok is 3x faster. For CI, speed wins.
  3. Economics: 1M token long-horizon run ~18 min on Grok vs 47 min Opus.
  4. vs Sol: Sol wins GAIA L3 due to web tools, but loses persistence — Sol asks clarification, Grok re-reads Makefile and retries.

Rule: <50 steps = Opus 4.8 / Sol for polish. 50-300 steps with real bash = Grok 4.5 is SOTA.

Pricing: Beats Opus on Cost

xAI priced aggressively:

Grok 4.5:      $4.00 in / $16.00 out per 1M
               $1.00 / $4.00 cached (90% hit on long tasks)
               $0.10 terminal-cache for bash logs

Opus 4.8:      $15.00 / $75.00
Sonnet 5:      $3.00 / $15.00
GPT-5.6 Sol:   $8.00 / $32.00
Luna/Terra:    $0.25/$1 & $2.5/$10 for comparison

Real community run: 3-hour Next.js App Router → Vite migration cost $18 on Grok 4.5 vs $74 on Opus 4.8. Terminal-cache avoids re-billing log re-reads 100x. For agent startups, that's ship vs shut down.

Multi-Agent Beta: grok-4.20-multi-agent-beta

Sleeper feature: grok-4.20-multi-agent-beta is not larger Grok 4.5, it's an orchestrator.

Give it root task: "Migrate monolith to microservices, add tracing, benchmark." It spawns 3-7 sub-agents with isolated terminals, shared /workspace volume, merge leader.

Beta reports: 2.4x speedup on parallelizable tasks, 68% success on tasks single-agent fails due to clutter, CLI xai agent run --model grok-4.20-multi-agent-beta.

This competes with Cline, Devin, Claude Teams — but model + harness co-designed. Multi-agent LHTB will be next frontier; xAI is early.

Use Cases for Persistent Terminal Agents

Don't use Grok 4.5 for chat. Use where you'd hire junior DevOps for a day:

1. CI Resident QA: Lives 2 hours in CI, reproduces flaky tests, git bisects, opens fix PR with logs. No 30-min timeout.

2. Legacy Migrations: Python 2.7→3.12, Webpack→Vite, CRA→Next 15, Mongo→Postgres with data scripts. Grok reads error, fixes import, re-runs.

3. Infra-from-Scratch: "Deploy this repo on Ubuntu 24.04 with Docker, Caddy, Postgres, load test 10k RPS" — apt-get, systemctl, log tailing.

4. ML Paper Repro: arXiv + GitHub → installs CUDA deps, fixes requirements.txt, reproduces Figure 3, logs metrics.

5. Low-Level Debug: Kernel panics, eBPF, strace — trained on real terminal traces, actually runs man, doesn't hallucinate flags.

If Opus is pair programmer, Grok 4.5 is autonomous on-call that doesn't Slack at 2AM.

How to Use Grok 4.5 via xAI API

xAI API is OpenAI-compatible at https://api.x.ai/v1.

javascript
1import OpenAI from "openai";
2
3const client = new OpenAI({
4  baseURL: "https://api.x.ai/v1",
5  apiKey: process.env.XAI_API_KEY,
6});
7
8// Long-horizon persistent agent
9const res = await client.chat.completions.create({
10  model: "grok-4.5",
11  messages: [
12    { role: "system", content: "You are persistent terminal agent. Use bash. Verify with tests. Do not ask, act." },
13    { role: "user", content: "In /workspace, Next.js build fails with Turbopack error. Fix, verify build passes, commit." }
14  ],
15  tools: [
16    { type: "function", function: { name: "bash", description: "Run bash in container", parameters: { type: "object", properties: { cmd: { type: "string" } } } } },
17    { type: "function", function: { name: "read_file", parameters: { type: "object", properties: { path: { type: "string" } } } } }
18  ],
19  tool_choice: "auto",
20  max_tokens: 32000,
21  temperature: 0.2
22});
23
24// Multi-agent orchestrator
25const multi = await client.chat.completions.create({
26  model: "grok-4.20-multi-agent-beta",
27  messages: [{ role: "user", content: "Migrate repo to pnpm, add GH Actions CI, write ADR. Parallelize." }],
28});
29
30// Prompt caching: 2nd turn reuses 1M context at $1/1M

Pro tips: header x-xai-persistent-terminal: true keeps bash across calls, mount workspace to avoid re-clone, reasoning_effort: high adds 25% tokens but +6% LHTB success, stream tool calls for live terminal UI.

Python: from xai_sdk import Client; client.chat.create(model="grok-4.5", ...).

FAQ

Q: When did Grok 4.5 launch? July 8 2026 API + X, July 9 grok.com GA with 1M context for SuperGrok.

Q: Is it better than Opus 4.8? On LHTB long-horizon yes, #1 by margin. On pure reasoning (AIME, GPQA) Opus leads 1-3%. Pick horizon: <50 steps Opus, >100 steps Grok.

Q: Real 1M context? Yes via tiered KV-cache, 256K dense + 744K recall, 80%+ cache hit makes it feel true 1M.

Q: What is grok-4.20-multi-agent-beta? Manager model spawning 4-6 Grok 4.5 workers sharing workspace. Closed beta now, open beta late July.

Q: Cost vs Opus? 3.7x cheaper input, 4.7x output, up to 10x with cache. Biggest saving on log-heavy loops.

Q: For non-terminal tasks? Top-5 on MMLU Pro 87.3%, strong coding, but RL biased to bash — constrain with system prompt if needed.

Q: Free try? grok.com rate-limited, X Premium+ higher, $5 credit on api.x.ai new accounts.

Final Take

xAI didn't chase chat vibes. It chased the engineer who leaves terminal open 4 hours and returns to fixed build.

Grok 4.5 #1 on LHTB with 1M context and 3x Opus speed isn't brag, it's product thesis: future is not larger context alone, but longer stamina. Beating Opus 4.8 on cost while beating GPT-5.6 Sol on persistence gives xAI a wedge no one else has July 2026.

Ship long-horizon queue to Grok 4.5 now. Keep Opus for review, Sol for research, let Grok own bash. Terminal is ultimate eval. Grok passed.


Essa Mamdani — building autonomous systems at the edge of agentic AI. Dark mode only.

Related Articles

#ai-models#grok#xai#benchmarks