Grok 4.7 API pricing and cost calculator

A Grok 4.7 call with 100,000 input and 5,000 output tokens costs $0.23 uncached and $0.155 with half the input cached. Past 200,000 input tokens the whole request bills at $4 input and $12 output per million, so check prompt length before you scale.

Grok 4.7 is SpaceXAI's model for coding, agentic tasks and knowledge work, and it succeeds Grok 4.6. It reads text, image and file input inside a 500,000 token context window. The standard rates are $2 per million input tokens and $6 per million output tokens. Cache reads cost $0.50 per million, 75% off the uncached input rate, and that matters because a coding agent resends the same long prefix on every turn. Prompts past 200,000 tokens move to a different tier, so prompt length is a pricing variable here as well as a limit. This page prices whole requests and sessions so you can see where the money goes.

By TechCompare · Updated

SpaceXAI: Grok 4.7

xAI's own price

Input
$2
Output
$6
Cached
$0.50

per 1M tokens

Batch available

Price checked 2026-11-07

Calculator

Cost Comparison

Based on 100,000 input tokens (50% cached), 5,000 output tokens, and 100 requests.Prices come live from OpenRouter at each maker's own price where it's listed. Temporary deals are left out.

How this is calculated

A request with 100,000 input and 5,000 output tokens costs $0.20 for input and $0.03 for output when nothing is cached, which makes $0.23 per call. Reading half the input from cache brings the call to $0.155, and 100 calls a month come to $15.50. Past 200,000 input tokens the whole request moves to $4 input, $1 cache reads and $12 output per million, not just the tokens beyond the line. A 300,000 input and 5,000 output request crosses it, so it costs $1.26 with no cache hits and $0.81 with half the input cached. Agent work is where the cache rate earns its place. A coding session of 60 turns that each send 50,000 input tokens, mostly cached, and write 1,200 output tokens costs $2.382 in total. The same session with no cache hits costs $6.432. Batch jobs have their own discount. Both input and output come in 20% below standard. A nightly review job of 5,000 requests with 30,000 input and 3,000 output tokens each costs $312 in batch and $390 at standard rates.

Verdict

Price Grok 4.7 on finished tasks. A coding or agent task usually takes many calls, and each call adds its own input, cache reads and output. Record those totals on a sample of your real work, then multiply by your volume. Keep the cached prefix stable, since a prefix that changes every turn can't be read from cache. Watch where your longest prompts land against the 200,000 token line, because crossing it reprices the whole call. Ask xAI's documentation whether cached tokens count toward that line before you design around it. Image and file inputs turn into tokens too, so measure them on real samples. If you're deciding whether to move up from Grok 4.6, run the same prompts through both and compare cost per accepted result, not cost per call.

More API Standalones scenarios

Frequently asked questions

How much does Grok 4.7 cost per million tokens?
At standard rates, input is $2, output is $6 and cache reads are $0.50 per million tokens. Prompts past 200,000 tokens move the whole request to $4 input, $12 output and $1 cache reads. Check xAI's model page for the current numbers before you commit to a large budget.
What happens when a Grok 4.7 prompt gets long?
Once a prompt passes 200,000 tokens, the entire request moves to the long prompt rates of $4 input and $12 output per million, against $2 and $6 below the line. A request of 300,000 input and 5,000 output tokens with half the input cached costs $0.81. The context window is 500,000 tokens, so a prompt can sit well inside it and still be repriced.
How much does a Grok 4.7 coding agent session cost?
It depends on turns, prompt size and how much of each prompt is cached. A session of 60 turns that each send 50,000 input tokens and write 1,200 output tokens costs $2.382 with most of the input cached and $6.432 with no cache hits. Log real sessions from your own agent for a week, since retries and tool output can double the token counts.
What does Grok 4.7 batch processing save?
Batch prices sit 20% below the standard rates. The uncached 100,000 input and 5,000 output example costs $0.184 in batch and $0.23 at standard rates. Batch work runs on xAI's schedule, so keep it for jobs that can wait.
Is Grok 4.7 priced differently from Grok 4.6?
The example call with half the input cached costs $0.155 on both models, so price doesn't separate them. That example uses 100,000 input and 5,000 output tokens. Your own mix of cached input and output decides the real gap, and quality on your tasks matters more than a small price difference.
What input does Grok 4.7 accept and how large is the context window?
It accepts text, image and file input, with a context window of 500,000 tokens. A prompt that fills the window with nothing cached and asks for a 2,000 token answer costs $2.024, and with most of the prompt read from cache it costs $0.674. Most calls are far smaller, so size your estimate from real prompts and use the token counter to measure the text.