stateful_chat
Continue server-side stored Grok conversations by sending only the latest prompt with a previous response ID, or omit it to start a new thread.
Instructions
Continue a server-side stored conversation using xAI's deferred/stateful chat.
The xAI API stores every turn so the client only needs to send the latest
prompt plus `previous_response_id`. Omit `response_id` to start a new thread.
Args:
prompt: User message to append.
model: Grok model id (default `grok-4.6`).
response_id: ID of the previous response to continue from (omit to start fresh).
system_prompt: Optional system instruction. Applied only on the first turn.
show_usage: Append a token usage and cost footer to the reply (default False).
Returns:
Assistant reply followed by the new `**Response ID:**` to pass back next turn.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prompt": "<prompt>"
},
"name": "stateful_chat"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | grok-4.6 | |
| prompt | Yes | ||
| show_usage | No | ||
| response_id | No | ||
| system_prompt | No |