stateful_chat
Continue a stored conversation by sending the latest prompt and previous response ID. Start a new thread by omitting the response ID.
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.3`).
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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | grok-4.3 | |
| prompt | Yes | ||
| show_usage | No | ||
| response_id | No | ||
| system_prompt | No |