How to Get a Grok API Key From xAI (Quick Setup Guide)
- Grok API keys are created in the xAI developer console at console.x.ai and are separate from an X (Twitter) Premium subscription.
- The xAI API is pay-per-token with prepaid credit or billing set up in the console, and the key is shown in full only at creation.
- An X Premium subscription gives Grok inside the X app only -- it does not include API access, and the API does not require Premium.
- The same key works in BYOK apps, so Grok can answer alongside GPT, Claude and Gemini in one chatroom at xAI's raw rates.
Grok is xAI's model family, and like the other major providers, it is available two very different ways: inside a consumer product (the X app, via X Premium) and directly by API. If you want Grok in your own tools — or side by side with other models — you want the API, and that means an xAI API key. Setup takes a few minutes.
Step 1: Create an xAI developer account
Go to console.x.ai — xAI's developer console. You create an xAI account there; it is a developer product, separate from your X (Twitter) account and from X Premium. An X Premium subscription neither includes nor is required for API access.
Step 2: Set up billing
The xAI API is pay-per-token. In the console's billing section, add a payment method or load prepaid credit. As with any provider, prepaid credit is the beginner-friendly option — it caps your worst case, full stop. If the console offers usage limits or alerts, set them; a few clicks now beats a surprise invoice later.
Step 3: Create the key
In the console, open the API keys section and create a new key. Name it for where it will live ("laptop-chat", "side-project"), copy it immediately — the full key is typically shown only once — and store it in a password manager. Lost keys are not recovered; they are replaced, which takes seconds.
Step 4: Use it
Three places the key works:
- Your own code. xAI's API is OpenAI-compatible in shape, which makes it easy to call from most existing SDKs and tools by switching the base URL and key.
- Developer tools that accept an xAI key for AI features.
- BYOK chat apps. Paste the key and get a chat interface with no code. In a multi-model room like ByteChat, Grok joins GPT, Claude, Gemini and others in a single conversation — ask once, and every model answers, billed at each provider's raw rates with keys kept in your browser.
Why run Grok next to other models?
Every model family has a personality, and Grok's is distinct — its answers often differ in tone and emphasis from GPT's or Claude's on the same prompt. That makes it genuinely useful in a comparison workflow: differences between models are information, and a model that disagrees differently is a better second opinion than a near-clone. The practical way to learn a new model's strengths is not benchmarks — it is watching it answer your questions next to models you already know.
API key vs X Premium: which do you need?
If you just want to chat with Grok casually and you already pay for X Premium, the app may be all you need. The API key earns its place when you want Grok inside other tools, want pay-per-token pricing instead of a subscription, or want Grok as one voice among several models rather than your only one.
Frequently asked questions
Where do I get a Grok API key?
In xAI's developer console at console.x.ai. Create an account, set up billing or prepaid credit, and create a key in the API keys section. It is separate from X Premium.
Does X Premium include Grok API access?
No. X Premium gives you Grok inside the X app. API access is a separate, pay-per-token product through the xAI console, and it works without any X Premium subscription.
Is the Grok API compatible with OpenAI-style tools?
Largely yes — xAI ships an OpenAI-compatible API shape, so most tools and SDKs that accept a custom base URL and key can call Grok with minimal changes.