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)

Use the global api.therouter.ai endpoint for new integrations; the legacy China accelerated endpoint is retired.

Models

Grok 3xAI's previous flagship model with 131K context window. Strong general-purpose performance with function calling and structured output support.Grok 3 MiniCost-efficient reasoning model from xAI with 131K context window. Ideal for tasks requiring reasoning at lower cost with function calling and structured output support.Grok 4xAI's most powerful reasoning model with 256K token context window. Excels at complex reasoning, coding, and multi-step problem solving with function calling and structured outputs.Grok 4.1 FastxAI's fastest model with 2M token context window. Optimized for speed without reasoning overhead, supporting text and image inputs with function calling and structured outputs.Grok 4.1 Fast ReasoningxAI's latest fast reasoning model with 2M token context window. Combines speed with strong reasoning capabilities, supporting text and image inputs with function calling and structured outputs.Grok 4 FastxAI's fast model with 2M token context window. Optimized for speed without reasoning overhead, supporting text and image inputs with function calling and structured outputs.Grok 4 Fast ReasoningxAI's fast reasoning model with 2M token context window. Combines speed with strong reasoning capabilities, supporting text and image inputs with function calling and structured outputs.Grok 4.20 Multi-AgentxAI's flagship model optimized for multi-agent orchestration with 2M token context window. Designed for agent-to-agent coordination, delegation, and parallel task execution.

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.

Customer Support