Skip to contentNew: Does ChatGPT recommend your brand? Free 60-second AI visibility check →
By The DDH Team · Digital Dashboard Hub

Grok 4 API Cost Calculator (2026)

By The DDH Team at Digital Dashboard HubUpdated

Stop writing AI prompts from scratch.

Tell us your business + your task + your model. We write the prompt — perfectly tuned for ChatGPT, Claude, Grok, Gemini, Midjourney, or any model. Plus 500+ pre-built prompts in your library.

14 days, no card. Cancel in 2 clicks.

xAI charges per token on the Grok API. Every call has two priced streams: input tokens (the prompt, the system message, prior turns you replay, tool definitions, any X-search results you pull into context) and output tokens (everything the model writes back, including tool-call arguments). Input and output are billed at different per-1M rates. Across the Grok-4 family, output runs 2x to 3x the input price — a much tighter spread than OpenAI's 5-6x or Anthropic's 5x ratio, which changes how you optimize.

As of June 2026, Grok's prices span a 30x range: Grok-4 Fast at $0.20 input / $0.50 output per 1M tokens up to Grok-4.20 at $2.00 / $6.00. Two cost levers genuinely matter: Grok-4.20 cache-hits bill at 90% off ($0.20/1M input), and xAI's data-sharing program returns up to **$150/month in free credits** in exchange for letting xAI train on your prompts and completions. No other major LLM provider offers a free-credit program at this scale.

Grok's two unique pitches: (1) **real-time X-data access** — the only LLM with live, native Twitter/X integration for current events, sentiment, and breaking news; and (2) **1-2M token context windows** across the family, doubling what OpenAI and Anthropic offer at comparable price points. The trade is ecosystem maturity: tooling, SDKs, and third-party integrations lag the bigger players.

Below: the full June-2026 price table verified against xAI's live docs, the canonical cost formula, four worked examples (1k, 100k, 1M, and a 5-turn agent loop), the $150/mo data-sharing trade explained in plain English, when real-time X access actually matters, and the FAQ that captures everything that trips teams up. Bookmark this — and quickly draft prompts that don't waste Grok's massive context window with our free ChatGPT prompt generator. Sibling calculators: OpenAI API cost · GPT-5 cost · DeepSeek cost.

Digital Dashboard Hub

Writing good prompts for ONE AI is hard. Writing them for GPT-5, Claude, Gemini, Perplexity, Midjourney and 6 more is a full-time job. DDH's AI Prompt Builder writes once, runs everywhere — locked to your niche, voice, and brand tone.

Free 14 days, no card.

Grok API price per 1M tokens — June 2026

Feature
Input ($/1M)
Output ($/1M)
Context window
Grok-4.20$2.00$6.002M tokens
Grok-4.3$1.25$2.501M tokens
Grok-4 Fast$0.20$0.502M tokens

Source, as of June 2026: xAI model documentation (https://docs.x.ai/docs/models) and x.ai/api. Grok-4.20 cache-hit pricing: 90% off standard input ($0.20/1M on cached portion). Grok-4.3 and Grok-4 Fast do not currently expose cache-hit pricing on the live docs page. Data-sharing program: up to $150/month in free API credits in exchange for opting your traffic into the training set (https://x.ai/api). X Premium+ is a $40/mo consumer chat subscription on x.com — separate billing relationship, does not include API credit. Real-time X-data search is included in the standard token bill on all three models.

The cost formula (memorize this one)

Every Grok API call follows the same math. There is no per-call fee, no platform fee, no minimum spend. You pay for what you send and what you get back, at the model's per-1M-token rate:

``` cost = (input_tokens / 1,000,000) × input_price_per_M + (output_tokens / 1,000,000) × output_price_per_M ```

Two adjustments stack on top, but only on Grok-4.20. First, **cache-hit pricing** drops the cached input portion to $0.20/1M — a 90% discount versus the $2.00 standard rate. The cache is opportunistic and prefix-based: put your stable system prompt, tool definitions, and any reusable few-shot examples at the start of the message array; put user-specific content last. Second, the **data-sharing program** returns up to $150/month in free credits if you opt your traffic into xAI's training set (see the dedicated section below). These two stack: a data-sharing-eligible workload running on cached Grok-4.20 prefixes can net out at zero marginal cost for the first ~75M cached input tokens per month.

Real-time X-search results that the model retrieves are billed as input tokens once they enter context — there is no separate search fee like Perplexity charges. This is one of Grok's cleanest pricing wins: live web/X grounding is built into the standard token rate.


Worked example 1: a single 1,000-in / 500-out call

Take a representative call — a 1,000-token prompt that returns a 500-token answer, roughly a 750-word brief in and a 375-word reply out. At standard rates, the per-call cost lands as:

Grok-4.20: (1000 / 1,000,000) × $2.00 + (500 / 1,000,000) × $6.00 = $0.002 + $0.003 = **$0.005 per call**.

Grok-4.3: 0.001 × $1.25 + 0.0005 × $2.50 = $0.00125 + $0.00125 = **$0.0025 per call**.

Grok-4 Fast: 0.001 × $0.20 + 0.0005 × $0.50 = $0.0002 + $0.00025 = **$0.00045 per call**.

Notice the 11x spread between Grok-4 Fast ($0.00045) and Grok-4.20 ($0.005) on identical token volumes — a tighter spread than the 145x range across OpenAI's GPT-5 family. The pricing tiers are closer in price because the capability gaps are smaller; pick the cheapest tier that hits your quality bar.


Worked example 2: 100,000 calls per month

Multiply the per-call numbers by 100,000. This is a realistic mid-size workload — daily classification on 3,000+ records, weekly summarization runs, a moderate-volume agent loop:

Grok-4.20: **$500/month**. Grok-4.3: **$250/month**. Grok-4 Fast: **$45/month**.

Now apply cache-hits to the Grok-4.20 row. If 800 of every 1,000 input tokens are a stable system prefix that hits cache 80% of the time, those 640 cached tokens drop from $2.00/1M to $0.20/1M — saving 90% on 64% of input. That cuts the input bill from $200 → $85, taking the total from $500 → $385 (about 23% off).

Now apply data-sharing. If your traffic is eligible (no PII, no regulated content), the $150/mo credit fully absorbs $385 → $235 net. On Grok-4 Fast, the same $45/mo workload is fully covered by the data-sharing credit — you pay $0. This is the cheapest production tier in the industry once data-sharing is in play. Build cache-anchored prompts free with our code prompt builder.


Worked example 3: scaling to 1,000,000 calls

Now scale to 1M calls — a full production workload (e.g., per-user analysis across a SaaS app with 30,000 active users running 33 calls/month each):

Grok-4.20: **$5,000/month**. Grok-4.3: **$2,500/month**. Grok-4 Fast: **$450/month**.

On Grok-4.20, applying the same 80% cache-hit pattern from example 2 drops the bill to roughly $3,850 — a $1,150 saving. The data-sharing credit knocks another $150 off, landing at $3,700.

On Grok-4 Fast at $450/month, the $150 data-sharing credit covers 33% of the bill — paying $300 net for 1M calls is roughly $0.0003 per call. That is competitive with DeepSeek-V3 ($0.14/$0.28) once you factor in DeepSeek's lack of any free-credit program. The canonical lever order for scaling Grok cost down: (1) pick Grok-4 Fast for everything that doesn't require flagship reasoning, (2) structure prompts prefix-first to capture cache hits on Grok-4.20, (3) opt into data-sharing if your traffic qualifies, (4) cap output length — output is 2.5-3x input price across the family.


Worked example 4: a real production agent loop on Grok-4.20

An agent loop is the worst-case cost shape — the model takes multiple turns per user query, replaying the full transcript each turn. Take a typical 5-turn loop with a 2,000-token system prompt + tools, growing context 800 tokens per turn (because Grok's 2M context allows for much fatter intermediate state than smaller-context models):

Turn 1: 2,800 in / 200 out. Turn 2: 3,000 in / 200 out. Turn 3: 3,200 in / 200 out. Turn 4: 3,400 in / 200 out. Turn 5: 3,600 in / 200 out. Total: 16,000 input + 1,000 output. On Grok-4.20: 0.016 × $2.00 + 0.001 × $6.00 = $0.032 + $0.006 = **$0.038 per query** — about 7.6x a single call.

Now apply caching. The 2,000-token system + tools prefix is stable across all 5 turns. With 80% cache-hits on those 2,000 tokens × 5 turns = 8,000 cached input tokens dropping from $2.00/1M to $0.20/1M: $0.016 → $0.0016, saving $0.0144 per query (38% off the bill). For 100k queries/month: from $3,800 → $2,360. The same workload on Grok-4 Fast (no cache exposed but cheaper baseline) runs $0.0076 per query → $760/mo at the same volume. For agent workloads, Grok-4 Fast is usually the right answer unless you need the reasoning depth of 4.20.

The high-leverage move on Grok is the same as on every other LLM: cache structure beats model choice. A cache-anchored prompt on Grok-4.20 can land closer in cost to Grok-4 Fast than to standard-rate Grok-4.20.


The data-sharing free credit program — how to get $150/mo of Grok for free

xAI runs a developer program that returns up to **$150 per month in free API credits** in exchange for opting your API traffic into the training corpus. No other major LLM provider offers a free-credit program at this scale — OpenAI's free tier capped years ago, Anthropic has none, Google's Gemini credits are tied to GCP onboarding promotions, not ongoing developer rebates.

**The trade in plain English**: when you opt in, xAI is allowed to use your prompts and completions to train future versions of Grok. The data is de-identified at ingestion, but anyone with privacy-sensitive workloads (customer PII, regulated content, internal IP, anything under NDA, healthcare, legal documents, financial advice with personally identifiable parties) should not opt in. The credit is not worth the data leakage risk.

**Who should opt in**: indie devs, hobbyists, public-content workloads (summarizing news, analyzing public X posts, generating marketing copy, building demos), early-stage prototypes where you're still validating the product. Anyone whose prompts wouldn't bother you if they appeared verbatim in a future Grok response is a fit.

**Who should not opt in**: SaaS companies whose customer data flows through prompts, regulated industries (healthcare/finance/legal), B2B tools handling proprietary client information, anything where the prompt content has commercial value as confidential IP. The $150/mo is not worth the contractual or regulatory exposure.

**How to enroll**: opt in through the xAI console at x.ai/api under developer settings. The credit applies automatically to your billable usage; you don't get cash, you get up to $150 of API usage absorbed each month. Unused credit does not roll over. The exact terms (eligibility, data-handling, opt-out) are documented at x.ai/api — verify them before enrolling.


When Grok's real-time X access matters (and when it's irrelevant)

Grok is the only major LLM with native, real-time access to the X (Twitter) firehose. Every other provider that offers "web search" — OpenAI, Anthropic via web tools, Gemini, Perplexity — uses third-party search APIs that index X's public pages with significant lag (minutes to hours, sometimes more). Grok queries X's internal index directly, with sub-minute freshness on trending content.

**Use cases where this is genuinely worth paying Grok's premium over a cheaper model**: live sentiment analysis on breaking news (the Tesla earnings reaction within 10 minutes of the call ending), brand reputation monitoring during a crisis, real-time political event analysis, sports/entertainment commentary aggregation, monitoring developer sentiment on a product launch, tracking how a meme is spreading. Anything where "what is X saying about Y *right now*" is the question.

**Use cases where it's irrelevant**: code generation, document summarization, structured extraction, classification, customer support, embedded autocomplete, agent workflows that operate on internal data, RAG over your own corpus. For these, real-time X access is overhead you pay nothing extra for but get no value from — and Grok-4 Fast at $0.20/$0.50 is competitive on price alone, real-time bonus or not.

**The honest trade-off**: real-time X data is genuinely unique to Grok, but it's a narrow moat. If your product needs it, no other model substitutes. If your product doesn't need it, you're picking Grok on price/context-window, not the X integration. Be honest about which bucket you're in before architecting around it.

**Cost of search results**: when Grok retrieves X content into context, those tokens bill at the standard input rate. A search query that pulls 20 X posts averaging 500 tokens each = 10,000 input tokens added to the prompt. On Grok-4.20 that's $0.02 per search-augmented call on top of your base prompt. Plan for this in your token budget — search-augmented Grok calls are 5-10x the input volume of a vanilla call.


Grok-4 Fast vs GPT-5.4-mini vs DeepSeek-V3: the cheap-model showdown

Grok-4 Fast sits between OpenAI and DeepSeek on the cheap-tier curve. Side-by-side on standard rates (June 2026):

**Grok-4 Fast**: $0.20 input / $0.50 output, 2M context, real-time X access, $150/mo credit available. **GPT-5.4-mini**: $0.50 input / $1.50 output, 200K context, mature ecosystem, batch + cache discounts. **DeepSeek-V3**: $0.14 input / $0.28 output, 64K context, cheapest baseline, no free credits, China-based infra. See full breakdowns at GPT-5 cost and DeepSeek cost.

**On a 1,000-in / 500-out call**: Grok-4 Fast $0.00045, GPT-5.4-mini $0.00125, DeepSeek-V3 $0.00028. Per call, DeepSeek-V3 is cheapest. But: factor the data-sharing credit on Grok and Grok-4 Fast becomes effectively free for the first ~330k calls/month, beating DeepSeek for any workload under that threshold.

**Where each wins**: DeepSeek-V3 for raw price-per-token at scale where you don't qualify for Grok credits. GPT-5.4-mini for ecosystem maturity, tooling, batch API, and US-based inference (regulatory comfort). Grok-4 Fast for 2M context windows, real-time X access, or any workload eligible for the $150/mo data-sharing credit. The three are roughly substitutable on capability for most production classification/summarization/extraction tasks — pick on infra trust, context window, or unique data needs.


Grok the API vs X Premium+ the consumer subscription: don't confuse them

xAI runs two completely separate billing relationships, and they get conflated constantly. The **Grok API** (priced per-token in the table above, accessed via x.ai/api and docs.x.ai) is for developers building applications. The **X Premium+ consumer subscription** ($40/month on x.com/premium) is for end-users chatting with Grok in the X.com UI and also includes ad-free X, longer post limits, and other consumer features. Same model underneath; entirely distinct billing.

**What this means for builders**: a $40/mo X Premium+ subscription does **not** include API credit. If you're building on Grok-4.20, set up API billing independently at x.ai/api. Subscribing to X Premium+ does nothing for your API rate limits, quota, or bill.

**What it means for end-users**: an API key does not give you Premium+ features on x.com. If you want the consumer chat UI, ad-free feed, and longer posts, that's a separate $40/mo subscription. The two relationships use the same xAI/X identity but track usage, payment methods, and billing limits independently.

**Why this confusion is more common with Grok than with other providers**: because xAI and X share branding (same parent company), users assume one subscription buys both. It does not. The same architectural separation OpenAI has between ChatGPT subscriptions and the API applies here — same logo, different products, different bills.


Frequent mistakes that inflate the Grok bill

**Mistake 1: defaulting to Grok-4.20 for everything.** Most production traffic is classification, extraction, summarization — Grok-4 Fast handles these at 1/10th the price and the 2M context is the same. Test before you assume the flagship is necessary.

**Mistake 2: huge system prompts that never get cached on Grok-4.20.** If your system prompt interpolates anything that changes between calls (timestamps, user IDs, session state), the cache never hits. Restructure so the system prompt is static and the dynamic context lives in user messages.

**Mistake 3: not capping output.** Output is 2.5-3x input price across the Grok family. A 200-token answer that returns 1,200 tokens because you forgot to set max_tokens costs 6x. On Grok-4.20, that's $0.0072 per call vs $0.0012. Cap output length anywhere you control the consumption shape.

**Mistake 4: using real-time X-search when you don't need it.** Every search-augmented call adds 5,000-15,000 input tokens. If your task doesn't actually require live X data, disable the tool — you'll cut input volume by 5-10x on those calls.

**Mistake 5: stuffing the 2M context window because you can.** Grok's giant context is a feature, not a free resource. 1M input tokens on Grok-4.20 costs $2.00 per call. Use the context window for what it was designed for (long documents, fat agent state) — not as a substitute for retrieval or summarization.

**Mistake 6: not enrolling in data-sharing when your workload is eligible.** If your traffic genuinely qualifies (no PII, no proprietary client content), you're leaving up to $1,800/year on the table by not opting in.


Sourcing methodology and how to keep these numbers current

Every price in this guide comes from xAI's live model documentation at docs.x.ai/docs/models and the developer pricing page at x.ai/api, fetched on 2026-06-20 and verified against three independent corroborating sources (community pricing aggregators, recent integration commits in popular open-source projects referencing xai-sdk, and xAI's developer changelog). When a number could not be verified against the official page, it was omitted — we'd rather ship a guide missing a row than ship a guide with a fabricated number.

xAI updates pricing more aggressively than the older providers — Grok-4.20 saw a 30% price reduction in Q4 2025 and Grok-4 Fast launched at a price 60% below the initial Grok-4 release. Expect 4-6 pricing moves per year, almost all downward as the family matures. The biggest practical hazard: assuming a price you sourced in Q1 still holds in Q3.

**How to verify before you budget**: open docs.x.ai/docs/models in an incognito window, copy the numbers for your target models into a spreadsheet, and compare against this guide. If they match, this guide is current for your purposes. If they don't, trust the live page. Re-verify quarterly if your monthly Grok bill is over $500 — at that volume, a single price move materially shifts the budget.

**Why we omitted some rows**: cache-hit pricing for Grok-4.3 and Grok-4 Fast is not currently exposed on the verified live docs page, even though community forum posts sometimes cite specific cache rates. Rather than propagate possibly-stale numbers, we omit them here. We've also omitted enterprise/volume-discount tiers that are negotiated case-by-case and not publicly listed.

**Reproducible methodology**: every row in the table above has a citation; every worked example uses those rows; every FAQ answer reflects them. If you find a discrepancy with the live page, treat the live page as canonical — and tell us so we can re-fetch and update. The companion calculators (OpenAI, GPT-5, DeepSeek) were all built using the same curl-verify methodology on the same date.

How to estimate any Grok API call cost in 5 steps

  1. 1

    Estimate your input tokens

    Take your prompt's character count and divide by 4, or its word count and divide by 0.75. Rule of thumb: 1 token ≈ 4 characters ≈ 0.75 English words. A 500-word system prompt + 200-word user message ≈ 933 input tokens. If you're using real-time X-search, add 5,000-15,000 tokens for the retrieved content.

    → Open the Grok-tuned prompt generator
  2. 2

    Estimate your output tokens

    Estimate output the same way — words ÷ 0.75. Output usually drives cost because output prices are 2.5-3x input on every Grok-4 model. If you set a max_tokens cap, that is your worst-case ceiling. Use it to budget conservatively.

  3. 3

    Look up the input and output price per 1M

    From the table above (verified June 2026): Grok-4.20 $2.00 / $6.00, Grok-4.3 $1.25 / $2.50, Grok-4 Fast $0.20 / $0.50. Always check docs.x.ai/docs/models before shipping — Grok's prices move more often than OpenAI's or Anthropic's.

  4. 4

    Apply the cost formula

    cost = (input_tokens / 1,000,000) × input_price + (output_tokens / 1,000,000) × output_price. A 1,000-in / 500-out call on Grok-4 Fast = 0.001 × $0.20 + 0.0005 × $0.50 = $0.0002 + $0.00025 = $0.00045.

  5. 5

    Apply cache hits + the $150/mo data-sharing credit

    On Grok-4.20, cached input bills at $0.20/1M (90% off). On any model, opting into the data-sharing program returns up to $150/mo in free credits. Stack both: a cache-anchored, data-sharing-eligible Grok-4.20 workload can absorb the first ~75M cached input tokens per month at zero marginal cost.

Frequently Asked Questions

How much does Grok 4 cost per 1 million tokens in 2026?

As of June 2026, xAI's flagship Grok-4.20 charges $2.00 per 1M input tokens and $6.00 per 1M output tokens, with a 2M-token context window. Grok-4.3 is $1.25 / $2.50 with 1M context. Grok-4 Fast is $0.20 / $0.50 with 2M context. Grok-4.20 cache-hits drop input to $0.20/1M (90% off). Source: xAI's live model documentation at docs.x.ai/docs/models.

What's the difference between Grok 4 and Grok 4 Fast pricing?

Grok-4.20 costs $2.00 input / $6.00 output per 1M tokens. Grok-4 Fast costs $0.20 / $0.50 — exactly 10x cheaper on both input and output. Both have 2M context windows. The trade-off is reasoning depth: Grok-4.20 handles complex multi-step reasoning and synthesis materially better; Grok-4 Fast is optimized for classification, extraction, summarization, and simple Q&A where the cheaper tier holds up on a held-out eval.

Is Grok cheaper than GPT-5?

Depends on the tier. Grok-4 Fast ($0.20 / $0.50) is cheaper than GPT-5.4-mini ($0.50 / $1.50) at the cheap end. Grok-4.20 ($2.00 / $6.00) sits between GPT-5.4 ($2.50 / $15.00) and GPT-5.5 ($5.00 / $30.00) — cheaper than both on input, dramatically cheaper on output. Grok's tighter input-to-output ratio (3x vs OpenAI's 5-6x) makes it especially favorable for output-heavy workloads like long-form generation. Full breakdown at GPT-5 cost calculator.

Does Grok offer free API credits?

Yes. xAI runs a data-sharing program that returns up to $150 per month in free API credits in exchange for opting your prompts and completions into the training corpus. This is unique among major LLM providers — OpenAI, Anthropic, and Google do not offer ongoing developer rebates at this scale. The trade is data privacy: only opt in if your traffic contains no PII, no proprietary client content, and nothing under NDA. Enroll at x.ai/api.

How big is Grok's context window?

Grok-4.20 and Grok-4 Fast both support 2 million tokens of context. Grok-4.3 supports 1 million tokens. This is roughly 10x what OpenAI's GPT-5 family offers (200K) and 2x Anthropic's Claude (1M). The large context is genuinely useful for long-document analysis, fat agent state, and processing entire codebases in a single call — but remember that filling that context still bills at the standard input rate.

How does Grok-4 Fast compare to DeepSeek on price?

Grok-4 Fast is $0.20 input / $0.50 output. DeepSeek-V3 is $0.14 input / $0.28 output — about 30-45% cheaper per token. But Grok-4 Fast offers a 2M context window vs DeepSeek's 64K, includes real-time X-search access, and qualifies for the $150/mo data-sharing credit (DeepSeek has no free-credit program). For workloads under ~330k calls/month with the data-sharing credit applied, Grok-4 Fast is effectively cheaper. For pure US-based regulatory comfort, see DeepSeek cost for the full trade-off.

Does X Premium+ include Grok API access?

No. X Premium+ is a $40/month consumer subscription for chatting with Grok in the x.com UI plus ad-free X and longer posts. It does not include any API credit, raise your API rate limits, or affect your API bill. To build on Grok programmatically, set up API billing separately at x.ai/api. Same xAI/X identity, two distinct billing relationships — same architectural separation that OpenAI has between ChatGPT subscriptions and the API.

How does Grok cached-input pricing work?

On Grok-4.20, cached input tokens bill at $0.20/1M — a 90% discount versus the $2.00 standard rate. The cache is opportunistic and prefix-based: xAI fingerprints your prompt prefix and caches it server-side, so subsequent calls within the cache window that share the same prefix read from cache. Put stable system prompts and tool definitions first; put user-specific content last. Cache-hit pricing is currently not exposed on Grok-4.3 or Grok-4 Fast on the live docs page.

Grok is cheap. Bad prompts are not.

Whether you're on Grok-4 Fast or 4.20, a sloppy prompt wastes the context window. Our AI Prompt Generator writes Grok-tuned prompts that exploit the 2M context without bloating it. 14-day free trial, no card.

Browse all prompt tools →