Skip to main content
xAI provides the Grok model family. Grok models offer strong general capability with competitive pricing.

Setup

Get your API key from the xAI Console.
export XAI_API_KEY=xai-...

Config

{
  "providers": {
    "xai": "${XAI_API_KEY}"
  }
}

Use it

{
  "agents": [
    { "name": "coder", "model": "xai:grok-3" }
  ]
}
Polpo auto-infers xai from the grok- prefix.

Models

ModelBest forContextReasoningVision
grok-4Frontier — most capable Grok2MYesYes
grok-4-1-fast-reasoningFast reasoning with tool calling2MYesYes
grok-4-1-fast-non-reasoningFast, instant responses2MNoYes
grok-3Strong general-purpose model131KNoNo
grok-3-miniSmaller, faster reasoning131KYesNo
grok-code-fast-1Agentic coding, fast and economicalYesNo
Also available: grok-3-fast, grok-2-vision-1212

Features

FeatureSupported
StreamingYes
Tool useYes
Vision (images)Yes (Grok 4, Grok 2 Vision)
ReasoningYes (Grok 4, Grok 3 Mini, Grok Code)

Pricing

ModelInput (per 1M tokens)Output (per 1M tokens)
grok-4$3.00$15.00
grok-4-1-fast-reasoning$0.20$0.50
grok-3$3.00$15.00
grok-3-mini$0.30$0.50
grok-code-fast-1$0.20$1.50

Provider Details

Provider IDxai
Env variableXAI_API_KEY
API typeOpenAI-compatible
Auto-infer prefixgrok-

Notes

  • Grok models use an OpenAI-compatible API, so they work reliably with Polpo’s tool calling system.
  • Grok 4 has a 2M token context window — among the largest available.
  • grok-code-fast-1 is optimized for agentic coding with fast, economical reasoning.
  • Competitively priced compared to similar-tier models from OpenAI and Anthropic.