How to get an xAI API key for Grok, from the SpaceXAI Console
Under ten minutes. Make a SpaceXAI Console account (xAI's developer site, renamed after SpaceX bought xAI), buy $5 of prepaid credit, and copy the key the Console hands you. There's no free tier, but $5 runs about a thousand everyday Grok answers. You pay xAI directly at their prices. PolyCog adds nothing.
The short version: console.x.ai, Create an account (Google, X, Apple, GitHub, or email + a 6-digit code), name the team, choose Explore ($5; Prototype at $20 is pre-picked), switch off auto top-up (on by default: +$5 whenever the balance drops below $5, no monthly maximum), pay by card or Cash App Pay, copy the xai- key the welcome flow shows once (listed as Default API Key), paste, test. Later: Settings › Billing shows the balance and whether auto top-up is on.
Never made an API key? Stay here. Every click is spelled out.Condensed steps, direct links, scopes and tier details.
What you need
An email address, or a Google, X, Apple or GitHub account
A card (Visa, Mastercard, Amex, Discover) or Cash App Pay; the smallest purchase is $5
A free PolyCog account to save the key in
Under ten minutes
Auto top-up is on unless you switch it off
xAI's checkout turns on auto top-up for you: whenever your balance drops below $5, it charges your card another $5, with no monthly maximum unless you set one. Step 2 shows where to switch it off, so what you buy is the most PolyCog can ever spend. xAI credit can't be refunded, so start small.
The steps
Tick each circle as you finish a step. Your ticks stay in this browser, so you can close the tab and pick up where you left off.
Make a SpaceXAI Console account
2 min
Go to console.x.ai and choose Create an account. The quickest way in is Continue with Google (or X, Apple, GitHub). To use an email address instead, type it and choose Continue with email: xAI emails you a 6-digit code, so type it in and choose Confirm. Then fill in your name and a password and choose Create account. Last comes Create your team: your team name is already filled in, so just choose Continue.
Email
yours, then Continue with email (or a Google, X, Apple or GitHub button)
Verify your email
the 6 digits from "SpaceXAI confirmation code" (check Spam)
First name, Last name, Password
yours
Team name
keep the one filled in (it's only a label)
Illustrationconsole.x.ai (simplified)
SpaceXAIConsoleConsoleThe SpaceXAI Console is your gateway to the Grok API and developer tools for building with AI.Sign in →Create an accountWhat you can doManage API keysCreate, rotate, and revoke keys.→Manage your teamInvite members and set roles.→Centralized billingUsage, credits, and invoices.→
SpaceXAIConsoleCreate your API accountGet started with the API and developer tools.G Continue with GoogleX Continue with XContinue with AppleContinue with GitHubEnter your emailContinue with emailAlready have an account? Sign inBy continuing, you agree to xAI's Terms of Service and Privacy Policy. A division of SpaceX
SpaceXAIConsoleVerify your emailEnter code sent to [email protected]. It should arrive within a few minutes.-Didn't receive a code? Resend (29)ConfirmBackBy continuing, you agree to xAI's Terms of Service and Privacy Policy.
SpaceXAIConsoleCreate your API accountGet started with the API and developer tools.First nameLast namePassword✓Receive email updates on new features and offers✓Verifying…Human checkCreate accountBack
SpaceXAIConsoleARCreate your teamGive your team a name to get started.Team nameAlex's teamWhat best describes you?HobbyistStudentEngineerBusinessOtherContinue
SpamUpdatesSpaceXAI confirmation code: 123-456SpaceXAI <[email protected]> · Validate your email
1/7Choose Create an account
The code email comes from SpaceXAI <[email protected]> with the subject "SpaceXAI confirmation code: 123-456". In our test Gmail put it in Spam. You can ask for another after 30 seconds.
Create account stays grey until a quick automatic check under the password says Success!
"Receive email updates on new features and offers" is ticked for you. Untick it if you'd rather not get them.
SpaceXAI is xAI's new name: SpaceX bought xAI in 2026. Grok, x.ai and the API kept their names, so anything written about xAI keys still applies.
A team is what holds your credit and your keys. The name is only a label, and "What best describes you?" is optional.
console.x.ai › Create an account (/login?mode=sign-up): Google, X, Apple, GitHub, or email › a 6-digit code (123-456 form, "SpaceXAI confirmation code" from [email protected], resend after 30 s) › first and last name, password, a pre-ticked marketing opt-in, a Cloudflare check › /welcome: Create your team (name pre-filled "<first name>'s team", optional "What best describes you?").
Next comes Choose your plan. The cards only set how much credit you buy first; every one opens every model. Prototype ($20) is picked for you: choose Explore instead, and the amount changes to $5, the minimum. Below that, Auto top-up is already on. Choose Edit, then switch Auto top-up off. Then choose Checkout. Don't choose Skip: that leaves you with no credit, and a team with no credit can't make a key.
Illustrationconsole.x.ai/welcome › Choose your plan (simplified)
SpaceXAIConsoleARChoose your planUsage credits let you call the Grok API. Start building with as little as $5.From $5ExploreTry Grok in playgroundsFull access to all modelsFrom $20PrototypeBuild a prototypeHigher limitsPopularFrom $100BuildShip your productRun more tests and evals$ 20Auto top-up when balance is below $5EditAuto top-upWhen credit balance drops below$ 5Top up amount$ 5Maximum monthly top-up amountSkipCheckout
1/6Prototype, $20, is picked for you
Explore already has "Full access to all models". The bigger plans are only bigger first purchases; xAI raises rate limits as your total spend grows, and PolyCog doesn't need more.
With auto top-up off, requests stop when the balance reaches $0.00 and you add more yourself. Nothing is charged without you.
Changed your mind later? ⚙ Settings › Billing shows it (step 7).
/welcome › Choose your plan: Explore (from $5, "Full access to all models"), Prototype (from $20, pre-selected, "Popular"), Build (from $100). The cards only set the first purchase; the amount field is free-form, minimum $5. Rate limits grow with total spend (Tier 1 at $50 since Jan 1, 2026), not with the card you pick.
Auto top-up is on by default: below $5, buy $5; "Maximum monthly top-up amount" off (placeholder $50). The saved card pays for it. The invoiced billing limit defaults to $0, so with auto top-up off the prepaid balance is a hard stop.
After sign-up: ⚙ Settings › Billing › Credits shows "Auto top-up is disabled / enabled", with Enable auto top-up (its box pre-fills a $25 top-up, not $5) and Add credits (which carries its own auto top-up row). Skip leaves the team at $0, and a team with no credit can't create keys ("Add credits to create your API key").
Pay for your first credits
Required2 min
Purchase your first credits opens with Card picked (or choose Cash App Pay). Type the card number, expiry, security code and ZIP code, then choose Pay $5. When it says Payment successful, stay there: the next step starts with the button on that screen.
Illustrationconsole.x.ai/welcome › Purchase your first credits (simplified)
SpaceXAIConsoleAR←Purchase your first credits▭Card$Cash App PayCard number1234 1234 1234 1234VISA · MC · AMEX · DISCMM / YYCVCUnited States ⌄12345By providing your card information, you allow Grok xAI to charge your card for future payments in accordance with their terms.Pay $5
SpaceXAIConsoleAR✓Payment successfulYour credit balance will be updated once we finish processing the payment.How was the experience?👍 👎Get API key
1/4Card is picked
No tax line in our US test: $5 cost $5.
The card is saved ("you allow Grok xAI to charge your card for future payments"). That's the card auto top-up would charge.
"Your credit balance will be updated once we finish processing the payment." Ours showed $5.00 on the Dashboard right away.
Card declined? Try Cash App Pay, or another card.
Checkout › Purchase your first credits: Card (Visa, Mastercard, Amex, Discover; country + ZIP) or Cash App Pay › Pay $N › Payment successful › Get API key. No tax shown in the US. xAI's billing docs also list bank transfer (2 to 3 business days) and a guest checkout for India.
Credit belongs to the team; deleting a team deletes its credit. xAI's FAQ: "xAI API credits are non-refundable."
Copy your API key
1 min
On Payment successful, choose Get API key. xAI has already made a key for you: "All set, here is your API key". Choose Copy API keybefore you choose Get started, because xAI says it "won't be displayed again". Get started takes you to the Dashboard, where your credit shows. On the API Keys page this key is called Default API Key.
Illustrationconsole.x.ai/welcome (simplified)
SpaceXAIConsoleAR✓Payment successfulYour credit balance will be updated once we finish processing the payment.How was the experience?👍 👎Get API key
SpaceXAIConsoleARAll set, here is your API keyMake sure to copy it before proceeding as it won't be displayed again.API keyxai-EXAMPLEa1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8⧉Instructions ⌄Copy API keyGet started
Welcome, Alex+ Create API key$Credit balance $5.00Available for the API.Add creditsStart using the API keyCopy the key as you won't see this againReady to usexai-EXAMPLEa1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8⧉CodeChatImageVideoVoice
1/4Choose Get API key
You only see it onceThe key starts with xai-. Paste it straight into PolyCog (next step) or somewhere safe. Lost it? Choose + Create API key on the Dashboard and make another. Anyone with the key can spend your credit.
The welcome flow makes a key right after payment: Payment successful › Get API key › "All set, here is your API key" (xai-…), Instructions (export XAI_API_KEY / .env), Copy API key, Get started. API Keys lists it as Default API Key. For another key: Dashboard › + Create API key (or API Keys › Create API key) › Name (up to 127 characters) › Create API key. A team with no credit can't create keys.
API Keys columns: Name, Key (xai-… last four), Spend (30d), Last used, Owner. Row ⋯: Copy key ID, View logs, View usage, Edit key, Disable key, Rotate key, Delete key. Edit key › Advanced settings: Models (All models, or pick from Chat / Image / Video), Endpoints (All endpoints, or pick), Tokens per minute, Requests per minute (No limit), Expiry (No expiry; 1 / 5 / 30 / 90 days or a date). No per-key dollar cap. Leave them at All / No limit for PolyCog.
Keys belong to the team. xAI is in GitHub's Secret Scanning program: a key found in public code is disabled and you get an email.
Sign in to PolyCog (a free account is enough), open your profile and choose the Keys tab. Paste into Grok API key and choose Save keys. The button below opens it right here, over this page.
Illustrationpolycog.io › Profile › Keys
ProfileChatsMemorySettingsSavingsKeys
Keys are stored in this browser. Turn on sync to keep them (encrypted) with your account.DeepSeek API keyONsk-…Grok API keyONHow to get one →xai-…Save keys
Keys saved
1/2Paste into Grok API key
Keys stay in the browser you saved them in. If you switch on key sync, they're encrypted and stored with your account so your other devices get them too.
Profile › Keys › Grok API key › Save keys. Per-key on/off switch. Sync is optional (AES-256 at rest).
Pick Grok 4.3 in the Grok column and ask something short. An answer means the key and the credit both work. Then try Grok 4.7, xAI's newest, and once with the 🔍 web search button on (each search adds half a cent). Got an error? Find its wording under Troubleshooting.
Test on grok-4.3, then grok-4.7. Without search PolyCog calls api.x.ai/v1/chat/completions; with search on, /v1/responses with the web_search tool ($5 per 1,000 calls). A team with Zero Data Retention on loses the Responses API, and with it Grok's search in PolyCog. Error text maps to Troubleshooting.
Check your Billing page
Recommended1 min
Back on the Dashboard, the gear ⚙ at the bottom left (its label is Settings) opens straight onto Billing. The Credits box shows your balance and, under it, "Auto top-up is disabled": your balance is the limit. Below that are the card xAI saved and your invoices.
BillingSpend managementRedeem promo codeView usageCreditsYour total credit balance, including free credits granted to your account.Enable auto top-upAdd credits$5.00Auto top-up is disabled - you will lose access to the API when credits run outPayment detailsCardExpiryVISA •••• 4242Default12/2030InvoicesInvoice ReferenceTypeAmountStatusEXAM-PLE1-2345Single Purchase$5.00Paid
1/5The gear at the bottom left is Settings
Don't confuse Management Keys (same menu) with API keys. They can't run Grok.
Choosing Enable auto top-up here pre-fills a $25 top-up, more than checkout's $5. Check the numbers if you ever turn it on.
More credit later: Add credits here or on the Dashboard ($5, $10, $20 or a custom amount). Its "Auto top-up" row comes back each time.
⚙ Settings (bottom left) › Billing: Spend management (Redeem promo code, View usage) › Credits ("Your total credit balance, including free credits granted to your account.") with Enable auto top-up / Add credits and the state line ("Auto top-up is disabled - you will lose access to the API when credits run out") › Payment details (billing email, cards, Default) › Invoices (Single Purchase, Paid).
Enable auto top-up: "When your balance hits $0, API requests will be rejected. Auto top-up keeps API requests running." Drops below $5, Top up amount $25, Maximum monthly top-up amount off. Add credits: $5 (Recommended) / $10 / $20 / Custom, xAI's own usage estimate, the saved card, and an "Auto top-up when balance is below $5 · Edit" row.
No data-sharing or free-credit option on Billing (Sep 26, 2026). Management Keys are for xAI's Management API and can't call Grok. General holds the Zero Data Retention switch and Delete team.
You're set up.
Your xAI key is in PolyCog. One provider gives you one opinion; add a second and the bots have someone to argue with.
Rough numbers for one answer (about 1,100 words of question and context in, 750 words out). A debate round costs a little more than a first answer, since each model reads the others.
Model
Price per 1M tokensin / out
One answer
Answers per $5
Grok 4.3cheapest, everyday, 1M-token context
$1.25 / $2.50
≈ $0.0044
≈ 1,100
Grok 4.7newest, deep work
$2.00 / $6.00
≈ $0.0090
≈ 560
Web search adds xAI's $0.005 per search. Grok can think before it answers and bills the thinking as output, so a hard question can cost a few times more. The other Grok models in PolyCog cost the same as the pricier one here. Prompts over 200K tokens cost double, and repeated context bills at a quarter of the input price or less. Prices from /pricing/, verified Sep 23, 2026. Assumes 1,500 tokens in and 1,000 out per answer.
Troubleshooting
Find the words from the error in PolyCog's Grok column.
…has either used all available credits or reached its monthly spending limit403 or 429 · PolyCog shows "Out of API credit"
The team's balance is $0.00. Choose Add credits on the Dashboard or on Settings › Billing: $5 is picked and the saved card is filled in. That box has its own Auto top-up row, so check it before you pay.
"Your newly created team doesn't have any credits" means the same thing on a team that never had any. Each team has its own credit and its own keys: check the team name at the top left matches the one you paid for.
Raised the invoiced billing limit? The "monthly spending limit" in the message is that limit. Raise it, or add credit.
Incorrect API key provided. You can obtain an API key from https://console.x.ai.400 · invalid-argument · PolyCog shows "Invalid API key"
xAI doesn't recognise the key PolyCog sent: a character went missing when you copied it, or the key was deleted. xAI shows a key only once, so make a new one (+ Create API key on the Dashboard), paste that, and delete the old one on API Keys.
Your API key or team is blocked403 · a disabled, expired or restricted key
On API Keys, open the key's ⋯ menu. If it offers to enable the key, it was switched off, by you or by xAI after finding it in public code (xAI emails you when that happens). Delete a leaked key and make a new one.
Otherwise choose Edit key and open Advanced settings. Models should say All models, Endpoints All endpoints, and Expiry No expiry (or a date that hasn't passed). Fix them and choose Update API key.
Too many requests429 · a rate limit
xAI limits requests per second and tokens per minute for each model, and raises the limits as your total spend grows ($50 for Tier 1). The Models page in the Console shows yours. PolyCog stays far below them, so wait a minute and try again. A 429 that mentions credits isn't a rate limit: see the first entry.
xAI is busy or down500 · 503 · "Provider returned HTTP 5xx"
It isn't your key or your credit. Try again shortly, or switch the Grok column to another model. status.x.ai shows xAI's own incidents.
The model does not exist or your team does not have access to it404 · an old or unknown model name
PolyCog only offers current Grok models, so you'd see this from an old saved chat or another app. Pick a model from the Grok column's menu. If it happens on a current model, check the key's Models setting (Your API key or team is blocked).
Add credits to create your API keythe Console won't make a key yet
A team with no credit can't create keys. You'll see this if you chose Skip on the plan screen, or on a new team. Buy the $5 in the box (check its Auto top-up row first), then choose Create API key again.
xAI charged my card againauto top-up
That's auto top-up: it's on unless you switched it off at checkout (step 2), and the Add credits box has the same row every time. It buys more credit when the balance drops below your threshold. Settings › Billing (step 7) shows whether it's on, and lists every charge under Invoices.
No confirmation code arrivedsigning up by email
It comes from SpaceXAI <[email protected]> with the subject "SpaceXAI confirmation code", and in our test Gmail filed it under Spam. After 30 seconds you can choose Resend. Or go Back and use Continue with Google, X, Apple or GitHub instead.
Where's my key?moved on before copying
Just finished signing up? The Dashboard's Start using the API key box may still show it. If not, choose + Create API key (top right of the Dashboard), name it PolyCog, and copy that one. Then delete the lost key (Default API Key) on API Keys. A new key costs nothing.
I made a key under Management Keysit won't run Grok
Management keys (Settings › Management Keys) run xAI's Management API, which looks after the team: keys, billing, members. They can't call Grok. Make a normal key on API Keys instead (step 4) and delete the management key.
Questions people ask
Is the xAI API free?
No. A new team starts at $0.00: in our test (September 2026) the balance was exactly what we paid, with no sign-up credit and no free-credit offer on the Billing page. SpaceXAI's API page says "API usage is billed per token". The smallest purchase is $5, and an everyday Grok answer costs under half a cent. If someone gives you a promo code, Billing has Redeem promo code.
What's SpaceXAI? Is this still xAI?
Yes. SpaceX bought xAI in February 2026 and renamed it SpaceXAI in July. Grok, x.ai, console.x.ai and the API kept their names, so keys, models and prices are unchanged. You'll see all three names on the way: the code email is from SpaceXAI, the terms are xAI's, and the card screen says "Grok xAI".
Does a SuperGrok or X Premium subscription include API credit?
No, they're separate. Those subscriptions pay for Grok in its apps and on grok.com. API credit is bought in the Console, per team, and billed per token.
What is a team?
xAI's docs: "Teams are the level at which xAI tracks API usage, processes billing, and issues invoices." Your credit and your keys belong to a team, so a key only spends its own team's credit. A new team starts at $0.00 and can't make keys until it has credit. Deleting a team deletes its credit.
How do I stop xAI charging my card automatically?
Keep auto top-up off. It's on unless you switch it off at checkout (step 2), and the Add credits box has the same row each time you buy more. Settings › Billing says whether it's on. With it off, xAI only uses the credit you've bought: its docs say that with the default $0 invoiced billing limit, "Your API requests will be automatically rejected once your prepaid credits are depleted." If you turn it on later from Billing, note that its box pre-fills a $25 top-up.
Can I limit what the key can do?
Yes. On API Keys, the key's ⋯ › Edit key › Advanced settings can limit it to some models or endpoints, cap tokens or requests per minute, and set an expiry (1, 5, 30 or 90 days, or a date). There's no dollar limit per key; the Spend (30d) column shows what each key used. For PolyCog, leave Models on All models and Endpoints on All endpoints: a missing one makes the Grok column fail.
Can I get a refund on xAI credit?
No. xAI's FAQ answers "Are API credits refundable?" with a plain no: "xAI API credits are non-refundable." That's one more reason to start with $5.
Does xAI use my prompts?
xAI's docs say API requests and responses are stored encrypted for 30 days to check for abuse, then deleted, and that "xAI never trains on your API inputs or outputs without your explicit permission." A team can also turn on Zero Data Retention in Settings › General, though xAI doesn't recommend it for most people and it switches off the API PolyCog uses for Grok's web search.
Is it safe to give PolyCog my key?
PolyCog sends it only to xAI, only for requests you start. It's kept in your browser, and encrypted if you turn on key sync. You can disable or delete the key on the Console's API Keys page at any time, and with auto top-up off, the credit you bought is the most it can ever cost.
PolyCog puts up to six AI models on the same question, lets them debate, and has the one you pick write the answer. Your keys, provider prices, no markup.
Free tier forever · $10/mo · $250 lifetime · your API keys, your bill
Verified at xAI's help center, developer docs and platform on Sep 26, 2026. xAI moves things around; spotted a change? Send a correction. Screens are simplified drawings, not screenshots. Not affiliated with xAI.All guides → · Models → · Pricing →