Short answer. xAI's API is prepaid and its pricing page lists no free tier. Grok 4.7 costs $2 input and $6 output per million tokens below 200K prompt tokens, doubling above that threshold. Grok 4.3 is $1.25 input and $2.50 output with a 1M context. The consumer Grok app has a free plan; the API does not.
Published Grok API prices
xAI's price sheet is simpler than its model names. The 4.7 family is the premium tier, 4.3 is the cheaper long-context option, and the 4.20 variants sit at the same price as 4.3. Cached input is a quarter of the fresh-input price on 4.7 and about a sixth on 4.3.
| Model | Context | Input / 1M | Cached / 1M | Output / 1M |
|---|---|---|---|---|
| grok-4.7 (<200K) | 500K | $2.00 | $0.50 | $6.00 |
| grok-4.7 (≥200K) | 500K | $4.00 | $1.00 | $12.00 |
| grok-4.3 (<200K) | 1M | $1.25 | $0.20 | $2.50 |
| grok-4.3 (≥200K) | 1M | $2.50 | $0.40 | $5.00 |
| grok-4.20-reasoning (<200K) | 1M | $1.25 | $0.20 | $2.50 |
Source: xAI models and pricing, checked 20 November 2026. Prices are per million tokens. Long-context rates apply to all tokens in a request once the prompt reaches the threshold.
Long context doubles the rate
The 200K threshold is not a surcharge on the excess. Once the prompt reaches 200K tokens, every token in that request is billed at the long-context rate. A 210K-token request therefore costs twice what a 199K-token request costs, even though the difference is only 11K tokens.
That makes chunking a financial decision, not just an engineering one. If your RAG pipeline stuffs a 300K-token context into every call, Grok 4.3 at $2.50 input is four times the price of the same model below 200K. Summarise, retrieve fewer chunks, or use a model with a larger threshold before assuming the 1M window is usable at the base rate.
No free API tier, and the free app is a different product
xAI's quickstart is explicit: create an account, then load it with credits to start using the API. The pricing page has no free-tier column, no trial credit and no monthly allowance. That is not a temporary state you can wait out; it is the billing model.
The Grok consumer app does have a free plan, and Grok Build has its own free tier for coding. Neither is API access. Grok Build's pricing note even says its free tier does not include Grok 4.7 Fast. Do not budget a product integration against a consumer plan's limits; they are separate products with separate terms.
One base URL to migrate
Grok exposes an OpenAI-compatible endpoint at https://api.x.ai/v1. The docs use the Responses API in their examples, but the OpenAI SDK path works for chat completions too. Keep the model ID in configuration so you can switch between 4.7, 4.3 and 4.20 without a deploy.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["XAI_API_KEY"],
base_url="https://api.x.ai/v1",
)
response = client.responses.create(
model="grok-4.7",
input="Explain the trade-off between latency and context length.",
)
print(response.output_text)
If you move to a flat-rate provider, the same code shape works with a different base URL and model ID. Plugsky's Grok migration guide lists the mapping, and the model catalogue shows which models are available on each plan.
Six alternatives when credits run out
- Plugsky free — 100 requests and 50K tokens per day, OpenAI-compatible, with flat plans from $8 per month for 2M tokens per day.
- Gemini free tier — free of charge for Gemini 4 Hydrogen and 3.8 Flash, with per-project limits in AI Studio; free-tier content is used to improve Google's products.
- Groq free — 30 RPM, 1,000 requests per day, 8K TPM and 200K TPD; the best fit for low-latency chat rather than long documents.
- Cerebras trial — $5 in credits for 30 days, with very fast inference and a 5 RPM trial cap on the flagship model.
- DeepSeek — $0.15 input and $0.60 output per million tokens off-peak on Flash, with a 1M context and no free tier.
- Kimi K3.1 Pro — $2 input and $10 output per million tokens, 1M context, and a China-only free voucher.
If your workload is mostly input-heavy — long documents, code review, RAG — Grok's cached-input discount is worth testing before you leave. If it is mostly output-heavy chat, a flat daily token plan is usually easier to forecast. Compare both on the pricing page.
FAQ
Does xAI have a free Grok API tier?
No. The xAI quickstart says to create an account and load it with credits before using the API, and the pricing page lists no free tier. The consumer Grok app has a free plan, but that is a separate product from the API.
How much is Grok 4.7 per million tokens?
Below 200K prompt tokens, grok-4.7 is $2.00 input, $0.50 cached input and $6.00 output per million tokens. At or above 200K prompt tokens, the rates double to $4.00, $1.00 and $12.00.
Does Grok 4.7 have a 1M context window?
No. Grok 4.7 lists a 500K context window. Grok 4.3 and the Grok 4.20 variants list 1M.
Can I use the OpenAI SDK with xAI?
Yes for the compatible endpoints. Set base_url to https://api.x.ai/v1 and use a Grok model ID. xAI's own examples use either the OpenAI SDK or its xAI SDK, and the Responses API is the primary path in the docs.
What is the best free alternative to Grok?
For a standing free tier, Gemini's Flash models or Groq's free plan are the closest. Plugsky's free plan adds an OpenAI-compatible endpoint and 50,000 tokens per day for new accounts.
Sources
Primary sources for the figures on this page:
- xAI models and pricing — checked 20 November 2026
- xAI quickstart — checked 20 November 2026
Sources checked 20 November 2026. Prices and limits are the published figures on that date and can change; confirm them in the provider console before capacity planning. Reviewed 20 November 2026.