> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cloud/ai/llm/providers/grok.md).

# Grok

Connect Grok as an LLM integration.

xAI runs the Grok models.

## Get your credentials

1. Open the [xAI console](https://console.x.ai/) and sign in.
2. Add credits or a payment method for the team.
3. Go to **API Keys**, press **Create API key**, choose the models and endpoints it may use, and copy the key (it starts with `xai-`).
4. Pick a model from the [xAI models page](https://docs.x.ai/docs/models), for example `grok-3`.

More in the provider's own guide: [xAI API overview](https://docs.x.ai/docs/overview).

## Connect it in Cloud

**Where:** Project → Integrations → LLM → **Add New Integration** → Grok → **Connect** · `/projects/<project>/ai/llms/integrations/new/grok`

| Field            | Required | What it does                                                              | Example                    |
| ---------------- | -------- | ------------------------------------------------------------------------- | -------------------------- |
| API Key          | yes      | The xAI key. Stored encrypted, never shown again.                         | `xai-placeholder-not-real` |
| Endpoint         | no       | Another address for the xAI API. Empty = xAI's own.                       | empty                      |
| Default Model    | no       | The model used when a request names none. Empty = the provider's default. | `grok-3`                   |
| Integration Name | yes      | How the integration is listed in Norbix.                                  | `Grok`                     |

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-40e383a6fa30b177940be6f058579f4b5894ff57%2Fgrok-form-1.png?alt=media" alt="New Grok Integration form filled with placeholder values"><figcaption><p>The filled form (the key is a made-up placeholder).</p></figcaption></figure>

Press **Save**. The title becomes *Editing Grok integration*, the badges say **ENABLED** and **NOT TESTED**, the id (`int_…`) appears with a copy button, the key field is empty again with the note that the key will not be displayed, and the test panel appears at the bottom.

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-6a2d5d4fe20f44dc39bd69b6fff0545c571a15b0%2Fgrok-saved-2.png?alt=media" alt="The Grok integration after save: badges ENABLED and NOT TESTED, the integration id, and the Test integration panel"><figcaption><p>After save.</p></figcaption></figure>

## Test and set as default

**Test integration** checks only that Norbix can read the stored key; it does not call Grok, so a wrong key also passes — see [Test an LLM integration](/codemash/cloud/ai/llm/test.md). Ask the [AI chat](/codemash/cloud/ai/ai-chat.md) a question to check it for real.

The first LLM of an environment gets the **DEFAULT** badge. To make this one the model the AI uses, pick it as the project's **Default LLM** — see [Set the default LLM](/codemash/cloud/ai/llm/set-default.md). To turn it off: [Disable or delete](/codemash/cloud/ai/llm/disable.md).

## Common errors

| Message                                                 | Cause                                                                                                                                                                                | Fix                                                                     |
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------- |
| *Required* under **API Key**                            | The key is empty — it is asked again on every save.                                                                                                                                  | Type the key again.                                                     |
| *Domain URL format is invalid* (`CM-ERRORS-DOMAIN-002`) | **Endpoint** is not a full address.                                                                                                                                                  | Write it with `http://` or `https://`.                                  |
| *Error while running chat turn* when you ask the chat   | The provider refused the call: the key is wrong, or it does not allow this model — Cloud does not show the reason; the server log has it (for example *Status: 401 (Unauthorized)*). | Check the key's allowed models in the xAI console, or create a new key. |
