# xAI API Key (Grok)

### Step 1: Sign Up or Log In to xAI

1. Navigate to [console.x.ai](https://console.x.ai/).
2. If you don’t have an account:
   * Click **Sign Up** and provide your email address, password, and other required details.
   * Verify your email by clicking the link sent to your inbox.
3. If you have an account, click **Sign In** and log in using your credentials or authenticate via your X (Twitter) or Google account.

### Step 2: Create a Team

1. After logging in, you’ll be prompted to create a team (required for API access).
2. Enter a **Team Name** and a brief **Description**.
3. Click **Create Team**. You can skip inviting team members if working solo.
4. Once created, you’ll be redirected to the xAI Console dashboard.

### Step 3: (Optional) Purchase API Credits

1. During the public beta (until the end of 2024), xAI provides $25 in free monthly API credits, so you may not need to purchase credits immediately.
2. If you need additional credits:
   * Go to the **Billing** section in the xAI Console.
   * Click **Credits** and select **Purchase Credits**.
   * Set up your billing profile and payment method, then purchase the desired amount of credits.
   * Note: Teams spending at least $5 and opting into data sharing may be eligible for $150 in monthly free credits (check country eligibility).

### Step 4: Generate an API Key

1. From the xAI Console dashboard, navigate to the **API Keys** section.
2. Click the **Create API Key** button. A dialog window will open to customize permissions (Access Control Lists or ACLs).
3. Select the appropriate permissions:
   * For general Grok access (e.g., chat completions), choose **chat:write**.
   * For raw Grok-1 model sampling, choose **sampler:write**.
   * Note: Permissions affect token usage, so select only what you need.
4. Click **Save** to generate the API key.
5. The new API key will appear in the list. Click the **Copy** button to save it securely.

### Step 5: Paste API Key in Stammer.ai Vault

1. Log in to your Stammer.ai dashboard.
2. Go to **Agency → Vault → OpenAI API Key**.
3. Paste your Grok API key.
4. Click **Verify & Save**.

Run a quick test chat. If the reply comes back, you are set.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stammer.ai/stammer.ai-docs/chat-ai-agents/vault/xai-api-key-grok.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
