Arcana ARCANA

xAI Grok

xAI provides Grok models with real-time data access and an OpenAI-compatible API. Easy to set up if you're already familiar with OpenAI's API format.

Setup

# 1. Get your API key from https://console.x.ai/
export XAI_API_KEY=xai-...

# 2. Verify detection
arcana doctor

# 3. Run
arcana run "hello"

Available Models

ModelContextBest For
grok-3128KGeneral purpose, real-time data
grok-3-mini128KFast, cost-effective

Config File

{
  "provider": "xai",
  "model": "grok-3"
}

Environment Variables

VariableDescription
XAI_API_KEYYour xAI API key (required)
XAI_BASE_URLCustom base URL (default: api.x.ai)

OpenAI-Compatible API

xAI's API is OpenAI-compatible. You can also use it via OpenAI's client by setting the base URL:

export OPENAI_API_KEY=xai-...
export OPENAI_BASE_URL=https://api.x.ai/v1
export ARCANA_MODEL=grok-3

Tips

  • Grok models have access to real-time X (Twitter) data
  • The OpenAI-compatible API means most OpenAI tools and libraries work out of the box
  • grok-3-mini is a good budget option for everyday tasks
Last updated: Jul 24, 2026