Quick Answer: What Free Credits Does xAI Actually Give You?
xAI gives every new account $25 in promotional API credits on signup at console.x.ai. No X Premium subscription is required — the API uses a separate xAI account. A second program offers $150/month in additional credits if you opt your team into data sharing, but that requires a minimum of $5 in prior API spend before you can enroll. The $25 starter credits expire 30 days after account creation and do not carry over.
Bottom line: the first $25 is genuinely free and requires no payment method. The $150/month data-sharing program is available but gated behind a small real spend. Together, they can cover serious prototyping and testing before you commit to a billing plan.
Do You Need X Premium to Use the Grok API?
No. This is the most common misconception about Grok access. X Premium ($8/month) and X Premium+ ($16/month) bundle Grok access into the X social platform — useful for chatting via grok.com or the X app, but entirely separate from the developer API. The Grok API at console.x.ai uses an independent xAI account and charges on a pay-as-you-go basis. You do not need a checkmark, an X subscription, or any social media account to call the API and build with Grok models.
Step-by-Step: How to Get Your Grok API Key
Step 1 — Create an xAI Account
Go to console.x.ai and click Sign Up. You can register with an email address or sign in with an existing X account. If you sign in with X, your social account and your API account remain separate billing entities — your X subscription does not affect API credits or vice versa.
Step 2 — Complete Developer Onboarding
On first login, xAI walks you through a brief setup: your intended use case, your team name, and acceptance of the API terms of service. This takes under two minutes. Your $25 promotional credits are applied automatically once onboarding is complete.
Step 3 — Navigate to API Keys
In the left sidebar of the console, click API Keys (sometimes labelled Manage API Keys depending on your account view). This is where all keys for your team are created and revoked.
Step 4 — Create Your Key
Click Create API Key. Give it a descriptive name — for example, "dev-test-key" or "production-app". Select the model permissions you need (you can leave this open for full access during testing). Click Create. Your key is displayed exactly once, prefixed with xai-. Copy it immediately and store it in a password manager or your environment variables. It cannot be retrieved again after you close the modal.
Step 5 — Make Your First Call
The Grok API base URL is https://api.x.ai/v1. It is fully compatible with the OpenAI SDK — you only need to change the base URL and swap in your xAI key. Here is a minimal working example in Python:
from openai import OpenAI
client = OpenAI(
api_key="xai-your-key-here",
base_url="https://api.x.ai/v1"
)
response = client.chat.completions.create(
model="grok-4.1-fast",
messages=[{"role": "user", "content": "Hello, Grok!"}]
)
print(response.choices[0].message.content)
No additional packages are required beyond the standard openai Python library. The same pattern works in Node.js using the openai npm package.
How Much Can You Build with $25 in Free Credits?
The $25 goes further than most developers expect because Grok 4.1 Fast is priced at $0.20 per million input tokens and $0.50 per million output tokens — among the cheapest rates of any frontier-class model available today. At those rates, $25 buys approximately 50 million input tokens on Grok 4.1 Fast. For a typical agentic coding session consuming around 10,000 tokens, that covers roughly 5,000 sessions. For a conversational chatbot sending short 200-token exchanges, it covers hundreds of thousands of queries.
Grok 4 (the full flagship) is priced at $3.00 per million input tokens and $15.00 per million output tokens, so $25 goes significantly less far if you are testing the highest-capability tier. For most prototyping, defaulting to Grok 4.1 Fast makes sense — it scores near-identically to Grok 4 on most coding and reasoning benchmarks while costing 15× less per token.
The one cost to watch: server-side tools are billed separately. Web search, X search, and code execution each cost $5 per 1,000 invocations. If your app calls web search frequently, those charges add up faster than token costs. Function calling with your own custom tools has no per-invocation fee — only token costs apply.
The Data-Sharing Program: How to Unlock $150/Month More
After spending your first $5 on the API, your team becomes eligible to enroll in xAI's data-sharing program. Opting in allows xAI to use your API request data for model training in exchange for $150/month in recurring credits. Credits appear within 24 hours of enrollment and refresh monthly. They do not carry over — unused credits reset each cycle.
Important details: only the team admin can enable data sharing, the setting is team-level (not per-user), and once a team opts in it cannot opt back out. The credit applies to eligible countries — check the xAI console for your region's status. This program is best suited for development teams running non-sensitive workloads who are comfortable with xAI using request data for training. For applications handling private or proprietary information, skip this program and use standard pay-as-you-go billing.
Grok Model Lineup: Which One to Use
xAI currently offers four main model tiers through the API. Grok 4.20 is the newest flagship model, featuring a 2 million token context window, agentic tool calling, the lowest hallucination rate xAI claims to date, and full reasoning capabilities. Grok 4.1 Fast sits below it at $0.20/$0.50 per million tokens with the same 2 million token context window — the recommended default for most development use cases given its cost-to-capability ratio. Grok 4.1 Fast is also available in a non-reasoning variant for latency-sensitive applications where you want the fastest possible response time. Grok 4 at $3/$15 per million tokens is the higher-accuracy option for complex multi-step tasks where accuracy matters more than cost.
All models share full compatibility with the OpenAI SDK, support function calling and structured JSON outputs, and include prompt caching by default — repeated identical prompt prefixes benefit from 50–75% token cost reductions without any configuration on your end.
Best Free Alternatives if You Need Unlimited Access
If $25 is not enough and you need genuinely unlimited free API access, three options are worth considering in 2026. Google AI Studio offers free access to Gemini 2.5 Pro and Gemini 2.5 Flash with no credit card required — it is the single most generous free AI API currently available by total token volume, though rate limits are strict. GitHub Models gives free playground and API access to GPT-4o, Grok 3, DeepSeek R1, and others for developers already in the GitHub ecosystem, capped at 10–15 requests per minute and 50–150 per day depending on model tier. NVIDIA NIM provides 1,000 free credits on signup with an option to request 4,000 more, focused on open-source models like Llama and Mistral rather than Grok.
For Grok specifically, there is no permanently free unlimited API option outside the credit programs above. Avoid sites promising "free unlimited Grok API keys" — these are either scams collecting your credentials or proxies that violate xAI's terms of service and risk account bans.
FAQ
Do I need X Premium to use the Grok API?
No. The Grok API at console.x.ai is a completely separate product from X Premium. You only need a free xAI account. X Premium and X Premium+ bundle Grok chat access within the X social platform — useful for using Grok.com or the X app, but unrelated to API keys and billing.
Do the $25 free credits expire?
Yes. Promotional credits expire 30 days after account creation. They do not carry over to the next month. Add a payment method before they expire if you want uninterrupted API access.
What is the cheapest Grok model to call?
Grok 4.1 Fast (non-reasoning variant) is the cheapest option at $0.20 per million input tokens and $0.50 per million output tokens. It supports a 2 million token context window. For most testing and prototyping, it is the right default choice.
What does the data-sharing program require?
Your team must have spent a minimum of $5 on API usage before enrolling. Only team admins can enable it. Once opted in, the team cannot opt out. It provides $150/month in recurring credits in exchange for xAI using your API request data for model training.
Is the Grok API compatible with the OpenAI SDK?
Yes. The Grok API uses the same request and response format as OpenAI's Chat Completions API. You only need to change two things: the base URL to https://api.x.ai/v1 and the api_key to your xAI key. No code restructuring is required beyond those two parameters.
What are the server-side tool costs I should know about?
Web search, X search, code execution, and file attachment search are charged per invocation on top of token costs. Web search and X search cost $5 per 1,000 calls. Code execution costs $5 per 1,000 calls. Collections search (RAG) costs $2.50 per 1,000 calls. Custom function calling with your own tools has no per-invocation fee — only the tokens used in the model's decision to call the function are billed.
PICKING A CODING TOOL?
We scored the main options on 34 criteria, including the ones that actually decide it — repository context, review workflow, and what the usable tier really costs.
See the AI coding tools buyer's guide →
The Four Questions People Actually Ask
SHORT ANSWERS
● Credit card for sign-up? No. The $25 promotional credit needs no card.
● Credit card for the monthly credits? Not a card — but you need at least $5 of prior API spend before data sharing can be switched on.
● Who can enable it? Only a team admin, from the Credits section of the billing console.
● The catch: data sharing is irrevocable. Every prompt and response becomes training data.
Do I need a credit card for xAI API free credits?
Not for the sign-up credit. xAI states you can create an account and use the $25 promotional credit without adding a card. It expires after 30 days.
The monthly data-sharing credits are different. There is a $5 minimum prior API spend before the programme can be enabled — a gate that exists specifically to filter automated sign-ups. xAI says promotional credits count toward that $5, so in practice you can reach the threshold using the sign-up credit rather than your own money.
One structural detail that catches teams out: only a team admin can enable data sharing, from the Credits section of the billing console. If you are on someone else's team and the toggle is not there, that is why.
How do the top-up bonus credits work?
Separate from the sign-up promotion. The recurring monthly allocation runs through the data-sharing programme rather than a top-up bonus, and it is enabled under Settings, Data Sharing, by turning on sharing of API inputs for model training.
What that allocation is worth depends entirely on which model you point it at. xAI's own rough estimates:
| Model class |
Roughly what the monthly credit covers |
| Fast tier |
Hundreds of millions of input tokens |
| Mini tier |
Over a billion input tokens |
| Flagship tier |
Tens of millions of input tokens |
Those are input-token figures. Output tokens cost more and will move the real number substantially.
THE LINE ITEM THAT DRAINS CREDITS FASTEST
Tool calls are billed separately, per thousand calls — Web Search, X Search, Code Execution. They sit on top of token costs and are not covered by your token maths.
An agent making a search call every step will burn through a monthly allocation far faster than the token estimate suggests.
Can I earn free credits by spending on the X API?
There is no published programme converting X API spend into xAI API credits. The two are billed separately and the credit routes are the sign-up promotion and the data-sharing allocation.
If you have seen this claimed, it is likely a confusion with the $5 prior-spend requirement for enabling data sharing — that is xAI API spend, not X API spend.
Are the Reddit posts about xAI free credits still accurate?
Treat them as historical. Reports through 2026 have gone both ways, including claims the programme ended and separate reports of it running at a higher allocation. Eligibility, ceilings and the activation flow have all shifted more than once.
The only reliable source is your own console. If the offer does not appear in your billing and credits section today, it does not apply to your account, whatever a forum thread from three months ago says. Verify there, run a small test call, and set a spending alert before building anything against it.
Should I turn data sharing on?
It depends entirely on what goes through the API, and this is the part worth reading twice.
Once enabled, every prompt and every response your team sends becomes training data for future models, and xAI describes this as irrevocable. The company explicitly states it is not suitable for proprietary code, confidential business data, or personal information.
| If you are... |
Verdict |
| Building a side project or prototype |
Enable it. The trade is fine for non-sensitive work |
| Handling customer data anywhere near the prompt |
Do not. It is disqualifying, not a judgement call |
| Under a client confidentiality obligation |
Do not. Check your contract before you even consider it |
| Running two workloads, one sensitive |
Separate accounts. The setting is team-wide, not per-key |
What should I use as a fallback?
Keep a second provider configured before you depend on any free allocation. Credit programmes change without notice — this one has already changed more than once in a year.
Because xAI exposes an OpenAI-compatible endpoint, switching is mostly base URL, key and model name. Keep all three configurable rather than hardcoded, and the fallback becomes a config change rather than a rewrite.