All insights

Pricing and plans

Grok API Pricing: Grok 4.7 Rates and Cost Estimate

See xAI’s published Grok 4.7 text API rates per million tokens, how the 200K-token pricing threshold works, and a sample monthly cost calculation.

Illustration for Grok api pricing

For a focused example of xAI’s published direct API text pricing, Grok 4.7 costs $2 per million input tokens, $0.50 per million cached input tokens, and $6 per million output tokens below its long-context threshold. Once a prompt reaches 200,000 tokens, the listed long-context rates are $4, $1, and $12, respectively. These are API usage rates—not consumer Grok subscription prices. (xAI API pricing)

This is a Grok 4.7 pricing example, not a complete comparison of every Grok API model. The listed rates come from xAI’s pricing documentation; endpoint-specific applicability should be checked before budgeting. xAI says token usage on its US regional endpoint costs 10% more than on the global endpoint. (Regional Endpoints)

Grok 4.7 text API rates

Rates below are in USD per 1 million tokens. The model page lists a 500,000-token context window. The long-context threshold is different from the context-window limit: when the prompt reaches 200,000 tokens, long-context rates apply to all tokens in the request. (Grok 4.7 model documentation, xAI API pricing)

Model Context window Long-context threshold Short: input Short: cached input Short: output Long: input Long: cached input Long: output
grok-4.7 500,000 tokens 200,000 prompt tokens $2.00 $0.50 $6.00 $4.00 $1.00 $12.00

xAI’s model documentation recommends Grok 4.7 for code and other tasks. (Grok Models & Pricing)

Estimate a Grok API bill

For a request below the long-context threshold, estimate text cost as:

(uncached input tokens ÷ 1,000,000 × input rate) + (cached input tokens ÷ 1,000,000 × cached-input rate) + (billable output tokens ÷ 1,000,000 × output rate)

Count cached input separately from uncached input. If the prompt reaches the model’s long-context threshold, use the long-context rates for all tokens in that request. For output, include all billable completion tokens, including reasoning tokens billed as output.

Illustrative Grok 4.7 monthly workload: Assume 10 million uncached input tokens and 2 million total billable output tokens, all below the long-context threshold, with no cached input or server-side tool calls:

  • Input: 10 × $2.00 = $20
  • Output: 2 × $6.00 = $12
  • Estimated total: $32 for the month

This is an example, not a quote. Actual usage, caching, context length, endpoint, and tool use can change the bill. xAI says tool requests can incur both token-usage and tool-invocation charges, so a token-only estimate may omit invocation charges when tools are used. (Tools Overview)

For actual per-request costs, xAI documents a cost_in_usd_ticks field in the API response’s usage object. (Cost Tracking)

Endpoint and usage factors

  • Endpoint: xAI documents a 10% higher token-usage cost for its US regional endpoint than for its global endpoint. Check which endpoint applies to your deployment before using the example to forecast spend. (Regional Endpoints)
  • Cached input: The pricing table lists a separate cached-input rate. Use the cached-token quantity reported for your request rather than assuming repeated prompt text was billed at that rate. (xAI API pricing)
  • Tools: If a request uses xAI-provided tools, account for both token usage and tool invocations. (Tools Overview)

Is the $25 Grok API credit still available?

The $25 per month figure was a historical beta-credit promotion, not a current paid API rate. xAI announced it on November 4, 2024, for a public beta scheduled to run through the end of 2024. That announcement does not establish a current free-credit offer. (xAI’s API beta announcement)

For production budgeting, select the applicable model and endpoint, estimate uncached and cached input separately, include billable output and any tool-invocation charges, then compare the estimate with your actual per-request cost data after a pilot.

Sources

API Pricing — xAI Documentation

Grok 4.7 — xAI Documentation

Grok Models & Pricing — xAI Documentation

Regional Endpoints — xAI Documentation

Tools Overview — xAI Documentation

Cost Tracking — xAI Documentation

API Public Beta — xAI

Contact us