← Master Index
Vol. 22 Module 22.1 Lecture

xAI (Grok, API, Reasoning)

Frontier LLM Providers

How This Lesson Fits the Module & Volume

The first three cards were the “big three” closed labs (OpenAI, Anthropic, Google). xAI is the next frontier provider engineers actually see on shortlists: Grok models, a developer API, and explicit reasoning SKUs. Vol. 11.5 did not give Grok its own family page—treat this lecture as the curriculum’s Grok home, still using the same closed-API logic as closed-source models.

xAI is tightly associated with the X (Twitter) consumer surface and with xAI’s API console. That distribution story matters for product design (realtime/social context, brand tone) but does not authorize unverified claims about training data or secret MoE diagrams. After Grok, Module 22.1 shifts toward open-weight-heavy vendors starting with Meta Llama.

Learning Objectives

By the end of this lesson, students should be able to:

  • Identify xAI as a closed frontier lab and Grok as its model/product family.
  • Separate Grok-in-X (consumer) from the xAI developer API.
  • Describe reasoning SKUs qualitatively (extra test-time compute / tokens) without fake bench scores.
  • Fill a Pricing / Strengths / Weaknesses card vs OpenAI, Anthropic, and Google.
  • Sketch an OpenAI-compatible-style xAI chat call and know to re-read current base URLs and model IDs.
  • State brand, ToS, and data-path risks unique to X-adjacent distribution.
Definition

xAI is the lab behind the Grok family of large language (and multimodal, depending on SKU) models, delivered via consumer Grok apps / X integration and via the xAI API. Reasoning SKUs (names such as Grok reasoning / “think” modes—confirm current IDs) spend additional test-time compute to improve multi-step answers; they are still closed weights. This page catalogs public product posture. It does not assert unpublished architecture or training-set composition.

Product Surfaces

SurfaceJobEngineering note
Grok on X / grok.com appsConsumer chat, search-flavored answers, image gen (SKU-dependent)Great for brand/UX spikes; not your multi-tenant backend
xAI APIMetered chat/completions-style access for appsHistorically OpenAI-compatible enough to reuse client patterns—verify current docs
Reasoning SKUsHarder math/code/planning with extra thinking tokensBudget latency + token spend; eval on your tasks (Vol. 19)
Realtime / X context (product claim)Answers that can incorporate recent public X posts when enabledTreat as a grounding mode with ToS + hallucination risk—not ground truth

Pricing / Strengths / Weaknesses

AxisPricing (qualitative)StrengthsWeaknesses
Fast / standard Grok SKUs Token-metered API; cheaper/faster SKUs vs flagship. Consumer Grok / X Premium-class plans are seats, not API invoices. Competitive closed alternative; often OpenAI-shaped API ergonomics; strong public “witty / less lecturing” product tone some apps want. Smaller enterprise ecosystem than OpenAI/Google/Azure; closed weights; brand association with X may be a procurement plus or minus.
Reasoning SKUs Higher effective cost per answer: thinking tokens + wall-clock. Do not assume they are cheaper than GPT/Claude reasoning modes without measuring. Useful when your eval shows multi-step gains worth the latency. Easy to overspend if every chatbot turn uses reasoning; not a substitute for tools + RAG.
X-grounded / realtime modes May include extra retrieval or tool units—read the live price page. Differentiator vs labs without a social firehose product. Social posts are not citations; Vol. 19 hallucination tests still apply; moderation/ToS scrutiny.
Multimodal add-ons Image understanding/generation SKUs billed separately or via the same meter—confirm, do not invent per-image dollars. One more closed multimodal option. Thinner catalog than Google (Veo/Imagen/NotebookLM) or OpenAI (Whisper/Sora).

Pick xAI when

  • You want a fourth closed frontier for failover/eval
  • Product tone or X-adjacent features are a real requirement
  • Reasoning SKU wins your internal hard-task eval at acceptable latency

Look elsewhere when

  • You need Azure/Vertex/Bedrock procurement paths first
  • You need Whisper/Sora/Veo/Claude Code depth
  • Brand/ToS risk around X is a blocker for the customer

Always still do

  • Vol. 19 eval on your traces, not screenshots of leaderboards
  • Vol. 20 data map: what leaves your VPC to xAI
  • Pin model IDs; reasoning off by default for cheap intents

Why Grok appears on RFPs

  • Another frontier closed model to break duopoly pricing
  • Familiar chat API shape for Vol. 18.1-trained teams
  • Reasoning SKUs as an explicit product line

Why it may fall off

  • Less mature enterprise control story than GCP/Azure incumbents
  • Closed: no self-host flagship
  • Consumer Grok ≠ production API policy

Practical API Sketch

xAI has documented OpenAI-compatible chat endpoints. Confirm base URL, model IDs, and reasoning parameters on current docs before shipping.

# xAI Grok via OpenAI-compatible client (verify base_url + model IDs). # pip install openai # export XAI_API_KEY=... from openai import OpenAI client = OpenAI( api_key=__import__("os").environ["XAI_API_KEY"], base_url="https://api.x.ai/v1", # confirm in current xAI docs ) MODEL = "grok-3" # teaching stand-in; pin a real ID from the console resp = client.chat.completions.create( model=MODEL, messages=[ {"role": "system", "content": "Scoped assistant. Do not treat social posts as ground truth."}, {"role": "user", "content": "When should we enable a Grok reasoning SKU vs a fast SKU?"}, ], temperature=0.2, ) print(resp.choices[0].message.content) print(resp.usage) # Reasoning SKUs / extra think parameters: read current docs — names churn. # Route cheap intents to fast SKUs; reserve reasoning for hard tasks (cost + latency). # Consumer Grok on X is not this client. Vol. 21 HITL still wraps the answer.

Related Lectures

LectureRole
Google / DeepMindPrevious closed estate
Closed-source modelsHow to think about any closed API lab
OpenAI SDKCompatible client pattern many xAI spikes reuse
Hallucination testsRequired if you enable X/realtime grounding
Chatbots / AI searchProduct types Grok often powers
Meta (Llama, SAM, Meta AI)Next: open-weight center of gravity
Common Misconception

Grok on X is the same contract as the xAI API. Second: reasoning SKUs are always worth enabling. Third: realtime/X grounding is citation-grade evidence. Fourth: this lecture contains secret xAI training recipes. Fifth: Grok is open-weight like Llama. Sixth: brand tone (“less censored” marketing) replaces your Vol. 13 guardrails and Vol. 20 policy.

Knowledge Check

  1. Short Answer: What is xAI’s flagship model/product family called? Answer: Grok.
  2. True/False: Flagship Grok weights are generally open for download like Llama. Answer: False.
  3. Multiple Choice: Reasoning SKUs typically: (a) spend extra test-time compute/tokens, (b) are free and instant, (c) replace RAG forever. Answer: (a).
  4. Short Answer: Why separate Grok-on-X from the xAI API? Answer: Consumer/workspace product vs metered developer contract (billing, ToS, SLAs differ).
  5. True/False: Social posts used as grounding are automatically ground-truth citations. Answer: False.
  6. Multiple Choice: A common xAI spike uses: (a) an OpenAI-compatible client + xAI base URL, (b) Gemma weights from DeepMind, (c) Claude Artifacts only. Answer: (a).
  7. Short Answer: Name one qualitative weakness vs Google’s estate. Answer: Thinner multimodal/cloud catalog (no Veo/Imagen/NotebookLM/Vertex-depth)—or smaller enterprise ecosystem (either OK).
  8. True/False: You should memorize invented Grok dollar prices from this page. Answer: False.
  9. Multiple Choice: Enable reasoning by default on every chatbot turn: (a) usually wasteful; route hard tasks only, (b) required by law, (c) makes weights open. Answer: (a).
  10. Short Answer: Which vendor lecture comes next? Answer: Meta (Llama, Segment Anything, Meta AI).

Key Takeaways

  • xAI = Grok consumer surfaces + developer API + explicit reasoning SKUs; closed weights.
  • Qualitative pricing: seats vs tokens; reasoning costs extra latency and tokens.
  • Differentiator: X-adjacent realtime story—treat as fallible grounding, not evidence.
  • Compatible client spikes are fine; pin IDs; keep Vol. 19/20 controls.
  • Next: Meta Llama / SAM / Meta AI opens the open-weight half of 22.1.
Trainer’s Guide

Lab: Vendor card: Grok fast vs reasoning SKU routing table (intent → SKU). One compatible chat spike if keys exist; otherwise a dry-run config (base URL, env var, pin ID). Write a one-paragraph ToS/brand risk note for a regulated Vol. 21 vertical (finance/health/education)—no X scraping how-tos.

Whiteboard: Closed four: OpenAI, Anthropic, Google, xAI. Then a divider: “open-weight labs start here” → Meta.

Recap: xAI’s Grok API and reasoning SKUs are a fourth closed frontier option. Next is Meta.