# Get an API key from xAI (Grok)

> Grok API key from xAI, step by step: buy credits in the xAI console, create the key, keep spending inside what you bought, and connect it to Runner.

Canonical: https://www.runtheworld.ai/guides/grok-api-key

Updated: 2026-10-20

## Make an xAI account, and buy credits

xAI's developer console is at console.x.ai. Usage, billing and keys belong to a team there: you start in a Personal Team, named in the console's top bar, and the team pays for its keys from its credits.

## Create the key in the team you want charged

Check the team in the console's top bar first. A key belongs to the team it's made in, and stays with that team even if the person who made it is removed.

## Keep xAI's spending inside what you bought

Two billing settings decide how far spending can go at xAI: the invoiced billing limit, and auto top-up.

## Paste the key into Runner, under Settings, then LLM providers

The key belongs to your Runner organization, so every product in it can use the key, and only an owner or admin can connect one. Runner encrypts it before storing it and never shows it again.

A key you connect is used before credits, even on AI included.

## Keep the key secret

xAI asks you to treat API keys as sensitive information, like passwords or credit card details.

- Don't share a key between teammates.
- Keep it out of source code and public repositories.
- xAI works with GitHub's secret scanning: if your key turns up in a leak, xAI disables it and emails you.
- Paste it only into Runner's key box, never into a chat, an email or a support ticket.

## Swap the key for a new one, or switch it off

xAI suggests rotating keys regularly. Make the new one before the old one goes.

## Grok runs on your key, whichever way you pay

Grok runs on a key you connect, whether your plan has AI included or not.

Every plan comes two ways, AI included or your own key, and you can change your choice later in Settings. The page on choosing puts the two side by side.

