The short answer
If by Grok 4 you mean the original xAI API model, its model ID was grok-4-0709. xAI says it was retired on May 15, 2026, and requests to that ID redirect to Grok 4.3. The redirected requests use Grok 4.3’s rates: $1.25 per million input tokens and $2.50 per million output tokens at standard short-context rates. The rate changes when long-context pricing applies. (docs.x.ai)
For new API work, xAI lists Grok 4.7 at $2 per million uncached input tokens, $0.50 per million cached input tokens, and $6 per million output tokens at standard rates. These are API token prices—not a monthly X Subscription price. (docs.x.ai)
Current xAI API rates to compare
| API model | Input per 1M tokens | Cached input per 1M tokens | Output per 1M tokens | Context window |
|---|---|---|---|---|
| Grok 4.7 | $2.00 | $0.50 | $6.00 | 500K tokens |
| Grok 4.3 | $1.25 | $0.20 | $2.50 | 1M tokens |
For prompts in the long-context tier, xAI lists higher rates: Grok 4.7 is $4.00 input, $1.00 cached input, and $12.00 output per million tokens; Grok 4.3 is $2.50 input, $0.40 cached input, and $5.00 output. xAI’s pricing table labels the tier “≥ 200k tokens” and says all tokens in the request use the long-context rates once the threshold applies. Its prompt-caching guidance describes the threshold as when total prompt tokens, including cached tokens, exceed the model threshold. Since those descriptions differ at exactly 200,000 tokens, check the applicable rate for a request at that exact boundary. (docs.x.ai)
How to estimate a request
Separate total input tokens into two non-overlapping groups: cached input tokens and uncached input tokens. Uncached input equals total input minus cached input. Do not charge cached tokens again at the standard input rate.
For a request below the long-context threshold, use:
((total input − cached input) × standard input rate + cached input × cached-input rate + output × output rate) ÷ 1,000,000
For example, assume a Grok 4.7 request has 100,000 total input tokens, of which 60,000 are cached, plus 2,000 output tokens:
- Uncached input: 100,000 − 60,000 = 40,000 tokens
- Uncached input cost: 40,000 × $2 ÷ 1,000,000 = $0.080
- Cached input cost: 60,000 × $0.50 ÷ 1,000,000 = $0.030
- Output cost: 2,000 × $6 ÷ 1,000,000 = $0.012
- Estimated token cost: $0.122
If long-context pricing applies, use the model’s long-context input, cached-input, and output rates in place of the standard rates. For a monthly estimate, multiply per-request costs by expected request volume and use your real token counts and cache-hit share. (docs.x.ai)
Add tool costs separately
Tool-enabled requests can incur both token charges and separate server-side tool charges. xAI’s tool-usage documentation says successful tool executions determine billing for per-call tools; attempted calls that fail are not counted as successful usage. (docs.x.ai)
As a budget example, the supplied pricing article reports Web Search at $5 per 1,000 calls. At that reported rate, 200 billable calls would add $1 to the token estimate. Treat the rate as reported pricing, and confirm the current applicable charge in xAI’s pricing documentation before using it as a production quote. Tool usage depends on how many successful invocations a request triggers. (docs.x.ai)
Which model makes sense for production?
- Consider Grok 4.3 when its listed lower standard token rates or 1M-token context window fit your workload.
- Consider Grok 4.7 when you want to evaluate xAI’s current flagship; its listed context window is 500K tokens.
- Test before routing production traffic. Compare the models on representative prompts and measure output quality, latency, token consumption, tool behavior, and total cost. A lower per-token rate alone does not show which model will cost less for your workload.
- Audit legacy model strings. The retired
grok-4-0709ID continues to resolve to Grok 4.3. Update it deliberately if you want explicit model selection and predictable configuration. (docs.x.ai)
Don’t confuse API rates with X Subscription prices
xAI lists monthly X Subscription plans separately from API token rates. A monthly subscription price is not an API usage allowance or a per-token rate; budget API traffic using the rates for the specific API model and any applicable long-context or tool charges. (docs.x.ai)
