Grok model behaviour
xAI's API surface, its OpenAI-compatible edges and where that compatibility stops, version by documented version.
xAI describes its inference API as compatible with the OpenAI REST API, and for the first request that is true: change the base URL to https://api.x.ai/v1, change the key, change the model name, and an existing client works. The interesting part of Grok is everywhere that sentence stops being true. Reasoning models reject stop and the two penalty parameters. logprobs is accepted and silently ignored by the newest family. There is a second, non-OpenAI request shape — the Responses API, with input instead of messages and a flatter tool definition — and the newest server-side tools are documented only against that one. Pricing has a step in it at 200k prompt tokens.
These pages work through that surface one field at a time, taking every figure from a named xAI page and marking the ones expected to move. Where xAI publishes nothing — and on output ceilings and image token arithmetic it publishes nothing — the page says so and points at the response field that answers the question for your own account, rather than filling the hole with a number from somewhere else.
Grok's Context Window Across Versions
The documented context length of every current Grok model, and the 200k pricing step that sits inside those windows.
8 min read
Function Calling in the xAI API
The two tool-call shapes xAI documents — the flat Responses form and the nested OpenAI-compatible form — and the schema rule that rejects a request outright.
9 min read
Grok's Default System Prompt and Persona
What xAI actually publishes about Grok's system prompts, which of those apply to the API rather than to the chat products, and what a custom system message replaces.
8 min read
How Real-Time Data Reaches Grok: Fed Into Context, Not Fine-Tuned In
The server-side search tools that put fresh X posts and web pages into the context window at request time, and what that costs you in tokens and latency.
9 min read
The Streaming Response Shape of the xAI API
The SSE chunk shape xAI documents, where usage appears, and the two places the stream stops being OpenAI-compatible.
9 min read
Grok's Documented Content Policy Restrictions
What xAI's published acceptable use policy forbids for hosted API traffic, and which of those clauses are about your integration rather than about the prompt.
8 min read
Grok's Max Output Tokens per Model
xAI does not publish a per-model output ceiling; the limit comes from max_completion_tokens, its 128,000 default, and the context window the output shares.
8 min read
Vision Input in Grok: Image Support and Token Cost
The documented limits on image input to Grok — 20 MiB, JPEG and PNG only, no cap on image count — and the response field that reports what an image cost.
8 min read
Grok's Model Deprecation and Version History on the xAI API
The eight slugs xAI retired on 15 May 2026, what happens to requests that still use them, and why a redirect is a worse failure than a 404.
9 min read
Stop Sequences in the xAI API
How the stop parameter behaves on Grok — four sequences, trimmed from the output, and rejected outright by reasoning models.
8 min read
Pinning a Dated Grok Model Snapshot
Swap a moving Grok alias for a dated snapshot, verify which model actually served the request, and get an alert when the pin stops being valid.
9 min read
Grok's Reasoning Mode: How the “Think” Output Differs From the Final Answer
Where the reasoning trace lives in an xAI response, how reasoning_effort controls it, and why the trace is billed whether or not you see it.
9 min read
JSON Mode and Structured Output in Grok
The three documented response_format types on the xAI API, what the schema guarantee does and does not cover, and when a forced tool call is the better instrument.
9 min read
Grok's Tokenizer: Why Token Counts Differ From GPT's
Why a GPT tokenizer is the wrong instrument for a Grok token budget, and the two documented ways to get a number xAI will actually bill you for.
8 min read
Other topics
- LLM fundamentals & architecture
- Tokens, tokenization & context windows
- Prompt engineering
- Reasoning models & test-time compute
- Multimodal AI: vision, audio, video
- RAG & retrieval
- Embeddings & vector search
- AI agents & tool use
- Structured output & function calling
- Fine-tuning & post-training
- Local inference errors, string by string
- Running local models day to day
- Testing code that calls an LLM
- Snapshot and property testing for model output
- Regression suites for prompts
- Eval gates in CI
- Flaky tests against a model
- Determinism and the cost of testing
- Contract and streaming tests
- Testing tool calls and retrieval
- Inference, serving & latency
- Rolling out a prompt change
- Testing AI systems in practice
- Forecasting a time series
- Machine learning on tabular data
- Geospatial data and models
- Understanding audio that is not speech
- Understanding video
- Core computer vision tasks
- Machine learning on graphs
- Point clouds and 3D
- Evaluation, benchmarks & LLM-as-judge
- Sensor and IoT data
- Logs and event streams
- Models over biological sequences
- Machine learning on molecules
- Embedding and searching code
- Extracting invoices and purchase orders
- Receipts, statements and tax forms
- Insurance policies and contracts
- Deeds, court filings and patents
- Extracting from medical records
- Observability & LLMOps
- CVs, certificates and identity documents
- Shipping, customs and technical documents
- Meetings, email, chat and filled-in forms
- Building an extraction pipeline
- Business, property and inspection documents
- Contract clauses and insurance claims
- Regulated and compliance documents
- Consumer, travel and closing documents
- Mapping one chat API onto another
- SDK and framework migrations
- Hallucination & failure modes
- Re-embedding and model deprecation
- Cutting over between providers
- Parity gaps, shims and legacy endpoints
- Moving between model versions
- Migrating vector stores and caches
- Mapping capabilities and parameters
- Migrating pipelines and agents
- Contracts, runbooks and rollback
- Auditing a codebase before a cutover
- Compliance and fine-tune migration
- LLM cost engineering
- Routing, cost tracking and multi-tenancy
- What a migration does to your prompts
- AI security & prompt injection
- Privacy, compliance & data residency
- AI governance, policy & society
- Building reliable AI applications
- AI hardware, GPUs & compute
- Open-weight models & local inference
- AI for developers & coding agents
- AI in industry: vertical playbooks
- AGI, superintelligence, alignment & the long future
- Machine learning foundations
- NLP fundamentals & classical tasks
- Data engineering for AI
- Synthetic data & dataset curation
- AI product design & UX
- Search, ranking & recommendation
- Enterprise adoption & change management
- AI careers, skills & teams
- Reading AI research
- AI in science & discovery
- Robotics & embodied AI
- AI economics, markets & business models
- AI myths, hype & media literacy
- Context engineering
- Shipping AI features: patterns & anti-patterns
- Build it: end-to-end AI tutorials
- Python for AI: hands-on recipes
- TypeScript, React and the web
- Frameworks and SDKs
- Errors and troubleshooting
- AI facts, numbers and statistics
- The history of AI
- The maths behind AI
- Architectures beyond the transformer
- Reinforcement learning
- Diffusion and generative media
- Speech, audio and voice engineering
- Benchmarks, one at a time
- AI search visibility
- Infrastructure and operations
- Databases and storage for AI
- Knowledge graphs and structured knowledge
- Classical ML in production
- Regulation, jurisdiction by jurisdiction
- Prompt recipes and pattern library
- AI for people who do not write code
- Writing, media and creative work
- Edge and on-device AI
- Interpretability and model internals
- Field notes
- OpenAI model behaviour
- Claude model behaviour
- Gemini model behaviour
- Llama model behaviour
- Mistral model behaviour
- Qwen model behaviour
- DeepSeek model behaviour
- Cohere model behaviour
- Small model behaviour
- Hybrid model architectures
- Token cost by language and script
- Transliteration, romanization and script handling
- Locale-correct output
- Multilingual generation quality
- Multilingual pipelines
- The EU AI Act, article by article
- AI under the GDPR and EU data law
- US AI regulation, state and sector
- International AI governance and standards
- AI litigation and enforcement
- Running AI workloads on AWS
- Running AI workloads on Google Cloud
- Running AI workloads on Azure
- AI at the edge: Workers, Vercel and Netlify
- Serving models on Kubernetes
- Operating AI infrastructure
- Quantization formats and what they cost
- llama.cpp, flag by flag
- Ollama and the desktop local-model runtimes
- Local models on Apple Silicon
- Hardware for local inference
- Running speech and embedding models locally
- Model files, adapters and conversion
- VRAM arithmetic for local models