xAI
Grok 4.7
x-ai/grok-4.7
The flagship listed under SpaceXAI for coding, agentic tasks, and knowledge work, with particular strength in long-running software tasks and verifying its own work.
RoleThe self-checking engineer
$2
In / M
$6
Out / M
500K
Context
- AA intelligence index
- 35.5
- Inputs
- text, image, file
- Outputs
- text
- Tools
- Listed
- Structured output
- Listed
- Reasoning
- Listed
- Weights
- Not verified
- Listed
- Sep 21, 2026
01 · What it's good at
Use it for this.
Three jobs this model is built for, and the ones to give to something else.
01
Long-running software engineering tasks
02
Agent loops that verify their own work before reporting done
03
Knowledge work over large inputs
Skip it for
- Million-token inputs. This listing caps context below the 1M offered by several peers
02 · Example tasks
What you'd actually send it.
Real inputs, not a benchmark. Paste one into the snippet below to try it.
You send
Fix the flaky test in queue.spec.ts. Before you report done, run it 20 times and show the pass count.
Why this model
Self-verification is the strength the listing calls out.
03 · Your stack
Where it sits: Plan & reason.
A main agent model for engineering work. It also makes a good second opinion next to a Claude or GPT agent: run both on the same task and keep the one that passes your tests.
Layer 01
Retrieve
Layer 02 · this model
Plan & reason
Layer 03
Do the volume
Layer 04
Gate & route
Layer 05
Draw, speak, listen
04 · Wire it up
One request. Paste and run.
Uses OpenRouter, so one key works for every model on this site. Set OPENROUTER_API_KEY and swap the prompt for one of the tasks above.
// OpenRouter speaks the OpenAI Chat Completions format.
const res = await fetch("https://openrouter.ai/api/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "x-ai/grok-4.7",
"messages": [
{
"role": "user",
"content": "Fix the flaky test in queue.spec.ts. Run it 20 times before you report done."
}
],
"reasoning": {
"effort": "high"
},
"tools": [
{
"type": "function",
"function": {
"name": "read_file",
"description": "Read a file from the repository",
"parameters": {
"type": "object",
"properties": {
"path": {
"type": "string"
}
},
"required": [
"path"
]
}
}
}
]
}),
});
const data = await res.json();
const message = data.choices[0].message;
for (const call of message.tool_calls ?? []) {
// Run the tool yourself, then send the result back as
// { role: "tool", tool_call_id: call.id, content: result } and call again.
console.log(call.function.name, call.function.arguments);
}
console.log(message.content);
05 · Watch out for
Gotchas.
Model ids still start with x-ai/ even though OpenRouter lists the lab as SpaceXAI.
The listing supports logprobs, which helps if you want a confidence signal from a chat model.
Sources
Lessons are written from each model's listing and the linked docs. We don't publish our own benchmark numbers; the index above is Artificial Analysis, as shown on OpenRouter.
Keep learning