Models & Providers

Grok (xAI)

Connect xAI's Grok models with an xAI API key

Overview

xAI's Grok models are available as their own provider option. Pick Grok (xAI) on the provider picker when you add an LLM configuration. It sits in the Direct APIs group alongside OpenAI, Anthropic and Gemini.

Grok is the simplest of the newer providers to set up, because xAI's API is wire-compatible with OpenAI's Chat Completions API. You need only an API key.

Grok has its own provider tab but no separate backend provider. Because xAI serves an OpenAI-compatible API, MagOneAI stores a Grok configuration with the openai_compatible provider underneath, exactly as it does for OpenAI and Self Hosted.

The tab you picked is remembered separately, so the edit panel re-opens on Grok (xAI) rather than guessing from the endpoint. The provider tab says where a model comes from. It never says what the model can do. Capabilities are independent flags. See Model capabilities.

Setup steps

Create an xAI API key

Sign up at console.x.ai and create an API key. Configure billing on the account.

Add the configuration in MagOneAI

Open LLM configurations for the organization and add a new configuration. Select Grok (xAI) as the provider.

The endpoint is pre-filled with xAI's base URL:

https://api.x.ai/v1

Leave it as it is unless xAI tells you to use a different base URL.

Enter the API key

Paste the xAI key. MagOneAI stores it in HashiCorp Vault and keeps only a Vault reference on the configuration row.

Pick a model

With the key in place, the model picker calls GET /v1/models against api.x.ai and lists the models your account can use, for example grok-4 or grok-4-fast.

Declare capabilities and save

Tick Supports Vision for a Grok model that accepts images. Set Reasoning / thinking to match what the model does, and fill in Advanced → Cost (USD per 1K tokens).

Click Save. MagOneAI runs one test call through the gateway before storing the configuration.

Error messages from xAI

api.x.ai is on MagOneAI's list of trusted provider hosts, along with api.openai.com, api.anthropic.com and generativelanguage.googleapis.com.

For a trusted host, MagOneAI forwards the provider's own error body to you unchanged, so a message such as "model not found" or "incorrect API key" reaches you verbatim. For any other endpoint, including a self-hosted one, MagOneAI shows only a generic message. That limits what an arbitrary user-supplied URL can reflect back into the product.

Function calling and vision

Grok follows OpenAI's Chat Completions contract, so tool definitions and tool calls use the same format MagOneAI already sends to OpenAI. No extra configuration is needed to attach tools to an agent using a Grok model.

For vision, MagOneAI sends images to OpenAI-compatible endpoints by URL where it can, and falls back to inline base64 when a direct URL is not usable.

Troubleshooting

Next steps

MagOneAI© 2026 Magure, Inc.

On this page