Provider profile: xAIxAI's Grok models are built for speed and real-world reasoning tasks, with dedicated reasoning variants and a focus on low-latency, high-throughput production workloads.

← All providers

xAI

US6 models

Grok — real-time reasoning with X platform integration

xAI's Grok models are built for speed and real-world reasoning tasks, with dedicated reasoning variants and a focus on low-latency, high-throughput production workloads.

  • Grok 4 and 3 series with dedicated reasoning and fast inference variants
  • Low-latency, high-throughput design for production workloads
  • Vision support (Grok 4, Grok 4.1 Fast) for image understanding
  • Tool use and JSON mode across all models
ReasoningVisionFast inferenceTool use

Quickstart

from openai import OpenAI

client = OpenAI(
    base_url="https://api.therouter.ai/v1",
    api_key="YOUR_THEROUTER_KEY",
)

response = client.chat.completions.create(
    model="xai/grok-4",
    messages=[{"role": "user", "content": "What is the current state of fusion energy?"}],
    max_tokens=512,
)
print(response.choices[0].message.content)

Frequently Asked Questions

Which xAI Grok models are available on TheRouter?

TheRouter provides Grok 4, Grok 3, Grok 3 Mini, Grok Code Fast 1, Grok 4.1 Fast Reasoning, and Grok 4.1 Fast Non-Reasoning — all via the standard xai/model-name format.

How does Grok compare in cost to GPT-4o?

Grok 4.1 Fast variants start at $0.20/MTok input — significantly lower than GPT-4o. Grok 4 is priced similarly to Claude Sonnet and GPT-4o. Check the pricing page for current rates.

Does TheRouter support Grok's reasoning mode?

Yes. Grok 4.1 Fast Reasoning and Grok 3 Mini include reasoning capabilities. Pass the standard reasoning parameter or use the dedicated reasoning model variant.

How does TheRouter connect to xAI?

TheRouter uses a dedicated xAI provider service that calls the xAI API directly. The adapter uses raw fetch (no SDK dependency) for minimal overhead.