Skip to main content
xAI provides the Grok family of models through an OpenAI-compatible API. docker-agent includes built-in support for xAI as an alias provider.

Setup

  1. Get an API key from console.x.ai.
  2. Set the environment variable:
export XAI_API_KEY="your-api-key"

Configuration

agents:
  root:
    model: xai/grok-3
    description: Assistant using Grok
    instruction: You are a helpful assistant.

Available models

ModelDescriptionContext
grok-3Latest and most capable Grok model131K
grok-3-fastFaster variant with lower latency131K
grok-3-miniCompact model for simpler tasks131K
grok-3-mini-fastFast variant of the mini model131K
grok-2Previous generation model128K
grok-visionVision-capable model32K
For the latest model list, see the xAI documentation.

Thinking budget

Grok models support thinking mode with effort level strings:
models:
  grok:
    provider: xai
    model: grok-3
    thinking_budget: high  # minimal | low | medium | high | none

How it works

xAI is a built-in alias provider:
  • API type: openai_chatcompletions
  • Base URL: https://api.x.ai/v1
  • Token variable: XAI_API_KEY

Example: research assistant

agents:
  researcher:
    model: xai/grok-3
    description: Research assistant with real-time knowledge
    instruction: |
      You are a research assistant using Grok.
      Provide well-researched, factual responses.
      Cite sources when available.
    toolsets:
      - type: mcp
        ref: docker:duckduckgo
      - type: think

Build docs developers (and LLMs) love