Legacy Status and the Stateless Principle
On this page
Updated November 3, 2026 based on xAI best practices: xAI now classifies Chat Completions as deprecated and recommends the Responses API for Grok reasoning models. Concrete reason: Chat Completions lacks a field for the model’s encrypted reasoning, so every multi-turn conversation or tool call loses the reasoning from previous turns. New features also arrive on the Responses API first. Sources: xAI Best Practices · Chat Completions (legacy).
The Chat Completions Endpoint in the xAI Ecosystem
The xAI API offers two main endpoints for interacting with Grok models: the Responses API (primary endpoint) and the Chat Completions endpoint. The latter is marked as legacy: it remains fully functional, but new features are now prioritized for the Responses API.
Why care about it then? Because Chat Completions remains the most widely adopted endpoint in the ecosystem. All existing OpenAI SDKs, frameworks like LangChain or LlamaIndex, and thousands of tutorials use this format. If you are migrating from another provider or working with third-party tools, this is likely the endpoint you will use first.
A Stateless Endpoint: Send Everything with Every Request
The fundamental principle of Chat Completions is that it is stateless: the server keeps no conversation history. With every call, you must include the entire history of previous messages in your request.
Specifically, this means that for a conversation with 10 exchanges, your 11th request must contain the 10 previous messages (user + assistant) plus the new message. Your application handles this history.
{
"model": "grok-4.20-0309-reasoning",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
{"role": "assistant", "content": "Hello! How can I help you?"},
{"role": "user", "content": "Explain deep learning to me."}
]
}
In this example, the first three messages represent the conversation history. Only the last one is the new user message. The model needs all this context to produce a coherent response.
Practical Implications
This stateless approach has several implications:
- Full control: you decide exactly which messages are sent to the model. You can filter, summarize, or modify the history before each call.
- Proportional cost: every request is billed for all tokens sent, including the history. The longer the conversation, the more each exchange costs.
- No server persistence: no data is stored on the xAI side between requests. This is an advantage for privacy, but it requires you to manage persistence yourself.
Comparison with the Responses API
The Responses API, however, is stateful: it keeps the history server-side via previous_response_id. You do not need to resend previous messages—a simple identifier suffices. Responses can be stored for up to 30 days with store: true.
The choice between the two depends on your use case. If you are working with an existing OpenAI SDK or migrating from another provider, Chat Completions is the logical starting point. For a new project, the Responses API is recommended.
Key Takeaways
- Chat Completions is marked legacy but remains fully functional and compatible with the OpenAI ecosystem
- The endpoint is stateless: you must resend the full history with every request
- The cost of each request includes all history tokens
- The Responses API offers a stateful alternative with server-side persistence
- For reasoning models, a 3600-second timeout is recommended