stateful_chat
Continue conversations with Grok AI by sending only new prompts, using stored response IDs to maintain context across multiple interactions.
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-1-fast-reasoning`).
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.
Returns:
Assistant reply followed by the new `**Response ID:**` to pass back next turn.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | ||
| model | No | grok-4-1-fast-reasoning | |
| response_id | No | ||
| system_prompt | No |