Grok 4 API pricing: what it costs and how to pay less

Updated 2026-07-15

xAI's Grok 4 generation launched as three separate rate cards, roughly $3.00 per million input tokens and $15.00 per million output tokens for the flagship, with a cheaper Mini tier and a pricier vision tier on either side. The lineup has since moved on to Grok 4.5, and the bigger factor in a real bill is usage volume and reasoning-token overhead, not the sticker rate alone.

Quick answer: the rate card is only half the bill

xAI's Grok 4 generation shipped as three separate rate cards rather than one price. Reported direct-API list pricing put the flagship model at roughly $3.00 per million input tokens and $15.00 per million output tokens, a lighter Mini build at a fraction of that, and a vision-capable variant priced above the flagship on both ends. None of it is a subscription; every tier bills per token, with nothing bundled in for free. xAI's naming has since moved on to Grok 4.5, the generation carried through pay-as-you-go gateways today. On our own catalog, Grok 4.5 lists at $2.00 input and $6.00 output per million tokens officially, and $1.60 and $4.80 through a discounted routing endpoint, a flat 20% off both rates. The bigger swing factor in a real monthly bill is not that gap, though. It is how many tokens a typical request actually burns once reasoning traces, tool calls, and retries get counted in.

How Grok 4 token pricing actually works

Reported xAI direct-API rates at the Grok 4 generation's original launch show how much of that overhead was already priced into the sticker rate:

  • Input tokens carry the request itself: the system prompt, message history, and any documents or search results you feed in on every call, billed at the lower of the two rates.
  • Output tokens cover everything the model writes back, including any internal reasoning trace it produces before the final answer. On a model built for complex problems, that trace can run several times longer than the visible reply.
  • Vision-capable variants convert each image into a block of tokens before the model reads a word of your prompt, which is why a vision tier is priced above the equivalent text-only model on both ends.
  • Tool calls and live data lookups, web search or code execution, add their own round trip of tokens: the tool result comes back as input on the next turn, the same as a file read would.
  • None of this is bundled into a flat monthly fee. Every one of these token types bills at the same per-million rate as an ordinary chat turn, so a model that looks cheap on paper is not automatically cheap once it starts calling tools and reasoning at length.
Reported list price at the time of the Grok 4 generation's 2026 launch, independent of any gateway; Mini and Vision variants existed alongside it but their exact rates are not reproduced here. Confirm current official rates directly with xAI before budgeting a project, since the naming has since moved to Grok 4.5.
Grok 4 variant (as reported)Input $/1MOutput $/1MContext window
Grok 4$3.00$15.00256K

A worked example: pricing three traffic levels on Grok 4.5

Grok 4.5 is the generation available in most gateway catalogs today, so it is the cleanest one to price out with real assumptions. The table below models three traffic profiles, each weighted toward input tokens the way chat and coding traffic usually is, since prompts and carried context tend to dwarf the reply. It compares xAI's official Grok 4.5 rate against a discounted gateway rate side by side.

Assumes roughly 1,600 to 2,800 input tokens and 500 to 900 output tokens per request depending on tier; your own prompt and context size will move these numbers. Discounted gateway cost reflects a pay-as-you-go routing endpoint's pricing for grok-4.5, a flat 20% below xAI's official list on both input and output.
Traffic tierMonthly tokens (input / output)Official Grok 4.5 costDiscounted gateway costMonthly savings
Prototype (200 req/day)9.6M / 3.0M$37.20$29.76$7.44
Small production app (2,000 req/day)132M / 42M$516.00$412.80$103.20
Growth stage (20,000 req/day)1.68B / 540M$6,600.00$5,280.00$1,320.00

Why the actual invoice runs ahead of the calculator

None of these are exotic edge cases. They are the normal shape of production traffic, which is why a back-of-envelope estimate built from the rate card alone tends to run low against the real bill.

  • Reasoning length varies by prompt, not by plan. Two similarly worded questions can produce very different internal reasoning lengths, and that variance shows up as output tokens you cannot predict from the prompt alone.
  • Rate limits force retries. xAI throttles traffic in some form as volume climbs, and the exact thresholds are not fully published and can change over time. A burst of traffic that trips a limit gets queued or rejected, and the retry logic in most SDKs resends the same tokens as input again.
  • Model IDs look similar and price very differently. Calling the flagship ID when a script meant to call the Mini tier, or the reverse, is an easy typo, and it does not surface until the invoice is several times larger than expected.
  • Vision requests get budgeted like text. Teams that estimate a vision workload using the text-only per-token rate miss both the higher rate and the extra tokens the image itself adds before the prompt is even read.
  • Prompt caching support is not universal. Some endpoints discount a repeated system prompt or document on later calls; others bill every token at full rate on every request, so the same integration can cost noticeably different amounts depending on which endpoint it hits.

How Grok 4.5 compares to other frontier models

Grok 4.5 does not compete on price alone against every frontier model. Lined up against other flagship-class options carried in the same catalog, its official rate sits well below some and roughly level with others, and the gap holds once a discounted gateway rate is applied to all four. On official list pricing, Grok 4.5's $6.00 output rate is roughly a fifth of GPT-5.6 Sol's $30.00, close to a quarter of Claude Opus 4.8's $25.00, and half of Gemini 3.1 Pro's $12.00. Grok 4.5 and Gemini 3.1 Pro tie on input price; the real difference between them is on the output side and in context window, where the other three models here all reach into the seven-figure token range while Grok 4.5 tops out at 500K.

Official = list price from each provider. Discounted gateway = the same four models routed through a pay-as-you-go endpoint at 20% below each one's official list.
ModelOfficial input $/1MOfficial output $/1MContextDiscounted gateway $/1M (in / out)
Grok 4.5$2.00$6.00500K$1.60 / $4.80
Claude Opus 4.8$5.00$25.001M$4.00 / $20.00
GPT-5.6 Sol$5.00$30.001.05M$4.00 / $24.00
Gemini 3.1 Pro (preview)$2.00$12.001M$1.60 / $9.60

Cutting the Grok 4.5 bill without changing your workflow

The last item is the one lever that does not require touching a prompt, a retry policy, or a model choice at all.

  • Match the tier to the task. Route simple classification, formatting, or short-answer traffic to a lighter model, and reserve Grok 4.5 for the reasoning-heavy calls that actually need it.
  • Cap reasoning depth where the SDK exposes a setting for it, and cut tool-call loops off after a fixed number of round trips, so one bad prompt cannot spiral into an unbounded number of billed turns.
  • Log token counts per request from day one. Most surprises trace back to a single endpoint or prompt template burning far more tokens than the rest, and that stays invisible until someone actually checks the per-request numbers.
  • Build retry logic that backs off instead of resending immediately. A tight retry loop against a rate limit rebills the same input tokens on every attempt.
  • Route the request through an OpenAI-compatible gateway such as APIsRouter instead of billing at official list. The endpoint and response format stay the same; only the base URL and the per-token rate change, and that gateway's Grok 4.5 rate runs 20% below xAI's official list with pay-as-you-go billing and no subscription.

Config example: point an existing client at Grok 4.5

Because Grok 4.5 sits behind an OpenAI-compatible chat completions endpoint, switching where a request bills is a one-line change: swap the base URL and the model ID, and leave everything else in the client untouched. Verify a key with a single request before pointing production traffic at it.

from openai import OpenAI

client = OpenAI(
    api_key="sk-...",
    base_url="https://api.apisrouter.com/v1",
)

response = client.chat.completions.create(
    model="grok-4.5",
    messages=[
        {"role": "system", "content": "You are a precise technical assistant."},
        {"role": "user", "content": "Summarize the CAP theorem in three sentences."},
    ],
    max_tokens=300,
)

print(response.choices[0].message.content)
print(f"Tokens used: {response.usage.total_tokens}")

FAQ

How much does Grok 4 cost per API call?

It depends entirely on which Grok 4 variant is used and how many tokens the call burns. Reported original launch pricing for the flagship sat around $3.00 per million input tokens and $15.00 per million output tokens, with a lighter Mini tier well under a dollar per million and a vision-capable tier priced above the flagship on both ends. A single short call is a fraction of a cent; the totals only get interesting at production volume.

Is Grok 4.5 cheaper than GPT-5.6 or Claude Opus 4.8?

On official list pricing, yes, substantially. Grok 4.5's $6.00 output rate is roughly a fifth of GPT-5.6 Sol's $30.00 and close to a quarter of Claude Opus 4.8's $25.00. Gemini 3.1 Pro ties Grok 4.5 on input price but charges twice as much on output, and carries a larger context window.

Why did my Grok API bill come in higher than I estimated?

The usual culprits are reasoning-trace length, which varies by prompt and bills as output tokens; rate-limit retries that resend the same input tokens; and tool calls or vision inputs that add tokens the sticker rate does not make obvious. Logging actual per-request token counts, not just the rate card, is the fastest way to find which one is driving your number.

Do I need an xAI account to use Grok 4.5?

Not if you route through a third-party OpenAI-compatible gateway; you authenticate with that gateway's key instead, and the request format stays identical to calling xAI directly. Going straight to xAI does require its own account and billing setup.

What is the cheapest way to run Grok 4.5 in production?

Match the model to the task so Grok 4.5 only handles calls that actually need its reasoning strength, then route those calls through a pay-as-you-go gateway instead of billing at official list. APIsRouter carries grok-4.5 at $1.60 input and $4.80 output per million tokens, 20% below xAI's official rate, with no subscription and a checkout at /topup that takes payment first and emails the key, no signup required.

What context window does Grok 4.5 support?

500K tokens in the catalog most gateways carry today, smaller than Gemini 3.1 Pro, Claude Opus 4.8, or GPT-5.6 Sol's roughly 1M-plus windows, but still large enough for most single-document or multi-file coding contexts.