Creating an xAI API key
This guide is part of the Publicus connection catalog. Once you have the credentials, connect the service and Publicus stores them for you.
Distilled from xAI’s own documentation: Quickstart, Security FAQ, Accounts and Authorization and API reference overview. Retrieved 2026-10-25.
The xAI API (its documentation now says SpaceXSI) authenticates every call with an API key sent as Authorization: Bearer <key>. A key belongs to one team, and it can reach only the endpoints and models its permissions grant.
- Sign up or sign in at console.x.ai and load the team with credits. API calls are billed against them.
- Check that you are viewing the right team. API keys are tied to the team they were created in.
- Open the API Keys section from the sidebar (direct link).
- Click Create API Key and give it a name.
- Make sure the key can reach the endpoints and models the connection will use. xAI keys have no permissions unless they are granted, and a key without any fails every request. Access to all endpoints and all models is the
api-key:endpoint:*andapi-key:model:*pair. A key can also carry its own request and token limits and an expiry. - Copy the key and store it in a secrets vault. xAI does not expose the full key again after it has been created.
Operational notes:
- Inference goes to
https://api.x.ai(paths under/v1). To keep processing in the United States, usehttps://us.api.x.ai/v1, which costs 10% more and serves fewer models (Regional Endpoints). - To see a key’s name, status and permissions, call
GET https://api.x.ai/v1/api-keywith it. - A Management API key is a different credential for
https://management-api.x.ai, which handles keys, billing and audit. It is not the key described here. - To rotate a key, open the vertical ellipsis next to it in the API Keys table and choose Disable key or Delete key, then create a new one. xAI disables keys that GitHub secret scanning finds leaked.
Connect it to Publicus
Section titled “Connect it to Publicus”Open Connections under Credentials, choose xAI, and pick xAI API key. Publicus asks for exactly the fields listed above and keeps them in your workspace’s secret storage.
See also: xAI in the catalog.
This guide is maintained by Publicus and published under CC BY 4.0.